Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
904 stars 99 forks source link

Some problems and suggestions #51

Closed hongxuchen closed 9 years ago

hongxuchen commented 11 years ago

Hi Guillaume, thanks so much for providing this wonderful tool for C++ programming in Emacs.

However I think there still can be some improvements:

  1. irony-compile-flags is usually not set right when explicit flag is a necessity. It seems that there is always a need to run C-c C-b manually each time I load a project, which is a bit annoying. I think there need to be a choice(or simply loads it) when irony detects some flags related files(cmake, json compilation database, .clang_complete or .dir-locals).
  2. irony-cdb settings for cmake is a bit inflexible since the build directory has to be put inside the root directory of the project(for instance, irony-build directory has to be put inside irony-mode).
  3. It seems that .clang_compilation have a limitation that each flag should occupy one line. Although it is a good habit to be written like this, but I think the docs should include this detail.
  4. I think the completion of headers should also contain those specified in irony-compile-flags, and it seems that irony has not included yet. Also I find that there are some problems when irony-compile-flags also include those system headers, however without them irony complains there are errors as well.
  5. Personally I have a need to set ffap-c-path for convenience(especially when due to some reasons irony detects errors and I have to lookup the header files to make sure it's not my fault), a hook after the cdb settings should be a direct solution.
  6. The error messages returned by irony-compile-check give so little information that I usually have to read the log file inside /tmp/. And I think there is a need to include the diagnostics, too. And when irony-compile-check finds error, there is a choice that I can see what's going wrong(I simply add a line inside CompileCheck.cpp to print the diagnostics information, it's really a dirty tweak; I think the right approach should be redirecting them to a special file). Also when there are only warnings, there is no need to suggest C-c C-b:-)
  7. Some kind of completion is not covered, for instance, when I write puts(__fu|) and the cursor now behind u of __fu(and it is in the snippet state), C-<RET> would cause Emacs hanging there(I guess it is because there is no answer from the server side).
  8. I don't know why, but irony-flycheck is really slow. And there are some errors for this plugin: to use (irony-enable 'flycheck), I have to change the name irony-flycheck.el to flycheck.el and change (provide 'irony-flycheck) to (provide 'irony/flycheck). And since there is a general purposed Emacs extension flycheck with the same name flycheck.el, I think some modifications is needed.
  9. Could you please tell me the necessity to add a copy inside /tmp/? (Sorry that I am not so familiar with clang pch and emacs handling for process.)
  10. I write a simple plugin SymbolInfo,cpp and elisp, based on cc-lookup(I wrote several days before) for irony-mode(and I copy quite a lot of code from your well written completion plugin), but since I think it is still too simple(for instance, doxygen document features can be added). I hope you can give me some adivice whether it could be added into the main stream now(there are still some bugs which I think have relations with the temporary files inside /tmp/ since I really don't know the mechanism behind this).
Sarcasm commented 11 years ago

Hi, FYI I'm aware of the issue but since there are a lot of points I need some time to check it out (during the week-end hopefully).

To quickly clarify some of your concerns:

hongxuchen commented 11 years ago

Many thanks for your reply. I realize that you have noticed most of these issues, and this is just a reminder:-)

Also, I think rtags can do all the symbol lookup work I need as long as the source code is indexed by it, so I think it is superior.

But rtags really has poor code completion support, in which irony-mode has overwhelmingly advantage.

Sarcasm commented 11 years ago
  1. Currently it should be necessary to specify the compilation DB only for the first file in a project. Once a compilation DB has been loaded every other file opened will benefit from the flag of the compilation db. Do you once an instance of Emacs has opened a compilation I should save it across the session? If that's your idea I agree with you and I'm okay to open a "feature request" about this.
  2. That's actually not necessary but it's not obvious. The compilation db has to letter, lowercase and uppercase. The lowercase doesn't use the default value found, so if you hit c you will have a prompt asking for the directory (that can be outside of the root directory of the project). The uppercase is just a shortcut that will use the default value written next to the option [with root=...] (logged as #53).
  3. Just in case, it's .clang_complete. I will add this thank you (committed as 6f3e7bb). Hopefully this can be improved outside of the README by #53, it's better if everything is obvious and self-documenting.
  4. Can you be more precise? Eventually open an issue about this. User directories should appear on header completion and system headers should not be an issue apart from https://github.com/Sarcasm/irony-mode#i-got-an-error-due-to-stdargh-how-to-solve-this
  5. I want this feature as well and I don't think it should take a lot of time, I logged an issue #54, I believed you have tried something. If the implementation is okay maybe you can make a pull-request. Otherwise I will take a look when I have time.
  6. I hope to have a real syntax check plugin so I don't want to add these kind of features to CompileCheck. CompileCheck is just here to see if compilations flags may be needed. As you said there is no need to suggest compialtion DB if there is only some warnings. Logged as #55.
  7. Hum, nice catch. Logged as #56, probably the first issue I will worked on since it just made my Emacs unusable...
  8. Ignore flycheck for now, it was just some experimentation, I removed it.
  9. Already answered. I logged the possible improvement of sending the file content through the process directly. Logged as #57.
    • For .dir-locals can you be more explicit about the issue? Do you have the same file content as here or https://github.com/Sarcasm/irony-mode/blob/develop/.dir-locals.el or are you talking about passing the flag irony-compile-flags-work-dir and irony-compile-flags as written in the README? I may need to check the latter since I'm not using this maybe it's a bit broken.
    • For 7., thanks for the clarification, I'm able to reproduce the issue so I will try to work it out.
    • For 10. I will accept such a plugin but I will review the code before integrating it into irony-mode. I would like to have something to navigate easily but I haven't found the "ultimate" solution. I think the big part of the indexing can (should?) be done by an external program. But irony-mode can come in handy at updating the files that are being edited

Yeah I looked at rtags a few times (not that much recently) but it seems difficult to integrate with irony at the time. Last time I checked they seemed to have a nice way of handling code navigation I totally agree.

Sarcasm commented 11 years ago

Oups I forgot to say, don't hesitate to make different issues as it's simpler for me to manage them and to keep track of what has to be done.

hongxuchen commented 11 years ago
Sarcasm commented 9 years ago

Closing this.