-
Notifications
You must be signed in to change notification settings - Fork 416
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
Add support for GoToDefinition on source-generated files #2170
Conversation
@filipw another go-to-def PR for you to review 😊. |
aeb26ae
to
da0f205
Compare
This adds a new response element to gotodefinition responses: SourceGeneratedFileInfo. This is similar to MetadataSource, except that unlike MetadataSource it's not tracked on a type/project basis, but rather as a document/project basis. Retrieving info about a source generated file can be done through the SourceGeneratedFileService endpoints: * SourceGeneratedFileInfo - Gets the file content of a source generated file. * UpdateSourceGeneratedFileInfo - Gets the updated content of a source generated file, if it has changed since the last time information was returned. * SourceGeneratedFileClosed - Sent to the server to inform it that the editor has closed the generated file and it can stop tracking Document version info for that file. Currently, the only way to get the info needed to open a source-generated file is via the gotodefinition endpoint. We'll want to add info to find-usages as well, but that's a job for another day. Contributes to OmniSharp#1934.
da0f205
to
7b44551
Compare
src/OmniSharp.Abstractions/Models/v1/GotoDefinition/GotoDefinitionResponse.cs
Outdated
Show resolved
Hide resolved
}; | ||
} | ||
|
||
public async Task<UpdateSourceGeneratedFileResponse> Handle(UpdateSourceGeneratedFileRequest request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when would the client call the update point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I've done it for vscode, when the buffer is shown.
src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs
Show resolved
Hide resolved
whoa! thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This adds a new response element to gotodefinition responses: SourceGeneratedFileInfo. This is similar to MetadataSource, except that unlike MetadataSource it's not tracked on a type/project basis, but rather as a document/project basis. Retrieving info about a source generated file can be done through the SourceGeneratedFileService endpoints:
Currently, the only way to get the info needed to open a source-generated file is via the gotodefinition endpoint. We'll want to add info to find-usages as well, but that's a job for another day. Contributes to #1934.