Add references codelens support#933
Conversation
|
@theSoenke, |
ramya-rao-a
left a comment
There was a problem hiding this comment.
Your code at present has linting errors which is breaking the build. Run npm run lint and you can see the list of errors.
For the guru errors you are seeing, see #726 (comment)
src/goCodelens.ts
Outdated
| includeDeclaration: false | ||
| }; | ||
| let position = symbol.location.range.start; | ||
| if (symbol.kind === vscode.SymbolKind.Function) { |
There was a problem hiding this comment.
Can you add a comment here as to why 5 is being added? Helps the next person reading this code :)
src/goReferences.ts
Outdated
| } | ||
|
|
||
| private doFindReferences(document: vscode.TextDocument, position: vscode.Position, options: { includeDeclaration: boolean }, token: vscode.CancellationToken): Thenable<vscode.Location[]> { | ||
| public doFindReferences(document: vscode.TextDocument, position: vscode.Position, options: { includeDeclaration: boolean }, token: vscode.CancellationToken): Thenable<vscode.Location[]> { |
There was a problem hiding this comment.
I am guessing the reason you are using doFindReferences instead of provideReferences is because the latter does a saveAll before finding the references.
My another guess for why saveAll was put in place was because guru was made to run on saved files.
Now that we have guru working on unsaved files as well (with the -modified flag), lets remove the saveAll that happens in provideReferences and you can use it here.
There was a problem hiding this comment.
Yes, saveAll was the reason for that. Removed saveAll and set provideReferences back to private
|
For the slowness issue, have you considered using resolveCodeLens ? |
|
Looks like resolveCodeLens could make a lot sense here. I will look into it. |
|
@theSoenke I have merged the PR, but please continue looking at the |
|
@ramya-rao-a Great! I've submitted a PR to use |
This PR adds support for reference codelenses as discussed in #726
There are still a few issues: