-
Notifications
You must be signed in to change notification settings - Fork 26
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
support for dart? #57
Comments
I think first step would be to try it out with debugging/tracing turned on. Then try to get file management and basic commands working. Maybe it already works but from what I've seen, there are always some incompatibilities between how client and server implement the LSP protocol and what version of LSP protocol they assume. I've not had a lot time to work on acme-lsp. The more I look at it, the more I dislike the JSON-rpc based LSP protocol, and Go is not the best language to implement a LSP client because it lack an union type. The acme-lsp code is heavily based on gopls and I've not kept up with updates to gopls. We desperately need to update the LSP protocol definitions to the latest LSP version, and auto-generate it from the LSP spec instead of manually updating them. I've attempted to update it few months ago, but the gopls code base have changed in a very incompatible way that it wasn't an easy change. To summarize, you may need to manually update protocol definitions to support dart, but this might get very tedious. The proper fix for protocol incompatibles is to auto-generate protocol definitions from the latest LSP spec. |
oh, so you're saying it might already partially work? it hadn't even occurred to me that it could, so I didn't even try it out, heh. In the meantime I'm using vim to "Ldef" and I just keep on coding in acme anyway. it kinda works... |
I gave it a shot but doesn't work:
This is with the auto-generated LSP structs from gopls I recently merged. |
…apability Fixes this issue with dart language server: ``` acme-lsp -server '\.dart$:dart language-server' 2023/06/18 18:21:41 LSP 4: Loading packages... 2023/06/18 18:21:41 failed to create file manager: failed to connect to language server ["dart" "language-server"]: initialize failed: json: cannot unmarshal bool into Go struct field WorkspaceFolders5Gn.capabilities.workspace.workspaceFolders.changeNotifications of type string ``` Update #57
Fixed that issue but now dart language server just hangs after successful initialization and uses 100% CPU. I'm guessing we might be triggering a bug in dart LS. |
Thank you for the time you spent on this. |
I just got basic Dart LSP support to work here. The key was setting the Diagnostics and Jump To Definition work, hover help does not:
and neither does formatting:
I believe I have seen the hover help output with e.g. the Typescript language server as well, and I believe an issue for it already exists, but it boils down to "The LSP specs that the Go code acme-lsp uses is generated from is a bit too advanced for Go's type system to translate 1:1". All in all, it's not at 100%, but this covers at least half of my use cases for Android Studio, so I'm happy. This is the relevant part of my config: [Servers]
[Servers.dartls]
Command = ["dart", "language-server", "--client-id=acme-lsp", "--client-version=1.0"]
StderrFile = "dartls.stderr.log"
LogFile = "dartls.log"
[Servers.dartls.Options]
onlyAnalyzeProjectsWithOpenFiles = true
[[FilenameHandlers]]
Pattern = "\\.dart$"
LanguageID = "dart"
ServerKey = "dartls" |
oooh, you got jump to definition working? color me interested then, because that's pretty much all I need. |
@farhaven Given that I'm not using Android Studio (only acme, and acme-lsp), what are all the pieces that I need to be able t o get to the point you are at? Are you using Android Studio as an LSP server for Dart? |
No, Android Studio is not required (to be running) per se. I have a flutter toolchain in The config I pasted above is all that I had to do to get it working (listing references works as well). Just a heads up, the LSP has the habit of spamming the |
Hello,
Do you have any idea how hard it would be to add (at least partial) support for dart (https://dart.dev/) ? FYI, vim does it through https://github.com/natebosch/vim-lsc , and https://github.com/natebosch/vim-lsc-dart for example.
As a long time user of acme-lsp, but having never touched the code, I'm wondering if I should attempt it. TBH, I would only need Ldef to work. Would you have any recommendation on where to start?
Cheers
The text was updated successfully, but these errors were encountered: