Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Trial use of Go language server by sourcegraph #706

Closed
ramya-rao-a opened this issue Jan 4, 2017 · 17 comments
Closed

Trial use of Go language server by sourcegraph #706

ramya-rao-a opened this issue Jan 4, 2017 · 17 comments

Comments

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jan 4, 2017

http://langserver.org is the detailed list of current status of LSP implementations for various languages
https://github.com/sourcegraph/go-langserver is the LSP implementation for Go by SourceGraph
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md is the complete list of features by LSP

Currently supported features by Go LSP
- Hover info
- Go to definition
- Symbols
- Find all references

This issue is to track the work of possibly using the LSP by sourcegraph for Go in the Go extension for VS Code

@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Jan 8, 2017

The branch langserver has the integration with the language server from source graph. The below features are configured to be using the language server

  • Hover
  • Goto/Peek Definition
  • Find All References
  • File Outline
  • Workspace Symbol Search

At the moment, the first 3 features work as expected.
The last 2 do not return any symbols

Edit on 19/1/2017: The last 2 features work now as well.

@mattetti
Copy link
Contributor

mattetti commented Jan 8, 2017

I assume this feature would be online only, would we keep the existing features as a fallback? Sending code to a remote server might also be a blocker for some companies

@ramya-rao-a
Copy link
Contributor Author

This is not an online feature. The language server will be hosted in the user's machine.

@mbana
Copy link

mbana commented Jan 19, 2017

fyi: "File Outline" aka textDocument/documentSymbol works in one of the branches, it's probably not in master hence why it's not working.

you might want to ping @sqs (https://github.com/sqs).

@ramya-rao-a
Copy link
Contributor Author

Thanks @mbana!
@sqs ?

@keegancsmith
Copy link

@ramya-rao-a try on the latest master, I fixed that bug last week.

@ramya-rao-a
Copy link
Contributor Author

@keegancsmith Just tried. Both File Outline and Workspace Symbols work now.
Thanks!

@ramya-rao-a
Copy link
Contributor Author

The latest update of the Go extension (0.6.54) has the integration with the language server available via a setting go.useLanguageServer

@junkblocker
Copy link

FYI, this implementation doesn't seem to show struct details whereas the default implementation shows struct members on hover.

@mattetti
Copy link
Contributor

mattetti commented Mar 1, 2017

I agree with @junkblocker, this is quite a big regression. I rely quite heavily on seeing the struct members on hover to populate the fields. I only turned on the option tonight so I didn't get to really experience the new language server but overall it seems really much faster, especially to find references. Should we open a new issue? Do we know if that's the limitation of the language server or the integration?

@sqs
Copy link

sqs commented Mar 1, 2017

Thanks for trying it out and posting. It's a relatively simple fix to github.com/sourcegraph/go-langserver to make it show struct fields in hovers. That fix will be in within 24 hours.

@mattetti
Copy link
Contributor

mattetti commented Mar 1, 2017

@sqs awesome, I was wondering, what do you think about versioning the go-langserver so we could check that the user doesn't have version that is too old and potentially suggest and update?

@ramya-rao-a
Copy link
Contributor Author

@junkblocker Thanks for catching this! Created sourcegraph/go-langserver#168 to track the struct members not being shown on hover issue.

sourcegraph/go-langserver#154 is tracking ways we can have sync between the version of language server the Go extension expects user to have and the version user actually has.

@sqs can you provide thoughts there?

@keegancsmith
Copy link

Hovers with struct fields coming soon :) sourcegraph/go-langserver#169

Also adding a -version flag. Soon you should be able to run go get gopkg.in/sourcegraph/go-langserver.v2, etc. sourcegraph/go-langserver#170

@ramya-rao-a
Copy link
Contributor Author

Soon you should be able to run go get gopkg.in/sourcegraph/go-langserver.v2

The issue I have with using gopkg.in is that the extension can only ask for which major version it wants and has no control over the minor version.

There might be features in the language server in the future that the extension is not ready for or the features might be in a alpha/beta stage and not ready themselves to be used by the extension (one example is the diagnostics which had to be reverted)

This is not usually the problem with rest of the Go tools we depend on, as they have been stable for a while.

We are looking into having a post install step in the Go extension, that gets the right version of the language server during install/update of the extension.
Beyond that the -version flag can be used by the users themselves if they want to update manually.

Created #828 for the same

@keegancsmith
Copy link

The issue I have with using gopkg.in is that the extension can only ask for which major version it wants and has no control over the minor version.

@ramya-rao-a given we aren't a library we don't have to strictly adhere to semantic versioning. We can only use the major version when doing a release, so when .v2 is tagged it will never change. The next time we tag a release it will be .v3 (not v2.1, etc).

If we stick to that, you should be able to rely on doing -version in vscode-go to ensure the user is on the required version, and either update automatically if old or warn if newer.

@ramya-rao-a
Copy link
Contributor Author

@keegancsmith Sure that works

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants