-
Notifications
You must be signed in to change notification settings - Fork 198
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
Use Roslyn LSP library instead of Visual Studio #10682
base: main
Are you sure you want to change the base?
Conversation
I'm assuming the Vs versions of these are more complete than the Roslyn ones
This commit done entirely via Replace In Files
This is to make things easier in future, as we'll be getting a global using for all protocol types
Not a mechanical commit, but my word is it doing a good job cosplaying as one
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/DelegatedTypes.cs
Outdated
Show resolved
Hide resolved
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.VisualStudio.LanguageServer.Protocol; | ||
using AliasedVSCommitCharacters = Microsoft.VisualStudio.LanguageServer.Protocol.SumType<string[], Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalCommitCharacter[]>; | ||
using AliasedVSCommitCharacters = RLSP::Roslyn.LanguageServer.Protocol.SumType<string[], RLSP::Roslyn.LanguageServer.Protocol.VSInternalCommitCharacter[]>; |
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.
Is it possible to add a special namespace alias in GlobalUsings.cs to avoid needing the RLSP extern alias? I'm imagining that global using RoslynLsp = RSLP::Roslyn.LanguageServer.Protocol
could be declared in GlobalUsings.cs and then you can write using AliasedVSCommitCharacters = RoslynLsp.SumType<string[], RoslynLsp.VSInternalCommitCharacter[]>;
Note: I suspect that might not be possible, but I wanted to check. 😄
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.
Cyrus suggested a similar thing originally, and I tried to just have global using Roslyn = RLSP::Roslyn;
, so that we wouldn't need a global using and also not need extern alias
in every .cs file, but sadly it doesn't work in using
directives. Not the first time the "alias any type" feature has not lived up to its name 😛
It does work outside of using directives, but there are exactly 0 use cases of that in this PR.
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.
Yeah, I suspected that might not work. It's not a common scenario, and I imagine it might even have enough nuance to elevate it to a separate feature. The way that "global using" directives were implemented is that it's as if all global usings are pasted at the top of the user's file. They don't create a new scope, which would probably be necessary for this to work.
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.
Love this change! Looking forward to seeing it merged once all the dependencies are updated.
Hey @davidwengier, any word on Web Tools? I'm still excited to see this go in someday. 😄 |
@vzarytovskii is web tools moving to STJ still scheduled for this sprint? Or did I miss it and it's already gone in? |
@abonie is working on it currently |
# Conflicts: # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/IDocumentColorService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingOptionsExtensions.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingResult.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs # src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LspExtensions_SyntaxNode.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LspFactory.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_SourceText.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspFactory.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/VersionedDocumentContext.cs # src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/SemanticTokens/ProvideSemanticTokensRangesParams.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorBreakpointResolver.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostSignatureHelpEndpoint.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPBreakpointSpanProvider.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPProximityExpressionsProvider.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorBreakpointResolver.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorProximityExpressionResolver.cs # src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentTextPresentationEndpointTests.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.TestLanguageServer.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs # src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs # src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs # src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs
Needs dotnet/roslyn#74597 before this will compile, and needs Web Tools work to be done and inserted before it can be tested, so this isn't going anywhere soon, but I thought I'd put it up a bit early because:
a) I'm keen if anyone has any issues with the global using approach? I'm just trying to avoid
extern alias
in every .cs fileb) This will need lots more commits to keep up with changes in main, so right now is the neatest this will ever be, and hence the easiest to review.
Reviewing commit-at-a-time is thoroughly recommended, as each commit is a standalone change, and the initial few are mostly mechanical.
TODO:
TODO in subsequent PRs due to complexity/desire for manual testing