Dart-code: LSP Known Issues

Created on 4 Mar 2020  路  23Comments  路  Source: Dart-Code/Dart-Code

When running in LSP mode, the following things are known not to work (or function differently to non-LSP):

in lsanalysis server is discussion / feedback

Most helpful comment

Most of the issue here are resolved. There are a few outstanding which have their own issues (which I've linked in the description above), which I'm hoping to address fairly soon so that LSP can become the default.

If you encounter any other issues not listed, please file new specific issues. Thanks!

All 23 comments

  • For some reason the widget guides feature is not available.
  • Tests codeLens(Run|Debug) is not available.

@DanTup I'm implementing the Emacs support for dart/flutter on lsp-dart so I'm checking how you did it on this extension and notice the problems above :)

@ericdallo thanks! I've added UI Guides to the list above. CodeLens is supposed to work, though I can see it failing so I've opened https://github.com/Dart-Code/Dart-Code/issues/2421 - probably will be an easy fix. Thanks!

I implemented the both features on lsp-dart, so I think it's easy to fix them on the vscode extension :)

@ericdallo actually, the reason my code lens didn't work is that I was using an older Dart SDK that wasn't sending the outline notifications. On the most recent nightly the code lens seem to work fine. Do you know what version you were using when you saw it fail?

Yeah, me too :sweat_smile: I was using dart dev 2.8.0-10

Ok great, working as expected then :-) I've fixed up Flutter UI Guides and Gutter icons too.

Nice! just a thing to keep in mind, If the next features could be implemented for LSP too, I could implement it on lsp-dart :)
Thanks!

@ericdallo do you mean specific features, or just in general? Any new features being implemented are very likely to be added to LSP too (some may even only be implemented in LSP) as I'd like to switch Dart-Code over to LSP by default (without losing any significant functionality).

Some of the things mentioned above (like dart.analysisExcludedFolders and dart.doNotFormat) are kinda hacks though, so they might not be carried over (or may be reworked if they are).

Nice, good to know!
That's what I wanted to hear, I was afraid that DAS was the focus for new features, not LSP

I just tested the lsp preview in vscode and dart-lang/sdk#41195 also happens in vscode.
If you have a file open and add some class to it you cannot auto import it into another file until you close the window or tab the file was opened in.

Also, the line length setting for the formatter is ignored

@Kavantix

I just tested the lsp preview in vscode and dart-lang/sdk#41195 also happens in vscode.

Do you have steps to repro this in VS Code? I just tried following essentially the same instructions, but it didn't seem to happen. If you can grab an analysis server log while doing so, that may help too.

Also, the line length setting for the formatter is ignored

Thanks! Got a fix for this at https://dart-review.googlesource.com/c/sdk/+/154008.

I enabled the log file but it stays empty (other than the versions I am using)
Here is a gif showing the issue:
ezgif com-video-to-gif

@Kavantix I reproduced this with Dart 2.8.2 but couldn't reproduce on the current code to try and debug. Could you temporarily try with the latest nightly SDK from http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/sdk/ to see if it still happens for you there?

I enabled the log file but it stays empty (other than the versions I am using)

That doesn't sound right - though VS Code sometimes doesn't update files that are modified correctly unless you close/re-open them - could it be that? Also - can you check you used dart.analyzerLogFile and not dart.analyzerInstrumentationLogFile? Thanks!

Thanks! Got a fix for this at https://dart-review.googlesource.com/c/sdk/+/154008.

@DanTup I am using latest beta version of DartCode in LSP mode. How can I set custom line length?

@DanTup Also happens with the last version:
"143" alt="image" src="https://user-images.githubusercontent.com/6243755/87850006-2f9f6100-c8ed-11ea-9342-281920f43312.png">

It did however now write some info to the log file
dartlog_import_issue.txt

Btw I was checking the log file using tail -f from the command line ;)

@RaviKavaiya

@DanTup I am using latest beta version of DartCode in LSP mode. How can I set custom line length?

This fix is in the server, so you need an updated Dart SDK (such as a nightly from http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/sdk/). It should then use the same dart.lineLength setting that the non-LSP implementation uses.

@Kavantix

@DanTup Also happens with the last version:

Thanks - I also managed to hit this again yesterday in the nightly, so it is still there. I'll do some more digging, thanks!

@DanTup Sorry, I don't know whether I should ask that here. But, Flutter doesn't allow custom Dart SDKs right? If yes, then I would wait for it. (BTW, I am on Flutter Dev channel)

@RaviKavaiya correct - for Flutter you need to use the SDK it provides. When you run flutter --version it will show the version of the SDK (eg. Dart 2.9.0 (build 2.9.0-21.0.dev 89fe12b12a)) so once that's higher than the version that includes this change it should work.

@Kavantix I got to the bottom of the issue - I've got a fix out for review at https://dart-review.googlesource.com/c/sdk/+/154960/. Thanks!

@DanTup I can confirm that the fix works, Thanks a lot this will save me quite some headaches using the LSP in vim :)

@Kavantix excellent, thanks for confirming!

Most of the issue here are resolved. There are a few outstanding which have their own issues (which I've linked in the description above), which I'm hoping to address fairly soon so that LSP can become the default.

If you encounter any other issues not listed, please file new specific issues. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mccadi picture mccadi  路  3Comments

shamrin picture shamrin  路  5Comments

jascodes picture jascodes  路  4Comments

DanTup picture DanTup  路  4Comments

FeimiSzy picture FeimiSzy  路  4Comments