BigBahss / vscode-cmantic

C/C++ code generation for VS Code: Generate Definitions, Getters, Setters, and much more.
https://bigbahss.github.io/vscode-cmantic/
MIT License
83 stars 9 forks source link

Add completion suggestions for 'Add Include' #4

Closed BigBahss closed 3 years ago

BigBahss commented 3 years ago

It would be nice to add completion suggestions for the 'Add Include' command. Although, this doesn't seem straightforward with the current implementation that uses the input box.

One idea is that 'Add Include' could open a small ~CodeLens~ to the spot where the new include would be added, in which case auto-completions would be provided automatically by other extensions. I think I like this idea, except in order to place includes based on if they are a system header (#include <...>) or a project header (#include "...") it would probably require 2 different commands in order to automatically place the starting #include prompt in the right spot. I'm not a big fan of requiring 2 different commands since it seems a little clunky, but (counterintuitively) this might be mitigated by having a third command that just goes to the end largest block of includes, not caring if they are system or project headers.

Also, I have no experience with the ~CodeLens api~, so I don't know how easy this would be. Suggestions on how to implement this are welcome.

BigBahss commented 3 years ago

The CodeLens api wasn't what I thought it was, I was thinking of 'peek locations' (editor.action.peekLocations command). I have played around a bit with this, and it doesn't seem possible to give editing focus to the peek-window. We can insert the start of the include statement, but the user has to click into the window to start typing in it, and manually close the window when they're done. This feels very clunky. I am going to close this for now, because this feature has become a much lower priority, and I think the current implementation is good enough for what it is.

BigBahss commented 3 years ago

Reopening because I've found a decent way to implement this feature using the same input-box that is currently used.

BigBahss commented 3 years ago

Added in v0.9.0