-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Simplify lsif generation concepts #65858
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b0d2746
Simplify lsif generation concepts
CyrusNajmabadi edea17f
Share code for folding
CyrusNajmabadi 7b7f434
Extract different features into helper methods
CyrusNajmabadi 0f4ff61
Move Hover onto Documents
CyrusNajmabadi 5915f19
Share more
CyrusNajmabadi bc76983
Cleanup
CyrusNajmabadi 9bddf8b
Update tests
CyrusNajmabadi 24a46c4
Remove comments
CyrusNajmabadi b947a42
Simplify
CyrusNajmabadi 510324d
Fix
CyrusNajmabadi 1622af7
Update src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandle…
CyrusNajmabadi c62b0a3
Update src/Features/Lsif/Generator/Generator.cs
CyrusNajmabadi a23ccd4
make into static class
CyrusNajmabadi f4fe235
Simplify
CyrusNajmabadi 0db1482
Rename
CyrusNajmabadi 12e92a4
pull up
CyrusNajmabadi 1d11efd
Reorder
CyrusNajmabadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,29 +18,16 @@ | |
|
||
namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator | ||
{ | ||
internal class CompilerInvocation | ||
internal static class CompilerInvocation | ||
{ | ||
public Compilation Compilation { get; } | ||
public LanguageServices LanguageServices { get; } | ||
public string ProjectFilePath { get; } | ||
public GeneratorOptions Options { get; } | ||
|
||
public CompilerInvocation(Compilation compilation, LanguageServices languageServices, string projectFilePath, GeneratorOptions options) | ||
{ | ||
Compilation = compilation; | ||
LanguageServices = languageServices; | ||
ProjectFilePath = projectFilePath; | ||
Options = options; | ||
} | ||
|
||
public static async Task<CompilerInvocation> CreateFromJsonAsync(string jsonContents) | ||
public static async Task<Project> CreateFromJsonAsync(string jsonContents) | ||
{ | ||
var invocationInfo = JsonConvert.DeserializeObject<CompilerInvocationInfo>(jsonContents); | ||
Assumes.Present(invocationInfo); | ||
return await CreateFromInvocationInfoAsync(invocationInfo); | ||
} | ||
|
||
public static async Task<CompilerInvocation> CreateFromInvocationInfoAsync(CompilerInvocationInfo invocationInfo) | ||
public static async Task<Project> CreateFromInvocationInfoAsync(CompilerInvocationInfo invocationInfo) | ||
jasonmalinowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
// We will use a Workspace to simplify the creation of the compilation, but will be careful not to return the Workspace instance from this class. | ||
// We will still provide the language services which are used by the generator itself, but we don't tie it to a Workspace object so we can | ||
|
@@ -113,10 +100,7 @@ public static async Task<CompilerInvocation> CreateFromInvocationInfoAsync(Compi | |
hostObjectType: null); | ||
|
||
var solution = workspace.CurrentSolution.AddProject(projectInfo); | ||
var compilation = await solution.GetRequiredProject(projectId).GetRequiredCompilationAsync(CancellationToken.None); | ||
var options = GeneratorOptions.Default; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that we always used GeneratorOptions.Default here. so the callers of this method just pas that along instead. |
||
|
||
return new CompilerInvocation(compilation, languageServices, invocationInfo.ProjectFilePath, options); | ||
return solution.GetRequiredProject(projectId); | ||
|
||
// Local methods: | ||
DocumentInfo CreateDocumentInfo(string unmappedPath) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if this can/should be renamed to something else but it's fine.