Skip to content

Add source generator support to the LSIF indexer#49306

Merged
jasonmalinowski merged 3 commits intodotnet:masterfrom
jasonmalinowski:source-generator-support-in-lsif
Nov 13, 2020
Merged

Add source generator support to the LSIF indexer#49306
jasonmalinowski merged 3 commits intodotnet:masterfrom
jasonmalinowski:source-generator-support-in-lsif

Conversation

@jasonmalinowski
Copy link
Member

@jasonmalinowski jasonmalinowski commented Nov 12, 2020

This adds support for running generators when the LSIF tool is invoked, and writes out contents for the generated files so further tools can process them.

The "interesting" bit of this PR is actually refactoring out a test source generator we had into a project of it's own. The compiler now requires that the assembly that contains the generator not be targeting the .NET Framework; since we have test projects that are currently targeting .NET Framework we can't put the generator in the unit test projects; even if we retarget the test projects we may still want to test on .NET Framework hosts since that's where our code is actually running in some scenarios. Right now the compiler has a similar need for such a project, so hopefully we'll move it further down and use it for that too. (FYI to @chsienki on this bit.)

We now require that source generators must live in a netstandard2.0
project, and our various test projects (both unit tests and integration
tests) don't always target that. To keep things simple, we'll have a
single project that provides some trivial source generators so we can
test loading them in all platforms.
@jasonmalinowski jasonmalinowski self-assigned this Nov 12, 2020
@runfoapp runfoapp bot mentioned this pull request Nov 12, 2020
@jasonmalinowski jasonmalinowski force-pushed the source-generator-support-in-lsif branch from b08aed4 to 89d1804 Compare November 12, 2020 19:45
@jasonmalinowski jasonmalinowski force-pushed the source-generator-support-in-lsif branch from 89d1804 to 9a91ebd Compare November 12, 2020 19:52
@jasonmalinowski jasonmalinowski marked this pull request as ready for review November 12, 2020 19:58
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner November 12, 2020 19:58
{
var text = semanticModel.SyntaxTree.GetText();

// We always use UTF-8 encoding when writing out file contents, as that's expected by LSIF implementations.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from talking with @BertanAygun, although I'm asking for further spec clarification in microsoft/language-server-protocol#1139.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current answer at least is this is correct, so if that changes we'll come back and fix it.

@jasonmalinowski jasonmalinowski merged commit d980ea5 into dotnet:master Nov 13, 2020
@ghost ghost added this to the Next milestone Nov 13, 2020
@jasonmalinowski jasonmalinowski deleted the source-generator-support-in-lsif branch November 13, 2020 18:56
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants