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

Add support for GoToDefinition on source-generated files #2170

Merged
merged 3 commits into from Jun 2, 2021

Conversation

@333fred
Copy link
Contributor

@333fred 333fred commented Jun 1, 2021

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 #1934.

@333fred
Copy link
Contributor Author

@333fred 333fred commented Jun 1, 2021

@filipw another go-to-def PR for you to review 😊.

@333fred 333fred force-pushed the source-generator-gotodef branch from aeb26ae to da0f205 Jun 1, 2021
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.
@333fred 333fred force-pushed the source-generator-gotodef branch from da0f205 to 7b44551 Jun 1, 2021
};
}

public async Task<UpdateSourceGeneratedFileResponse> Handle(UpdateSourceGeneratedFileRequest request)
Copy link
Member

@filipw filipw Jun 1, 2021

when would the client call the update point?

Copy link
Contributor Author

@333fred 333fred Jun 1, 2021

The way I've done it for vscode, when the buffer is shown.

@filipw
Copy link
Member

@filipw filipw commented Jun 1, 2021

whoa! thank you!

filipw
filipw approved these changes Jun 2, 2021
Copy link
Member

@filipw filipw left a comment

LGTM!

@filipw filipw merged commit 65bb630 into OmniSharp:master Jun 2, 2021
16 checks passed
@333fred 333fred deleted the source-generator-gotodef branch Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants