Skip to content

Add outlining support to LsifGenerator#49197

Merged
10 commits merged intodotnet:masterfrom
mavasani:LsifFolding
Nov 18, 2020
Merged

Add outlining support to LsifGenerator#49197
10 commits merged intodotnet:masterfrom
mavasani:LsifFolding

Conversation

@mavasani
Copy link
Contributor

@mavasani mavasani commented Nov 5, 2020

No description provided.

@mavasani mavasani added this to the 16.9 milestone Nov 5, 2020
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Existing code moved here.

""id"": 7,
""type"": ""edge"",
""label"": ""textDocument/foldingRange""
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mavasani mavasani marked this pull request as ready for review November 6, 2020 00:38
@mavasani mavasani requested a review from a team as a code owner November 6, 2020 00:38
/// </remarks>
private static Id<Graph.LsifDocument> GenerateForDocument(
SemanticModel semanticModel,
private static async Task<Id<Graph.LsifDocument>> GenerateForDocumentAsync(
Copy link
Member

Choose a reason for hiding this comment

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

(note other comments about intentional lack of async and workspace types here...)

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

So this generally looks good other than the use of Project/Document and async in the generator. That goes in the opposite direction of what I was trying to do to allow this to also run as an analyzer, down the road. @CyrusNajmabadi did you make further progress on that or have some preferences?

@mavasani mavasani marked this pull request as draft November 8, 2020 15:28
mavasani added a commit to mavasani/roslyn that referenced this pull request Nov 10, 2020
This change refactors and moves the BlockStructure service and providers to the shared Workspace utilities layer. The core APIs are now based off SyntaxTree instead of Document to allow the service to be used from an analyzer context, which is required for dotnet#49197.
@mavasani mavasani marked this pull request as ready for review November 14, 2020 01:06
@mavasani
Copy link
Contributor Author

@jasonmalinowski @CyrusNajmabadi this is ready for review now, with much smaller set of changes to review.

return GetFoldingRanges(blockStructure, text);
}

public static FoldingRange[] GetFoldingRanges(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is called by LSIF generator.

lsifJsonWriter.Write(new Event(Event.EventKind.End, documentVertex.GetId(), idFactory));

// Write the folding ranges for the document.
var foldingRanges = FoldingRangesHandler.GetFoldingRanges(syntaxTree, languageServices, options, isMetadataAsSource: false, CancellationToken.None);
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, we're passing in an OptionSet to this -- which folding range providers used options in some way?

This code is fine -- what else are you going to do? -- but it's an interesting thing to think about both from the LSIF perspective but also LSP perspective of whether we need to compute things and include extra information that lets the consumer/client know how to interpret it given user options at that point in time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jasonmalinowski I know that the block structure service itself is using these options: https://github.com/dotnet/roslyn/blob/master/src/Features/Core/Portable/Structure/BlockStructureOptions.cs. I did not check specific options used by the providers.

@jasonmalinowski
Copy link
Member

:shipit:

@ghost
Copy link

ghost commented Nov 17, 2020

Hello @mavasani!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

@ghost ghost merged commit d73ccbb into dotnet:master Nov 18, 2020
@ghost ghost modified the milestones: 16.9, Next Nov 18, 2020
@mavasani mavasani deleted the LsifFolding branch November 18, 2020 01:44
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants