Access C preprocessor features from non-C vscode extension #8622
Replies: 1 comment
-
Our extension is only designed to work on C/C++ files...if you want the feature for non-C/C++ files you'd need to add the file or file extensions to the files.associations setting to associate it with "c" or "cpp", although in that case it might break some features with your extension. Our extension is not designed to re-usable by extensions supporting other languages. Our extension implements the LSP's hover (macro expanding) and definition requests: https://microsoft.github.io/language-server-protocol/specification#textDocument_hover and https://microsoft.github.io/language-server-protocol/specification#textDocument_definition (in our closed source cpptools process). It's possible you might be able to register your extension as a C/C++ provider, but then don't register as providing hover/definition capabilities and it might fallback to using our extension...but I'm not familiar with what exactly happens when multiple providers for the same language are active. |
Beta Was this translation helpful? Give feedback.
-
With the C/C++ extension installed, if I'm in a .c/.cpp/.h file and I hover over C uses of preprocessor macros (#defines), it will show a popup box where it shows "Expands to:". Additionally, if I right-click and choose "Go to Definition" or "Go to Declaration", it will navigate to that #define.
I've put together a rudimentary syntax highlighting plugin for a non-C assembler (xa65). The macros in xa65 are very similar to those of the C preprocessor (and it also supports direct use of the C preprocessor). It would be great to be able to somehow access the C preprocessor functionality of the C/C++ extension in order to support macro expanding and go to's in my extension as well.
I have a few questions:
Beta Was this translation helpful? Give feedback.
All reactions