yvesdm3000 / ClangLib

Code::Blocks plugin integrating various features of LLVM Clang.
5 stars 4 forks source link

Feature request: Make Clang syntax for keyword code completion optional #11

Open scarphin opened 7 years ago

scarphin commented 7 years ago

Hi, I have been using your plugin for a while now and I can say it works better than CodeBlocks' own CC plugin. Thanks a lot for this.

However, an annoying issue (at least for me) is the Clang's way of completing the keywords like for, while etc... The topic I came up with may be confusing so I'll provide an example. If I try to complete say 'while' I get something like: while( /*! condition !*/ ){ } but this is not the syntax I desire. The output I desire from Clang part is just 'while'. I use the abbreviations plugin of CB to configure the syntax for keywords and other stuff and unfortunately I am very used to pushing tab key (to code complete) after I type 'whi'. Can this behavior be optional? Or in case you don't have much time to work on it, can you at least give me a hint where on code can this behavior be disabled so I can do it on my self compiled CB? I may be able to provide a patch if I can figure it out too.

Is it also possible to make the Clang's way of function completion optional? I find it a little confusing to have the parameters as comments when the calltip shows different parameters in case there are other overloaded functions. Other than that 'tab smart jump' is a must to browse through the parameters effectively which I'm not used to.

Anyhow thanks again for the awesome plugin.

yvesdm3000 commented 7 years ago

Hi,

If I remember correctly, there is a flag that you can pass to the clang library part wether you want completion for those different keywords (if/for/while/case etc). I don't think it would be hard to make a configuration-option and links to that flag.

Development hasn't stopped, but I'm currently (and slowly) working on reference-lookup and a browse-tree where you can easily go down a level, which does a new reference-lookup of the parent (and then another one of that parent etc...). This is something pretty powerful to understand huge codebases.

yvesdm3000 commented 7 years ago

Pushed a fix for this feature request to the 'staging' branch. I hope this should implement the feature you requested ?

scarphin commented 7 years ago

Thanks for the fix and sorry for the late reply, it took me a couple of days to compile and try.

With the new fix, I don't get any code completion suggestions for switch/while/for etc... if I disable 'Add code patterns to Code Completion results'. To be more clear, clang no longer code completes the keywords like while/switch etc... From what I understand, clang either completes the keywords with its own syntax or doesn't complete at all. Is that the intended behavior or am I missing something? Can it be adjusted to just code complete the keyword with nothing extra?

Also 'Add brief comments to Code Completion result arguments' doesn't have any effect on commented function parameters. Whether enabled or disabled, I always get commented function parameters when I code complete a function. Again is that the intended behavior?

yvesdm3000 commented 7 years ago

Too bad this is not how code-completion is implemented in Clang. However this can obviously be programmed by removing everything between { } in the code-completion result value. The "Add brief comments" is an option that can be passed to Clang, but I'm however unsure what it exactly does. Since it's part of the same set of options that could be set for code-patterns, I simply took it with me while implementing the option (Same for the macro option).

scarphin commented 7 years ago

Anyhow it's better than the old implementation though, now I can type a couple extra characters to complete the keyword myself instead of deleting many extra characters which is way too easier to deal with. ;) Or maybe I'll try the clang-format way if I can configure it for general use.

Thanks anyway.