Not having a good lsp for neovim
Hi, I was looking for an editor to use Flutter that doesn't have VScode problems and doesn't need a special configuration, and I found the [NvPak] configuration for Neovim, but due to the bad support of Flutter-lsp , I talked to the NvPak team, and they gave the [mason] link and the mason team He also said (Issues-link) that it is not from our side, and I think that the problem with your server-language support is in [NeoVim] , and if possible, develop something like [rust-analyzer]. And my suggestion is to use this standard [nvim-lspconfig] and [server_configurations.md]
hey! I develop flutter apps on nvim. My setup works just fine, and I have a bit of trouble grasping your problem.
Mason seems to be a plugin that downloads LSP servers for neovim.
You do not need or want to install Dart LSP with Mason: it is already included in the dart executable provided by the Flutter/dart sdks or your package manager.
What you want basically is:
require("lspconfig").dartls.setup{}
and that's it. Install a snippet engine to get autocomplete too.
Please let me know if you need other help.
Unrelated note: I wouldn't advise using those prebuilt configs since you probably don't want a lot of complexity hiding that you don't even know about, if not familiar with the code
@Nooob-Student Your issue is better suited for support channels like StackOverflow, so please ask the same there. Closing from here as this doesn't seem to be related to Flutter framework bug or feature request.
@Nooob-Student Your issue is better suited for support channels like StackOverflow, so please ask the same there. Closing from here as this doesn't seem to be related to Flutter framework bug or feature request.
Unfortunately, mason support is critical for dart-ls, because if we install a distribution from Neovim, we have to manually add dart support each time. It doesn't matter which neoivm configuration you use (nvpak, lunarvim, nvchad or...), Python language is well supported by default. But this is not the case for Dart, this is because Mason does not support Dart and it causes problems in the first run (for people who do not have Dart language installed). As with other languages, installing dartls should be left to the package managers, especially since not everyone may use nvim-lsp.
This sounds like an issue of Mason. This doesn't have to do anything with nvim-lspconfig or nvim at all.
The dart lsp is implemented in tight integration with dartc. I don't think at this point that it should be decoupled, since we don't have a ) a compiler API for things like this (AFAIK) b ) enough people to support two different projects
Flutter also seems to like the monorepo approach a lot
I don't understand one thing about the Dart language, especially the flutter framework In other languages, frameworks and libraries are installed with the help of package managers.
For example in rust:
cago install rocket
Or if you only need a part of it, just write it like this in the cargo.toml file.
[dependencies]
rocket = { version = "0.5.0-rc.2", features = ["secrets"] }
Or if we examine the same process for Python:
pip install piccolo[all]
Or if we only want part of it.
pip install piccolo[sqlite]
For standard languages and frameworks, the path is usually something like this. Why did Flutter take a different path, it would not be better if the path was like this?
pub install flutter[android]
Why everything that might not even be needed should be installed with Flutter, why Flutter doesn't install easily with the package manager and does everything in a more difficult way. And finally, why does Flutter display prerequisites that may not even be needed? (referring to "flutter doctor" warnings) Android studio Chrome And... I always think it's Google's sdk system that's a little weird, but it's like they made all of Google equally non-standard.
Hi, I am nvpak developer. From my point of view, this issue should be moved to discussions and it has room for more research.
Everything had to be done with the help of the dart pub package manager and you had to have something like https://github.com/akinsho/flutter-tools.nvim. But dartls in neovim is much weaker than your support for other editors, so flutter users have to use external plugins, for example flutter-tools, and not everything is easily done with mason's help. Your development team really needs to rethink the time and money they spend on tools. How beautiful it would be if Flutter could be easily installed with the help of dart pub like "frog" framework (and other standard frameworks). And how beautiful it would be if dart-lsp was a complete and efficient tool that would identify all the libraries installed on dart and give them appropriate instructions.
Dear friend @Nooob-Student you have to make a fork of nvpak and manually install flutter-tools in it. Of course, we may soon add support for it officially to nvpak. Thanks for your follow up.
I think I better understand the concerns now. BUT you have to understand that although dart can be an all-purpose language, it is developed by and for flutter.
There is very little use for it other than Flutter. Language features like ifs in arrays are specifically made for the needs of flutter.
Yes, a lot of things would be good. Rust has a vibrant community and backing from outside of the original organization (Mozilla). Flutter is basically Google all the way.
I agree with @Pakrohk that we should move this to discussions, as there is no actual urgent issue preventing you from using the LSP.
I think I better understand the concerns now. BUT you have to understand that although dart can be an all-purpose language, it is developed by and for flutter.
There is very little use for it other than Flutter. Language features like
ifs in arrays are specifically made for the needs of flutter.Yes, a lot of things would be good. Rust has a vibrant community and backing from outside of the original organization (Mozilla). Flutter is basically Google all the way.
I agree with @Pakrohk that we should move this to discussions, as there is no actual urgent issue preventing you from using the LSP.
That's exactly the problem, Dart has the potential to become a full-fledged language, but for now it remains like Flutter is the language and Dart is its framework. Both Flutter and Dart have to take their place (if they want the future) because sooner or later the Flutter framework will be available for other languages and then Dart will be abandoned with this development method.
Install a snippet engine to get autocomplete too.
Could you give a recommendation?
According to the following page, snippets are included in the autocompletion if dart.enableSnippets is unset or enabled:
https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration
However, I did not get this to work after including the line you suggested (require("lspconfig").dartls.setup{}) in my config.
Edit: Never mind, I had to modify my config with the following, to make snippets work (not sure why this isn't enabled by default):
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require("lspconfig").dartls.setup {capabilities = capabilities,}
Further, symbol renaming does not appear to work for me. Is this simply due to the fact that textDocument/prepareRename and textDocument/rename are not implemented at the plugin level? If so, that would be a real bummer, because I consider symbol renaming to be a pretty essential feature.
Edit: Figured this out, it was due to another unrelated part of my config.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.