jmederosalvarado / roslyn.nvim

Roslyn LSP plugin for neovim
MIT License
203 stars 38 forks source link

CSInstallRoslyn throws Error for vim.fs.joinpath() #1

Closed tilupe closed 11 months ago

tilupe commented 11 months ago

OS: Linux
NVIM v0.9.4 Build type: Release LuaJIT 2.1.1692716794

When running CSInstallRoslyn I get the following error:

Error 03:09:09 PM msg_show.lua_error CSInstallRoslyn Error executing Lua callback: ...local/share/nvim/lazy/roslyn.nvim/lua/roslyn/install.lua:41: attempt to call field 'joinpath' (a nil value)

The code there is local server_path = vim.fs.joinpath(vim.fn.stdpath("data"), "roslyn") but it seems there is no "joinpath".

There are several other joinpath calls in the install file

Additionally is the function vim.uv.os_uname() called. According to the help pages this should be vim.loop.os_uname()?

And there is a call to vim.system which gives me:

Error 03:32:37 PM msg_show.lua_error CSInstallRoslyn Error executing Lua callback: ...local/share/nvim/lazy/roslyn.nvim/lua/roslyn/install.lua:70: attempt to call field 'system' (a nil value)

Are these functions from nightly?

jmederosalvarado commented 11 months ago

hmm, it might be, I use nightly neovim

tilupe commented 11 months ago

Yes nightly helps. But when I install it now I get

Error 04:19:43 PM notify.error Roslyn Failed to restore Roslyn package: { code = 1, signal = 0, stderr = "" }

I guess it has to do with

local waited = vim.system({
    dotnet_cmd,
    "restore",
    download_path,
    "/p:PackageName=" .. roslyn_pkg_name,
    "/p:PackageVersion=" .. roslyn_pkg_version,
}, { stdout = false }, function(obj)
    if obj.code ~= 0 then
        vim.notify(
            "Failed to restore Roslyn package: " .. vim.inspect(obj),
            vim.log.levels.ERROR,
            { title = "Roslyn" }
        )
    end
end):wait()

Thoe "/p:PackageName=" look like windows syntax to me. Did you try it on linux already?

jmederosalvarado commented 11 months ago

I use it on macos, the /p:PackageName= is the way dotnet handles msbuild args in any plattform. I'll look into it

jmederosalvarado commented 11 months ago

The error happened because of incorrect transaction from uname info to package identifier. should be fixed now

tilupe commented 11 months ago

Thank you for this super fast responses the installation worked now. Maybe you could include nightly-dependency in the ReadMem, so others won't run into it. The language-server is now attached for me but I throws errors. But this issue is resolved for me at least.

Does this log tell you anything? Maybe I will be able to debug it anothertime.

[START][2023-10-17 21:11:11] LSP logging initiated [WARN][2023-10-17 21:11:11] ...lsp/handlers.lua:559 "[Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching.DelegatingFileChangeWatcher] We are unable to use LSP file watching; falling back to our in-process watcher." [ERROR][2023-10-17 21:11:11] ...lsp/handlers.lua:557 "[LanguageServerProjectSystem] Exception thrown while loading /path/to/csproj/XYZ.csproj System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.\n at System.IO.FileSystemWatcher.StartRaisingEvents()\n at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching.SimpleFileChangeWatcher.FileChangeContext.IndividualWatchedFile..ctor(String filePath, FileChangeContext context) in //src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/SimpleFileChangeWatcher.cs:line 117\n at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching.SimpleFileChangeWatcher.FileChangeContext.EnqueueWatchingFile(String filePath) in //src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/SimpleFileChangeWatcher.cs:line 78\n at Microsoft.CodeAnalysis.ProjectSystem.FileWatchedPortableExecutableReferenceFactory.CreateReferenceAndStartWatchingFile(String fullFilePath, MetadataReferenceProperties properties) in /_/src/Workspaces/Core/Portable/Workspace/ProjectSystem/FileWatchedPortableExecutableReferenceFactory.cs:line 100\n at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.<>cDisplayClass102_0.b_0(SolutionChangeAccumulator solutionChanges) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 602\n at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProjectFactory.<>cDisplayClass46_0.b_0(Solution oldSolution) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs:line 262\n at Microsoft.CodeAnalysis.Workspace.<>c.b__273(Solution oldSolution, ValueTuple`5 data) in //src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 249\n at Microsoft.CodeAnalysis.Workspace.SetCurrentSolutionAsync[TData](Boolean useAsync, TData data, Func3 transformation, Boolean mayRaiseEvents, Action3 onBeforeUpdate, Action3 onAfterUpdate, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 408\n at Microsoft.CodeAnalysis.Workspace.SetCurrentSolutionAsync(Boolean useAsync, Func2 transformation, Func3 changeKind, Action2 onBeforeUpdate, Action2 onAfterUpdate, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 244\n at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProjectFactory.ApplyBatchChangeToWorkspaceMaybeAsync(Boolean useAsync, Action1 mutation) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs:line 257\n at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.OnBatchScopeDisposedMaybeAsync(Boolean useAsync) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 520\n at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.BatchScope.DisposeAsync() in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 493\n at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo) in //src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 149\n at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, BuildHostProcessManager buildHostProcessManager, BuildHost inProcessBuildHost, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 312"

jmederosalvarado commented 11 months ago

That's related to the file watcher limit in your system. It's not related to this plugin or roslyn at all. Neovim nightly introduces support for didChangeWatchedFiles. Neovim uses system file watchers to let the server know whenever a file changes. You can either disable this capability by doing:

capabilities = vim.tbl_deep_extend("force", capabilities, {
    workspace = {
        didChangeWatchedFiles = {
            dynamicRegistration = false,
        },
    },
})

before setting up the plugin. Or you can increase the filesystem watchers limit (you should be able to find out how to do this very quickly with a google search).

Read this issue if you want to learn more about this in neovim.

lawrence-laz commented 11 months ago

Probably would be good to mention in readme.md, that this requires nvim nightly.

Thanks for the plugin!