tinygo-org / playground

TinyGo playground and VS Code extension
https://play.tinygo.org/
BSD 3-Clause "New" or "Revised" License
30 stars 7 forks source link

Feature Request: build a wasm gopls to allow auto completion in browser #25

Open Zxilly opened 2 months ago

Zxilly commented 2 months ago

Right now playground uses codemirror, I think it would be simpler to switch to monaco implementation.

aykevl commented 2 months ago

gopls in the browser would indeed be really nice to have!

There are a few things that make this difficult:

Right now playground uses codemirror, I think it would be simpler to switch to monaco implementation.

Actually, no. I specifically choose CodeMirror 6 over Monaco. CodeMirror 6 is very flexible, small, and because it uses native browser APIs it works everywhere. And it supports autocomplete. Monaco doesn't support mobile browsers, is big and from what I've read difficult to configure/modify. Switching to Monaco would mean dropping mobile support, which I'm not willing to do.

Zxilly commented 2 months ago

"Monaco doesn't support mobile browsers"

I think it works on mobile, but due to the WebWorkers, the bundler may need additional setup.

aykevl commented 2 months ago

I tried it. Inserting text and backspace work, but selecting text does not. Also, when you focus the editor in Chrome it zooms in much further than useful/practical. These things all work correctly in CodeMirror 6.

This is where I tried it: https://microsoft.github.io/monaco-editor/

Also, that page literally says:

The Monaco editor is not supported in mobile browsers or mobile web frameworks.

In any case, this is besides the point. The feature request is about gopls autocompletion, not about the editor. If there are any features in the editor missing feel free to file a bug report, but autocomplete is supported in CodeMirror 6 (just not wired up yet in the playground).

Zxilly commented 2 months ago

I think I need to start with some exec proposals for wasm port of Golang, there are these APIs we need in wasi 0.3