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 new endpoint in roslyn to get token for multiple ranges #69946

Merged
merged 22 commits into from
Sep 20, 2023

Conversation

maryamariyan
Copy link
Member

Contributes to: dotnet/razor#9273

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 14, 2023
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Sep 14, 2023
@maryamariyan
Copy link
Member Author

maryamariyan commented Sep 14, 2023

  • Figured out why new tests are failing because the new endpoint cannot be found:
    ---> UPDATED: was missing the ExportCSharpVisualBasicStatelessLspService attribute on the new handler
 Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens.SemanticTokensRangesTests.TestGetSemanticTokensRanges_FullDocAsync(mutatingLspWorkspace: False, isVS: True)​
174ms
Error:
StreamJsonRpc.RemoteMethodNotFoundException : No method by the name 'textDocument/semanticTokens/ranges' is found.

Stack trace:
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__151`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Roslyn.Test.Utilities.AbstractLanguageServerProtocolTests.TestLspServer.<ExecuteRequestAsync>d__13`2.MoveNext() in C:\CodeHub\roslyn\src\EditorFeatures\TestUtilities\LanguageServer\AbstractLanguageServerProtocolTests.cs:line 640
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens.AbstractSemanticTokensTests.<RunGetSemanticTokensAsync>d__2.MoveNext() in C:\CodeHub\roslyn\src\Features\LanguageServer\ProtocolUnitTests\SemanticTokens\AbstractSemanticTokensTests.cs:line 45
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens.SemanticTokensRangesTests.<TestGetSemanticTokensRanges_FullDocAsync>d__1.MoveNext() in C:\CodeHub\roslyn\src\Features\LanguageServer\ProtocolUnitTests\SemanticTokens\SemanticTokensRangesTests.cs:line 37
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.CodeAnalysis.LanguageServer.UnitTests.SemanticTokens.SemanticTokensRangesTests.<TestGetSemanticTokensRanges_FullDocAsync>d__1.MoveNext() in C:\CodeHub\roslyn\src\Features\LanguageServer\ProtocolUnitTests\SemanticTokens\SemanticTokensRangesTests.cs:line 69
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

@maryamariyan maryamariyan marked this pull request as ready for review September 14, 2023 08:20
@maryamariyan maryamariyan requested a review from a team as a code owner September 14, 2023 08:20
@maryamariyan
Copy link
Member Author

maryamariyan commented Sep 15, 2023

  • I found 4 test failures related to CompositionFailedException, haven't troubleshooted them yet. Here's a stacktrace:

  Message: 
Microsoft.VisualStudio.Composition.CompositionFailedException : Errors exist in the composition.

  Stack Trace: 
CompositionConfiguration.ThrowOnErrors()
ExportProviderBuilder.ThrowOnUnexpectedErrors(CompositionConfiguration configuration, ILogger logger) line 98
ExportProviderBuilder.CreateExportProviderAsync(IEnumerable`1 extensionAssemblyPaths, String sharedDependenciesPath, ILoggerFactory loggerFactory) line 67
TestLspServer.CreateAsync(ClientCapabilities clientCapabilities, TestOutputLogger logger, Boolean includeDevKitComponents) line 37
LspFileChangeWatcherTests.LspFileWatcherSupportedWithClientSupport() line 43
--- End of stack trace from previous location ---

  Standard Output: 
[07:34:26.314][Error]Encountered errors in the MEF composition:
----- CompositionError level 1 ------
Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.Razor.SemanticTokensRangesHandler.ctor(semanticTokensRefreshQueue): expected exactly 1 export matching constraints:
    Contract name: Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRefreshQueue
    TypeIdentityName: Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens.SemanticTokensRefreshQueue
but found 0.
   part definition Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.Razor.SemanticTokensRangesHandler

Microsoft.CodeAnalysis.ExternalAccess.Pythia.PythiaSignatureHelpProvider.ctor(implementation): expected exactly 1 export matching constraints:
    Contract name: Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api.IPythiaSignatureHelpProviderImplementation
    TypeIdentityName: Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api.IPythiaSignatureHelpProviderImplementation
but found 0.
   part definition Microsoft.CodeAnalysis.ExternalAccess.Pythia.PythiaSignatureHelpProvider

@ToddGrun
Copy link
Contributor

ToddGrun commented Sep 15, 2023

        return updatedClassifiedSpans.ToArray();

Ugh, I think we can get by without this allocation too. #Closed


Refers to: src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs:119 in 013612c. [](commit_id = 013612c, deletion_comment = False)

Since queue is not a service that mef can import in a standard way
(using custom endpoint for now)

- Unit test fix:
(Endpoint should implement ILspServiceDocumentRequestHandler not ILspServiceRequestHandler)
Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@ToddGrun ToddGrun enabled auto-merge (squash) September 19, 2023 23:36
@ToddGrun ToddGrun merged commit 1421a4a into dotnet:main Sep 20, 2023
24 checks passed
@ghost ghost added this to the Next milestone Sep 20, 2023
@maryamariyan maryamariyan deleted the dev/maryamariyan/ranges-endpoint branch September 20, 2023 13:04
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants