-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getReferencesCommand #3886
Comments
@Lennon925 Can you explain why this would be useful? Why would this command be used instead of opening the file and invoking the Find All References at the line column? The Find All References command would have to "open" the file and do the IntelliSense parsing regardless of whether the file is opened in the editor or not. |
Because I want to implement multi-level "find all references". Currently there is only one level results when you click "find all references". I want to pass document uri and symbol position to cpptools server regardless of the this document is opened or not in editor and hope it can return all references to me so that I can implement multi-level "find all reference" like below: |
Our cpptools server reacts to the LSP textDocument/references message (see https://microsoft.github.io/language-server-protocol/specification#textDocument_references ). You may be able to invoke that through the vscode.executeReferenceProvider command (see https://code.visualstudio.com/api/references/commands ), which should return the references results without invoking any UI. So additional user facing commands might not be necessary. |
OK,That is what I want. Thank you very much! |
Sean, I call vscode.executeReferenceProvider this command but return result is empty. it results from Cpptools hasn't inplement find all references? When you will finish this? |
Yeah, Find All References hasn't been shipped yet. I have it generally working, but I need to fix some crashes and other bugs, possible performance fixes, more test work, etc.. So as soon as we think it's in a usable state we plan to release a special 0.25.0-exploration release, maybe around July 29th? |
OK,in addition could you add this function which provides to view class inheritance? You can add two commands, one is for searching subclass and another is for searching parent class. it's possible for 0.25 version? |
Any sort of class inheritance info/viewing is unlikely to be available any time soon -- I don't think even Visual Studio has this available. Maybe you could parse the find all references result to check for references of classes that involve inheritance, but that would only work if the base class reference were on the same line as the sub class reference. |
VSCode has implemented 'go to implementation' from version 1.35. If I can get the implementation locations of symbol, I think it's ok. |
I moved Go to Implementation to #3941 . |
Hi Sean, I found currently results of "Find All References" includes many types: "Cannot confirm","Comment containing","Confirmed","Not a reference" and so on. Currently I call vscode.executeReferenceProvider and get "confirm" references results only. So could you add "getAllReferencesCommand" to return all references types and locations for me? |
Because VS Code and the LSP doesn't currently support "types" on references, we send back the non-confirmed references via the cpptools/references message instead of textDocument/references. Where would such a getAllReferencesCommand be called/executed from, i.e. where did you want us to export such a method? Are you able to modify/use the open source TypeScript code yourself to get the data and/or make a pull request with the change? |
I cloned the source code from master branch and run, it didn't work and errro occured:C/C++: "Install vsix -- Failed to download rate limit JSON". I have set a proxy on vscode. Maybe company safe strategy can't allow to access. |
Yeah, I think you would need to clone the master branch, but then copy over the binaries from the 0.25.0-insiders vsix, because the download link targets haven't been updated to the newer binaries yet. The "rate limit" message might not be important -- I believe that is just code that runs to try to get the Insiders vsix. |
Yeah, the menu would only appear if the right binary is used. The binaries are in the bin folder at the extension's installation folder, e.g. ~/.vscode/extensions/ms-vscode.cpptools-0.25.0-insiders/bin/Microsoft.VSCode.CPP.Extension.linux (and Microsoft.VSCode.CPP.IntelliSense.Msvc.linux). They need to be copied to the bin folder under the extension folder where you do the Launch Extension. But if an install.lock doesn't exist, you'll need to add that and that would mean you may be missing other OS-specific binaries related to the debugger (not sure if those are required for you). |
I have solved it, Thanks for your reply. |
@sean-mcmanus
when this feature is finished, I hope cpptools can support this commands: getReferencesCommand.
When I pass file uri, line and column as parameters of this command, it can return all references location to me regardless of this file is opened or not.
Could you add this feature to "Find all references" for me ?
Originally posted by @Lennon925 in #15 (comment)
The text was updated successfully, but these errors were encountered: