Skip to content
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

Dart extension from VSCode triggers exception on init #2411

Open
charliesbot opened this issue Sep 5, 2020 · 5 comments
Open

Dart extension from VSCode triggers exception on init #2411

charliesbot opened this issue Sep 5, 2020 · 5 comments
Labels
A-extension Area: Extension/plugin integration, vscode or VimL bug Something isn't working U-exthost Upstream: Issue in VSCode extension host

Comments

@charliesbot
Copy link

Scenario

I saw there's already an issue marked as closed (#2097).
After installing both the flutter and dart extensions, an exception is raised, and there's no syntax highlight or autocomplete.

OS: Windows 10

image

@charliesbot charliesbot changed the title Dart extension from VSCode trigger exception on init Dart extension from VSCode triggers exception on init Sep 5, 2020
@bryphe
Copy link
Member

bryphe commented Sep 7, 2020

Just took a quick look at this - seems like this is due to our extension host being out-of-date.

It's failing when running this line here: https://github.com/Dart-Code/Dart-Code/blob/8893095bb30f3102986d4dfdb1abd78fa58994ef/src/extension/extension.ts#L412

The extension requires a VSCode API version of 1.47.0 - ours is currently at 1.45.0. Need to upgrade to bring it up-to-date.

@bryphe bryphe added A-extension Area: Extension/plugin integration, vscode or VimL bug Something isn't working U-exthost Upstream: Issue in VSCode extension host labels Sep 7, 2020
@bryphe
Copy link
Member

bryphe commented Sep 9, 2020

I've revved up to 1.47.1 here: #2423

With that, the extension activates, and we get some language services for existing files:
image

However, I see a few issues - there are these errors that come up while editing:

rejected promise not handled within 1 second: [object Object]
[WARN]   +785ms Oni2.Extension.ClientStore : Unhandled message: (Msg.Errors
   (Msg.Errors.OnUnexpectedError
      `List ([`Assoc ([("code", `String ("INVALID_PARAMETER"));
                        ("message",
                         `String ("Invalid parameter 'params.files[\"/Users/bryphe/hello-dart/test.dart\"].edits[0]'. Expected to be offset."))
                        ])
               ])))
[INFO]     +0ms Exthost.Client : Sending message: Exthost_Protocol.Message.Outgoing.ReplyOKEmpty {requestId = 389}
rejected promise not handled within 1 second: [object Object]
[WARN]   +256ms Oni2.Extension.ClientStore : Unhandled message: (Msg.Errors
   (Msg.Errors.OnUnexpectedError
      `List ([`Assoc ([("code", `String ("INVALID_PARAMETER"));
                        ("message",
                         `String ("Invalid parameter 'params.files[\"/Users/bryphe/hello-dart/test.dart\"].edits[0]'. Expected to be offset."))
                        ])
               ])))

Looks like there might be an issue with the way we are sending buffer updates (might be related to some issues I've seen with other language servers, like Haskell: #2380 )

And a parse failure for document highlights:

[ERROR]    +2ms Exthost.Client : Request 664 for $provideDocumentHighlights failed with error: ParseFailedException("Expected a list, but got null")

@Jorgee97
Copy link

Jorgee97 commented Oct 7, 2020

Any updates on this issue?

@bryphe
Copy link
Member

bryphe commented Nov 12, 2020

Hi @Jorgee97 - a couple updates:

And then, finally, investigating this issue:

   (Msg.Errors.OnUnexpectedError
      `List ([`Assoc ([("code", `String ("INVALID_PARAMETER"));
                        ("message",
                         `String ("Invalid parameter 'params.files[\"/Users/bryphe/hello-dart/test.dart\"].edits[0]'. Expected to be offset."))
                      

I saw that this using an older analysis service - it turns out the newer, LSP-based language server doesn't have this issue, and seems to behave much better for me in Onivim (I get much nicer completions with it, and importantly no errors):

2020-11-11 17 03 19

So I'd recommend using it as well - you can do the following:

  1. Open the configuration.json - Command+Shift+P/Control+Shift+P - Preferences: Open configuration file

  2. Add an entry "dart.previewLsp": true, to the JSON

image

  1. Save & restart Onivim

  2. Open up your dart project

You can check if the dart extension is using the LSP server by hovering over the Dart status bar item - if it says (LSP) you're in good shape:

image

It sounds like the LSP will soon be the default, anyway: (Dart-Code/Dart-Code#2286 (comment))

@Jorgee97
Copy link

Many thanks @bryphe, this really helps with autocompletion and fixes errors with the dart/flutter extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-extension Area: Extension/plugin integration, vscode or VimL bug Something isn't working U-exthost Upstream: Issue in VSCode extension host
Projects
None yet
Development

No branches or pull requests

3 participants