Open hutterm opened 11 months ago
I would appreciate if you could provide a sample project (.cs
and .csproj
files) to quickly reproduce and try to fix this.
here is a sample project. go to definition on the Prop
fails
SourceGenTest.zip
Edit: Likely related from upstream: https://github.com/dotnet/vscode-csharp/issues/6426
I think this issue is keeping me from searching for workspace symbols using telescope in a project that uses source generators, meaning I would need to search for files instead.
I think a band-aid fix for now would be for this to ignore invalid URIs if possible, that would at least allow searching for non-generated symbols.
I'd be interested in fixing this, as otherwise this client is a lot better than omnisharp, but I have no idea how.
Example from a godot project:
[telescope] [WARN 10:07:55] /nix/store/piv98rgghcipdc380qambds2ks335v5k-vim-pack-dir/pack/myNeovimPackages/start/telescope.nvim/lua/telescope/pickers.lua:661: Finder failed with msg: {
[telescope] code = -32000,
[telescope] data = {
[telescope] code = -2146233033,
[telescope] inner = {
[telescope] code = -2146233033,
[telescope] message = "Invalid URI: The format of the URI could not be determined.",
[telescope] stack = " at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)\n at System.Uri..ctor(String uriString, UriKind uriKind)\n at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.CreateAbsoluteUri(String absolutePath) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 180",
[telescope] type = "System.UriFormatException"
[telescope] },
[telescope] message = "Failed create URI from 'Godot.SourceGenerators/Godot.SourceGenerators.ScriptPropertyDefValGenerator/Schnozzle.PaletteSwap.PaletteSwapLoaderSingleton_ScriptPropertyDefVal.generated.cs'; original string: 'Godot.SourceGenerators/Godot.SourceGenerators.ScriptPropertyDefValGenerator/Schnozzle.PaletteSwap.PaletteSwapLoaderSingleton_ScriptPropertyDefVal.generated.cs'",
[telescope] stack = " at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.CreateAbsoluteUri(String absolutePath) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 188\n at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.<TextSpanToLocationAsync>g__ConvertTextSpanToLocationAsync|32_0(Document document, TextSpan span, Boolean isStale, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 479\n at Microsoft.CodeAnalysis.LanguageServer.ProtocolConversions.TextSpanToLocationAsync(Document document, TextSpan textSpan, Boolean isStale, Nullable`1 context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs:line 444\n at Microsoft.CodeAnalysis.LanguageServer.Handler.WorkspaceSymbolsHandler.LSPNavigateToCallback.AddItemAsync(Project project, INavigateToSearchResult result, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs:line 90\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.<>c__DisplayClass13_0.<<GetOnItemFoundCallback>b__0>d.MoveNext() in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.cs:line 46\n--- End of stack trace from previous location ---\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.AddResultIfMatchAsync(DocumentKey documentKey, Document document, DeclaredSymbolInfo declaredSymbolInfo, PatternMatcher nameMatcher, PatternMatcher containerMatcher, DeclaredSymbolInfoKindSet kinds, Func`2 onResultFound, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.InProcess.cs:line 175\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.ProcessIndexAsync(DocumentKey documentKey, Document document, String patternName, String patternContainer, DeclaredSymbolInfoKindSet kinds, Func`2 onResultFound, TopLevelSyntaxTreeIndex index, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.InProcess.cs:line 136\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.ProcessDocumentAsync(Document document, String patternName, String patternContainer, DeclaredSymbolInfoKindSet kinds, Func`2 onResultFound, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.InProcess.cs:line 109\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.ProcessDocumentsAsync(Document searchDocument, String patternName, String patternContainer, DeclaredSymbolInfoKindSet kinds, Func`2 onItemFound, HashSet`1 documents, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.InProcess.cs:line 95\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.SearchGeneratedDocumentsInCurrentProcessAsync(ImmutableArray`1 projects, String pattern, IImmutableSet`1 kinds, Func`2 onItemFound, Func`1 onProjectCompleted, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.GeneratedDocumentSearch.cs:line 75\n at Microsoft.CodeAnalysis.NavigateTo.AbstractNavigateToSearchService.SearchGeneratedDocumentsAsync(Solution solution, ImmutableArray`1 projects, String searchPattern, IImmutableSet`1 kinds, Document activeDocument, Func`3 onResultFound, Func`1 onProjectCompleted, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.GeneratedDocumentSearch.cs:line 51\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.<>c__DisplayClass24_0.<<SearchGeneratedDocumentsAsync>b__1>d.MoveNext() in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 458\n--- End of stack trace from previous location ---\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.<>c__DisplayClass21_0.<<ProcessOrderedProjectsAsync>g__SearchCoreAsync|0>d.MoveNext() in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 352\n--- End of stack trace from previous location ---\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.ProcessOrderedProjectsAsync(Boolean parallel, ImmutableArray`1 orderedProjects, HashSet`1 seenItems, Func`5 processProjectAsync, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 335\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.SearchAllProjectsAsync(Boolean isFullyLoaded, NavigateToSearchScope scope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 212\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.SearchAsync(Boolean searchCurrentDocument, NavigateToSearchScope scope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 152\n at Microsoft.CodeAnalysis.NavigateTo.NavigateToSearcher.SearchAsync(Boolean searchCurrentDocument, NavigateToSearchScope scope, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs:line 162\n at Microsoft.CodeAnalysis.LanguageServer.Handler.WorkspaceSymbolsHandler.HandleRequestAsync(WorkspaceSymbolParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/Symbols/WorkspaceSymbolsHandler.cs:line 69\n at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken)\n at Microsoft.CommonLanguageServerProtocol.Framework.AbstractLanguageServer`1.DelegatingEntryPoint.EntryPointAsync[TRequest,TResponse](TRequest request, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs:line 195",
[telescope] type = "System.UriFormatException"
[telescope] },
[telescope] message = "Failed create URI from 'Godot.SourceGenerators/Godot.SourceGenerators.ScriptPropertyDefValGenerator/Schnozzle.PaletteSwap.PaletteSwapLoaderSingleton_ScriptPropertyDefVal.generated.cs'; original string: 'Godot.SourceGenerators/Godot.SourceGenerators.ScriptPropertyDefValGenerator/Schnozzle.PaletteSwap.PaletteSwapLoaderSingleton_ScriptPropertyDefVal.generated.cs'",
[telescope] <metatable> = {
[telescope] __tostring = <function 1>
[telescope] }
[telescope] }
I've updated my version to 4.10.0-1.24058.1, which is the version currently tracked by the vs-code plugin. This fixes the issue with workspace symbols throwing an error in telescope for me, but the resulting file is empty.
Attempting to navigate to implementations on a partial type with source generated implementations still throws the following error:
Error executing vim.schedule lua callback: ...myNeovimPackages/start/trouble.nvim/lua/trouble/util.lua:158: ENOENT: no such file or directory: source-generated:///Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/Schnozzle.Logging.Logger_ScriptMethods.generated.cs
Edit: Annoyingly, this still fails if you use a goto_reference
on something that has a source generated member...
I'd be curious if this will work for something like CommunityToolkit.MVVM too. I'd love to use this plugin for MAUI development
in a project using a source generator I find that a go to definition results in
similar with a find references:
is there any way to support this?
tried updating to
opts.roslyn_version = "4.9.0-2.23563.2"
but that alone doesn't do it