theia-ide / go-language-server Goto Github PK
View Code? Open in Web Editor NEWThis project forked from microsoft/vscode-go
A Go language server.
License: Other
This project forked from microsoft/vscode-go
A Go language server.
License: Other
Currently doesn't even work in VSCode
When trying to use the server, I got this error:
server --> client: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"[lspserver] (node:17641) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: \\"file\\" argument must be a non-empty string"}}'
server --> client: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"[lspserver] (node:17641) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."}}'
and the server wouldn't reply anything. After some debugging, I found that it was because it didn't find the go binary. The rejected promise should be handled to avoid that warning, and a better error message should be given to the user to indicate what to fix.
The infrastructure is there but I doubt it works.
Make sure everything that is registered/initialized in goMain
is also handled in the LSP version.
The VSCode extension executes VSCode commands in a couple of places. We should introduce new LSP requests/notifications for these or get rid of the command calls.
This situation can happen if you hold ctrl down and hover some words in comments with your cursor.
client --> server: {"id": 124, "jsonrpc": "2.0", "method": "textDocument/definition", "params": {"textDocument": {"uri": "file:///home/emaisin/src/ls-interact/go-test/test.go"}, "position": {"character": 46, "line": 12}}}
server --> client: {"jsonrpc":"2.0","id":124,"error":{"code":-32600,"message":"Command failed: /home/emaisin/gopath/bin/godef -t -i -f /home/emaisin/src/ls-interact/go-test/test.go -o 334\ngodef: no identifier found\n","data":"Command failed: /home/emaisin/gopath/bin/godef -t -i -f /home/emaisin/src/ls-interact/go-test/test.go -o 334\ngodef: no identifier found\n"}}
In Theia, this results in an annoying error popup. If you move all over the comments with your cursor while holding ctrl, you'll get many error popups.
It can be reproduced when using this code there (test.go): https://github.com/simark/ls-interact/tree/master/go-test, and hovering the word "that" on line 13.
Something like this was reported by our internal users, but it's the first time I witness it myself. See attached video.
I was using the theiaide/theia-go image (https://hub.docker.com/r/theiaide/theia-go/), pulled fresh today. In it, I cloned the golang repo (https://github.com/golang/go.git) and noticed I could not open file src/bufio/bufio_test.go . However I am able to open other .go files in the same directory. The file itself looks fine; I can "cat" it successfully.
This may not consistently reproducable (it works for me using a different, internal docker image, that also has golang LS).
Here's the exception:
Uncaught (in promise) A resource provider for 'file:///home/theia/go/src/bufio/bufio_test.go' is not registered.
rejected @ opener-service.ts:6
Promise.then (async)
step @ opener-service.ts:6
fulfilled @ opener-service.ts:6
Promise.then (async)
step @ opener-service.ts:6
(anonymous) @ opener-service.ts:6
__awaiter @ opener-service.ts:6
open @ opener-service.ts:71
FileNavigatorModel.doOpenNode @ navigator-model.ts:32
TreeModel.openNode @ tree-model.ts:238
TreeWidget.handleDblClickEvent @ tree-widget.ts:280
ondblclick @ tree-widget.ts:131
On the LS, we don't have selection. Would be great if the client sent the selection as an argument with the commands that need it. A wrapper command on the client could be helpful.
Also type it.
A lot of valuable output goes into the output channel of the VSCode extension.
We should implement something similar for Theia and then route the outputChannel
there.
Maybe related to eclipse-theia/theia#786
Code lens works fine apart from opening the references:
The server composes a set of arguments of type URI
, Position
and Location[]
for the editor.action.showReferences
command (in goReferencesCodelens#resolveCodeLens
). These are sent to the client, as such converted to plain JSON objects. The client, when trying to execute the command, validates the args to be instance of URI
, IPosition
and Array
, which fails as they are plain JSON objects.
One solution could be to register a separate command in the theia-go-extension that is called instead and does the conversion.
Currently, we only use the command title to present commands to the user. The command descriptions are sometimes much more meaningful. Do we have a way to map them to LSP or at least Theia?
Would it be possible to indicate in the README how to build this package? Also, maybe how to run the tests? My guess was npm run compile
and npm run test
, but I get:
Error: ENOENT: no such file or directory, open '/home/emaisin/.go/go.json'
at Object.fs.openSync (fs.js:653:18)
at Object.fs.readFileSync (fs.js:554:33)
at new FileBasedConfig (/home/emaisin/src/go-language-server/out/src-vscode-mock/config.js:14:37)
at WorkspacConfigurationProvider.getConfig (/home/emaisin/src/go-language-server/out/src-vscode-mock/workspace.js:83:28)
at WorkspacConfigurationProvider.get (/home/emaisin/src/go-language-server/out/src-vscode-mock/workspace.js:64:68)
at Workspace.getConfiguration (/home/emaisin/src/go-language-server/out/src-vscode-mock/workspace.js:105:52)
at Object.<anonymous> (/home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.spec.js:93:24)
at Generator.next (<anonymous>)
at /home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.spec.js:13:71
at new Promise (<anonymous>)
at __awaiter (/home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.spec.js:9:12)
at Context.before (/home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.spec.js:50:14)
at callFn (/home/emaisin/src/go-language-server/node_modules/mocha/lib/runnable.js:348:21)
at Hook.Runnable.run (/home/emaisin/src/go-language-server/node_modules/mocha/lib/runnable.js:340:7)
at next (/home/emaisin/src/go-language-server/node_modules/mocha/lib/runner.js:309:10)
at Immediate.<anonymous> (/home/emaisin/src/go-language-server/node_modules/mocha/lib/runner.js:339:5)
at runCallback (timers.js:785:20)
at tryOnImmediate (timers.js:747:5)
at processImmediate [as _immediateCallback] (timers.js:718:5)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/emaisin/.go/go.json' }
default config
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.