eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.02k stars 2.5k forks source link

[extension] Issues with Dart / Flutter extension #3999

Closed sr229 closed 5 years ago

sr229 commented 5 years ago

Description

Dart is a language created by Google that is standardized under ECMA TC52. It has gained traction recently because of a recent development named Flutter.

There is a community LS for Dart support via a Dart Analysis Server Shim.

Mirrored from Eclipse Che

vince-fugnitto commented 5 years ago

@sr229 it'd be nice to see if the following VSCode extension works properly in Theia https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code

sr229 commented 5 years ago

@vince-fugnitto we do have a VSCode-compatible API AFAIK so let's see how that bodes well

akosyakov commented 5 years ago

@sr229 if you find issues, please dump your findings here. We will categorise and prioritise them.

DanTup commented 5 years ago

I work on the Dart/Flutter extensions for VS Code - I was just trying them out here to see how well they worked. I think the extensions may be failing to activate since the first thing I expect it to do is pop up and tell me it can't find a Dart SDK but it did not. We search PATH for an SDK at activation and if we can't find one we'll prompt the user to locate it manually - but this did not happen.

There are some errors in the console which may be related:

There were many other things I noticed didn't work - but I suspect they're all related to this (for ex. no code completion, no SDK version in the status bar, commands like "Dart: New Project" don't work).

FWIW, there are also these warnings - which I suspect are just bits you haven't implemented yet, but FYI Dart does use them (debug/toolBar to add a hot reload icon to the debug toolbar, and view/title for some options in the Flutter Outline view):

svenefftinge commented 5 years ago

Hey @dantup, I looked into it and the latest version doesn't work the code-dart extension uses new yet unsupported API (ExtensionKind). I have setup the flutter_web repo using an older release that doesn't use that API: https://github.com/svenefftinge/flutter_web

There are however many errors coming from the language server which seem wrong. Would be great if you can have a look and share any insights as I don't have experience in flutter/dart.

DanTup commented 5 years ago

I think many of the errors come from not having run pub get for each of the folders. It might be simpler to open only examples/hell_world rather than opening all of the flutter_web code itself (though I'm not if that's possible here without making a new repo?).

I was trying to get pub-get-on-pubspec-changes to work, but it didn't seem to run. I tried to run the Dart: Capture Logs command to help debug, but that command doesn't seem to show up in the command palette - it has a context which should be set when the extension is activated:

https://github.com/Dart-Code/Dart-Code/blob/39bb09e78d8cdb1700152e1e7f419ef18619e272/package.json#L440

I think maybe the extension still is not activating correctly, maybe due to this:

TypeError: testTreeView.onDidChangeSelection is not a function

svenefftinge commented 5 years ago

I've changed the config so it opens on hello_world (see https://github.com/svenefftinge/flutter_web/blob/master/.gitpod.yml#L3)

We'll have a deeper look into the rough edges (e.g. i noticed weird editing issues) with your extension. And report our progress here. Thanks for trying!

svenefftinge commented 5 years ago

Also, related https://github.com/flutter/flutter/issues/32436

DanTup commented 5 years ago

@svenefftinge what's the best way to report issues when trying to use Dart/Flutter? Should I list them here, or open separate issues for each, or something else?

For ex., hit this one just now:

Uncaught (in promise) TypeError: ft.onDidChangeSelection is not a function
    at e (/tmp/vscode-extensions/Dart-Code.dart-code@3.2.0-beta.3/extension/out/dist/extension.js:1)
    at PluginManagerExtImpl.<anonymous> (/theia/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:375)

The objects are vscode.TreeView instances that we're calling onDidChangeSelection on.

akosyakov commented 5 years ago

Separate issues will be better. fs is a tree?

DanTup commented 5 years ago

ft - the name has likely been munged by webpack, but the source is here:

https://github.com/Dart-Code/Dart-Code/blob/b8c0f6f138b31748822c0f4ff471ddfa277c7cfa/src/extension/extension.ts#L414

Let me know if you want a separate issue for that one, and I'll open new issues for anything else like this I find. Thanks!

DanTup commented 5 years ago

By the way - when I click Start -> Debug, nothing happens (even with a custom build with the treeview code commented out to avoid errors during activation). Is there any way to debug that (assuming it's expected to work)?

akosyakov commented 5 years ago

You can track progress in this branch: https://github.com/theia-ide/theia/tree/ak/flutter_support

Screen Shot 2019-08-25 at 17 50 03 Screen Shot 2019-08-25 at 17 46 34

Related issues:

akosyakov commented 5 years ago

Missing commands:

akosyakov commented 5 years ago

Missing activation events:

akosyakov commented 5 years ago

@DanTup Could you help me a bit please? I'm trying to understand what are expectations around onUri activation event for Dart extension?

I'm going to stub onUri activation event for now, that an extension does not get activated eagerly. It would be helpful to understand use cases around it in order to provide a proper implementation.

DanTup commented 5 years ago

@DanTup Could you help me a bit please? I'm trying to understand what are expectations around onUri activation event for Dart extension?

Sorry for the delay, I missed this one. The onUri activation is not actively used, so not a priority. It might also not make much sense in this context.

Essentially, VS Code allows extensions to publish URIs like vscode://extension-identifier/some/path and when the user clicks them, their browser will delegate to the locally-installed VS Code, which will then activate extension-identifier and invoke a URI handler registered with window.registerUriHandler().

I don't think not implementing this would be a problem, but should you wish to in future, you would probably end up with some link on your own domain that maps to the same (eg. https://gitpod.io/dart-code.flutter/flutter/sample/my.sample.id) but I don't know how much sense that'd make (to open a workspace without a repo, for example).

The feature it was intended to support (which has not been linked up) was that we could have links on the website to "run this sample" that could spawn VS Code and have it automatically create the sample app (via flutter create) and open it.

svenefftinge commented 5 years ago

I think this has been resolved now.