How to filter Go To Definition results #9459
Replies: 1 comment 3 replies
-
We currently send the go to definition results to VS Code via the LSP (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition), so I don't think it's filterable. We'd have to switch to sending the results to our TypeScript component like we do or other cases (https://github.com/microsoft/vscode-cpptools/tree/main/Extension/src/LanguageServer/Providers ), but even in that case there'd have to be some mechanism to send the results to another extension instead of to VS Code. You could potentially use a multi-root workspace with different browse.path and files.exclude settings such that each workspace folder has different definitions available (and/or with multiple configurations for each workspace folder). Maybe your could write a configuration provider like CMake Tools or Makefile tools, but I don't think the current configuration provider API (https://github.com/microsoft/vscode-cpptools-api) is sufficient, since it only allows setting the browse configuration and include paths, etc. |
Beta Was this translation helpful? Give feedback.
-
Hi , I have a large project that is full of many many implementations of the same functions.
For example:
In my project (this is UEFI), there might be 5 or 6 implementations of
GetSomeFoo()
in as many libraries that are selected at build time by very non-standard build tools (EDK2) that are well outside the scope of any reasonable knowledge cpptools would have. Currently, cpptools will give me a list of all the different results it found, and I have to know which one is correct. This is rarely easy. I understand I can do something like this:But I have many modules that are using all the different variants depending on what module it is, all in the same project. So it's not really reasonable to expect cpptools to know which definition pertains to which code chunk I happen to be working in. I typically work in several at once because I need to make different modules work together during boot.
Therefore... I was wondering if I can make an extension that can "intercept" the results of Go To Definition and apply my own programmatic filters to present only the results that my logic dictates. I can write logic that can know which is correct based on the deep and confusing magic of UEFI. Is there a way I can filter Go To Definition results with my extension? Does cpptools export something I can read from?
Beta Was this translation helpful? Give feedback.
All reactions