-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ALS fails after jumping into library with multiple or zero gpr files #1683
Comments
To clarify, I did not close the PR. You edited documentation files manually which triggered the github action which closes PRs that don't comply with our PR guidelines.
This also incorrectly sends the filesystem root as workspaceFolders to ALS, and is not cross-platform compatible. |
Okay, apologies for the misunderstanding. However, I did not edit any documentation files; when I submitted the PR a commit was automatically added on top which edited documentation to match what I had changed in als.vim. The only edit I did was to set the root dir to / and to display the active gpr file. I will review the PR guidelines for next time. Do you have any other idea how to change the als configuration to never automatically start a new ALS instance? Sending '/' is a real hack of course. Perhaps I can modify lua/lspconfig/configs.lua line 102 to ask the config for |
That's because you developed on master, we explicitly request developing on feature branches here: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#pull-requests-prs. If you develop on master, it will run the docgen action on your master branch.
If you are proposing special-casing ALS in configs.lua, then no.
I think it's extremely difficult to solve correctly without project local configuration. I would suggest bypassing lspconfig, and using start_client directly for your usecase. |
I am not proposing special-casing ALS in configs.lua. After adding an option for this, any language server will be able to set reuse_existing_server to true to get this behaviour of not starting new language servers. I never suggested adding code like You keep saying 'do this in your config' or 'for your usecase' but I am just trying to fix the als configuration for everyone. Look at the reproduction steps; this is one of the first things someone will do who (attempts to) use als in neovim using lspconfig - it is not at all specific to any project of mine. |
That's because you keep suggesting fixes/changes to lspconfig that seem extremely overfit to ALS/your particular situation (such as proposing a PR which would effectively break ALS support on Windows). I would rather solve the general case elegantly than bolt something on to lspconfig to address your immediate problem. Here are some concrete suggestions:
|
The first sounds like a good approach. System libraries are installed in whatever the user has in the However, I'm not sure what you mean by 'special case the root pattern'. It would work if root_dir then searched for existing language servers and returned the root dir of the first one it encounters in this case, but that's quite a workaround. |
I'm suggesting the opposite. Return False if the pattern matches a system library, so that lspconfig does not try to start (or attach) a language server for system Ada files. |
But I want it to attach, otherwise you get no language server for system Ada files. The language server already running in your projects works fine for the system ada files. |
Thanks for your report. The configs here are best-effort:
|
I supplied two PRs (1693 and 1678) that address this issue, but they were rejected because (1) mjlbach said he wanted "to keep the scope of lspconfig limited", and (2) I implemented a fix for linux only, which is easily fixable but (1) still stands so there's no point right now. I did actually create a separate plugin for choosing which GPR file to use, and this ended up obviating the 'root directory set to /' PR 1678, and thereby also fixing this particular issue with jumping into a library. Just to emphasize; if you just assemble a hello world example using the most common current open source Ada compiler, and try to jump into the print statement, you already run into this problem. ALS is pretty much unusable in its current state in nvim-lspconfig. I would happy to redo 1678 in a way that is cross-platform compatible, so that ALS becomes useable without the separate lsp-gpr-selector plugin, but in this current climate it looks like that would be rejected anyway, just based on it being for Ada. |
@justinmk I would appreciate it if you closed the issue if and only if the issue is fixed. This bug is still reproducible on the most recent nvim-lspconfig master branch. |
GH-1678 is definitely an odd solution though (i.e. setting |
I agree that 1678 is an odd solution. However, the problem is very clearly in lspconfig, not als, because the problem relates to when to start up als in the first place, and what to pass as the .gpr file to that language server. Hence, there cannot be any solution inside als itself. Most language servers don't have the feature available, that you can search for system library usages within a particular project - because they do not have this concept of a project file that is understood by the language server. So instead, most language servers rely on 'single-file mode' which supports far less, even though it does work. In my opinion, the proper solution is to add a new feature to lspconfig, allowing a server to set a boolean that says 'always re-use the existing languageserver instance'. This would be a feature added to all language-servers, even if als is the first to use it. Since a complaint was made about special-casing lspconfig for als, I did it using the hack of setting the workspace to /, to include the whole system, so that it connects the new file to the existing als instance. For windows, I think the empty string would work (because paths there start with a driveletter). |
You may not approve of my proposed solutions, but that doesn't magically fix the issue. This issue is still present. Please re-open. |
Status
|
Eh, not quite; this will be fixed when the removal is complete. Just deprecating als doesn't do it. |
deprecate is a mark as remove in next version. |
That is correct. So in the next version, this bug will be fixed. Right now, it's still open. If this is how you normally do things, that's fine, good to know. Do you want me to re-submit a PR for that version, deleting als? My prior PR of course conflicts on rebase but it's easy to fix / make another. |
Moved ALS config into own repo. See issue #1683 regarding problems with the current config. lspconfig is not intended to provide functional lsp configs, but rather a framework for other plugins to implement those. For more about that, see the discussion on #1693 The new ALS LSP config plugin is https://github.com/TamaMcGlinn/nvim-lspconfig-ada
The configuration for the Ada Language Server was first added in neovim#171 and removed in neovim#3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (neovim#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created by and the name "als" was borrowed, thus we have to use a new name, ada_language_server, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
The configuration for the Ada Language Server was first added in neovim#171 and removed in neovim#3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (neovim#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created by and the name "als" was borrowed, thus we have to use a new name, ada_language_server, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
The configuration for the Ada Language Server was first added in neovim#171 and removed in neovim#3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (neovim#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created and the name "als" was borrowed, thus we have to use a new name, ada_language_server, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
The configuration for the Ada Language Server was first added in neovim#171 and removed in neovim#3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (neovim#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created and the name "als" was borrowed, thus we have to use a new name, ada_ls, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
The configuration for the Ada Language Server was first added in neovim#171 and removed in neovim#3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (neovim#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created and the name "als" was borrowed, thus we have to use a new name, ada_ls, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
The configuration for the Ada Language Server was first added in #171 and removed in #3310. The removal happened due to misunderstandings, it was thought at the time that the default language server configuration could not work on its own (#1683), it turns out that this was actually caused by a bug in the ALS that was fixed a long time ago. This means the default ALS configuration can be re-introduced. However, in the meantime, a new neovim plugin for Ada was created and the name "als" was borrowed, thus we have to use a new name, ada_ls, in order to avoid breaking this plugin. This reverts commit 7b8b0b3.
Description
While in my project, ALS works just fine, assuming I have a single .gpr file.
But when I jump through a reference to some library, I get a new ALS instance which fails because it is given the root directory of the library, which contains multiple or zero .gpr files.
Neovim version
NVIM v0.6.0-dev+560-g1fdbd29df
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az32-619
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
Nvim-lspconfig version
c510964
Operating system and version
Ubuntu 21.04
Affected language servers
als
Steps to reproduce
Actual behavior
ALS spits out this error: 'LSP[als] More than one .gpr found. Note: you can configure a project through the ada.projectFile setting' and also doesn't work. For example, I can't jump to definitions / references in the library file now.
Expected behavior
Expected behaviour is to not throw an error and for ALS to work inside the library file as well.
One way to get that behaviour is to set the root dir to /, as in PR1678. This causes the lspconfig to reuse the ALS instance for the project, which already chose the correct gpr file. To chose a different project, you have to restart neovim, or use this gpr selector plugin.
But I assume you have a different fix in mind, since you closed the PR.
Minimal config
LSP log
right, but I gave a minimal config
The text was updated successfully, but these errors were encountered: