Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion not working in some cases #11

Open
fehmud opened this issue Jul 4, 2015 · 6 comments
Open

Completion not working in some cases #11

fehmud opened this issue Jul 4, 2015 · 6 comments

Comments

@fehmud
Copy link

fehmud commented Jul 4, 2015

Sometimes, company-irony does not list any candidates, even when headers are present and the code compiles flawlessly. How could this be troubleshooted? Thank you.

@Sarcasm
Copy link
Owner

Sarcasm commented Jul 5, 2015

Are you sure you are using the company-irony backend?

You can look in the modeline that it is irony and not company-clang or something else that is used.
You can also call M-x company-irony RET manually to be sure you are using the proper backend.

Do you have the compile options properly setup? M-x irony-cdb-menu RET?

@fehmud
Copy link
Author

fehmud commented Jul 12, 2015

Sorry, I had forgotten to say that I had checked all the obvious configurations, including checking whether irony-server was running. Anyway, it turned out that I had a broken configuration and an old version of irony (the stable version that is available on Melpa Stable, that is). Anyway, I managed to fix everything. Now, I have only a couple of suggestions:

  • when company-irony completes the first time, there is a long delay. I suppose that that is because it must start the server. But users could think that company-irony is stuck, therefore an informatory message -- like "Starting irony-server, please wait..." -- would help;
  • the implementation of irony--locate-server-executable only prints a message when there is an error. But messages get lost in the Messages buffer when you restart Emacs and all files gets reopened by Desktop Mode. Therefore, irony--locate-server-executable should raise an error instead, or at least use warn instead of message.
  • also, I can't recall where I have read that company-irony works only if it comes before company-clang. If indeed this is the case, then this is another check that company-irony could perform the first time that it runs.

Thanks for your assistance.

@fehmud
Copy link
Author

fehmud commented Jul 12, 2015

Another problem is that company-irony on Melpa Stable pulls the old version of irony, and if users remove the old version of irony, package-initialize will fail to enable company-irony if the load-path doesn't contain the new irony yet. This is another problem that company-irony had in my configuration. Therefore I removed company-irony from the packages handled by the package manager and installed it by hand.

@fehmud
Copy link
Author

fehmud commented Jul 12, 2015

But users could think that company-irony is stuck, therefore an informatory message -- like "Starting irony-server, please wait..." -- would help;

Another idea would be to start the server in the C Mode hook, therefore Irony should offer an irony-start-server command to run there.

@Sarcasm
Copy link
Owner

Sarcasm commented Jul 13, 2015

when company-irony completes the first time, there is a long delay. I suppose that that is because it must start the server. But users could think that company-irony is stuck, therefore an informatory message -- like "Starting irony-server, please wait..." -- would help;

Starting the server shouldn't take long. What takes time is usually the first parsing of the file, when the precompiled preamble hasn't been generated yet. But this timing isn't specific to the irony-server start, it will happen in some other situation and irony doesn't really know actually, so it's difficult to provide a message.

the implementation of irony--locate-server-executable only prints a message when there is an error. But messages get lost in the Messages buffer when you restart Emacs and all files gets reopened by Desktop Mode. Therefore, irony--locate-server-executable should raise an error instead, or at least use warn instead of message.

In one of my local commit I have changed the function to signal an error. Elisp code calling the function will have the possibility to handle the failure gracefully.

also, I can't recall where I have read that company-irony works only if it comes before company-clang. If indeed this is the case, then this is another check that company-irony could perform the first time that it runs.

That's one of the "core principle" of company. I don't want to check this kind of things in company-irony because it is error prone. The company-backends variable is non-trivial, I don't want to perform some checks on it. company-diag and company's mode-line message should inform the user about the selected backend.

Another problem is that company-irony on Melpa Stable pulls the old version of irony, and if users remove the old version of irony, package-initialize will fail to enable company-irony if the load-path doesn't contain the new irony yet. This is another problem that company-irony had in my configuration. Therefore I removed company-irony from the packages handled by the package manager and installed it by hand.

I'm not sure to understand. Isn't that a bug in the package dependency management?

Another idea would be to start the server in the C Mode hook, therefore Irony should offer an irony-start-server command to run there.

Offering a way to start irony-server in a mode hook in addition to the first time it is needed may be a good idea. We will see but as I said earlier, in my local work I already changed the function a little bit and the functions that need irony-server will normally already handle this error gracefully.

@fehmud
Copy link
Author

fehmud commented Jul 14, 2015

I'm not sure to understand. Isn't that a bug in the package dependency management?

Rather than a bug, it seems that such situations must be handled on a case by case basis (see C-h f package-load-list). I am not sure about how to handle this, therefore I am voting to leave things unchanged.

We will see but as I said earlier, in my local work I already changed the function a little bit and the functions that need irony-server will normally already handle this error gracefully.

Then please let me know as soon as you will have uploaded the new code.

Thanks for your assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants