Skip to content
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

Closed
sean-mcmanus opened this issue Jul 6, 2019 · 16 comments
Closed

getReferencesCommand #3886

sean-mcmanus opened this issue Jul 6, 2019 · 16 comments
Labels
Feature: Find All References Find All References, Peek References, Rename Feature Request fixed Check the Milestone for the release in which the fix is or will be available. help wanted Can be fixed in the public (open source) repo. Language Service
Milestone

Comments

@sean-mcmanus
Copy link
Contributor

@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)

@sean-mcmanus
Copy link
Contributor Author

@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.

@sean-mcmanus sean-mcmanus added Feature Request Language Service more info needed The issue report is not actionable in its current state labels Jul 6, 2019
@Lennon925
Copy link

Lennon925 commented Jul 8, 2019

@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:
123

@sean-mcmanus
Copy link
Contributor Author

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.

@sean-mcmanus sean-mcmanus removed the more info needed The issue report is not actionable in its current state label Jul 8, 2019
@sean-mcmanus sean-mcmanus added this to the August 2019 milestone Jul 8, 2019
@Lennon925
Copy link

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!

@Lennon925
Copy link

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.

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?

@sean-mcmanus
Copy link
Contributor Author

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?

@Lennon925
Copy link

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?

@sean-mcmanus
Copy link
Contributor Author

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.

@Lennon925
Copy link

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.

@sean-mcmanus
Copy link
Contributor Author

I moved Go to Implementation to #3941 .

@Lennon925
Copy link

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?

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?

@sean-mcmanus
Copy link
Contributor Author

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?

@sean-mcmanus sean-mcmanus added Feature: Find All References Find All References, Peek References, Rename help wanted Can be fixed in the public (open source) repo. more info needed The issue report is not actionable in its current state labels Aug 9, 2019
@Lennon925
Copy link

Lennon925 commented Aug 12, 2019

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.
And then I cloned from "git clone -b release https://github.com/Microsoft/vscode-cpptools" and found it doesn't contain "find references" this feature.

Maybe company safe strategy can't allow to access.

@sean-mcmanus
Copy link
Contributor Author

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.

@sean-mcmanus
Copy link
Contributor Author

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).

@Lennon925
Copy link

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 sean-mcmanus added fixed Check the Milestone for the release in which the fix is or will be available. and removed more info needed The issue report is not actionable in its current state labels Aug 20, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: Find All References Find All References, Peek References, Rename Feature Request fixed Check the Milestone for the release in which the fix is or will be available. help wanted Can be fixed in the public (open source) repo. Language Service
Projects
None yet
Development

No branches or pull requests

2 participants