seblj / roslyn.nvim

Roslyn LSP plugin for neovim
MIT License
200 stars 23 forks source link

Server logs warnings and errors, unless rzls handlers are set up #77

Open kmoschcau opened 1 week ago

kmoschcau commented 1 week ago

When I run the newest server version (4.13.0-2.24554.8), I see the following warnings and errors in the LSP log:

[WARN][2024-11-05 10:34:02] ...m/lsp/client.lua:1016    "server_request: no handler found for"  "razor/provideDynamicFileInfo"
[ERROR][2024-11-05 10:34:02] ...lsp/handlers.lua:590    "[LanguageServerProjectSystem] Error while loading [REDACTED]_Backend.csproj: Exception thrown: StreamJsonRpc.RemoteMethodNotFoundException: MethodNotFound\r\n   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.RazorDynamicFileInfoProvider.GetDynamicFileInfoAsync(ProjectId projectId, String projectFilePath, String filePath, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/RazorDynamicFileInfoProvider.cs:line 70\r\n   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/TaskExtensions.cs:line 56\r\n   at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.AddDynamicSourceFile(String dynamicFilePath, ImmutableArray`1 folders) in /_/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 909\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.<>c__DisplayClass18_0.<UpdateWithNewProjectInfoAsync>g__UpdateProjectSystemProjectCollection|17[T](IEnumerable`1 loadedCollection, IEnumerable`1 oldLoadedCollection, IEqualityComparer`1 comparer, Action`1 addItem, Action`1 removeItem, String logMessage) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 261\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, ILogger logger) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 214\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, ILogger logger) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 242\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, ToastErrorReporter toastErrorReporter, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 284"
[WARN][2024-11-05 10:34:02] ...m/lsp/client.lua:1016    "server_request: no handler found for"  "razor/provideDynamicFileInfo"
[ERROR][2024-11-05 10:34:02] ...lsp/handlers.lua:590    "[LanguageServerProjectSystem] Error while loading [REDACTED].csproj: Exception thrown: StreamJsonRpc.RemoteMethodNotFoundException: MethodNotFound\r\n   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.RazorDynamicFileInfoProvider.GetDynamicFileInfoAsync(ProjectId projectId, String projectFilePath, String filePath, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/RazorDynamicFileInfoProvider.cs:line 70\r\n   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/TaskExtensions.cs:line 56\r\n   at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.AddDynamicSourceFile(String dynamicFilePath, ImmutableArray`1 folders) in /_/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 909\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.<>c__DisplayClass18_0.<UpdateWithNewProjectInfoAsync>g__UpdateProjectSystemProjectCollection|17[T](IEnumerable`1 loadedCollection, IEnumerable`1 oldLoadedCollection, IEqualityComparer`1 comparer, Action`1 addItem, Action`1 removeItem, String logMessage) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 261\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, ILogger logger) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 214\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, ILogger logger) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 242\r\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, ToastErrorReporter toastErrorReporter, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 284"

These are not logged, when handlers = require('rzls.roslyn_handlers') is provided in the roslyn setup.

seblj commented 5 days ago

Is this a razor project? I just tried the newest version of the server on a web app, and no such warnings and errors.

I am not supporting razor directly in this plugin, so you should use that plugin together with this if you need razor support

kmoschcau commented 3 days ago

Hi, yes that is a razor project. I also just tested whether this happens with a newly generated WPF project and it does not. I mostly opened this issue so that you are aware of it, because it looked like an error that could be handled in the plugin. I know that this project does not handle razor templates. But maybe you could handle this error and recommend users to install rzls.nvim for example.

seblj commented 3 days ago

Ahh good idea. I will implement the handlers and just notify users to use the razor plugin