sourcegraph/go-langserver

Name: go-langserver

Owner: Sourcegraph

Description: Go language server to add Go support to editors and other tools that use the Language Server Protocol (LSP)

Created: 2016-10-11 17:20:56.0

Updated: 2018-05-23 15:58:09.0

Pushed: 2018-05-22 08:37:55.0

Homepage: https://sourcegraph.com

Size: 2264

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Go Language Server Build Status

go-langserver is a Go language server that speaks Language Server Protocol. It supports editor features such as go-to-definition, hover, and find-references for Go projects.

Open in Sourcegraph

To build and install the standalone go-langserver run

et -u github.com/sourcegraph/go-langserver

Support

| | Hover | Jump to def | Find references | Workspace symbols | VFS extension | Isolated | Parallel | |—-|——-|————-|—————–|——————-|—————|———-|———-| | Go | ? | ? | ? | ? | ? | ? | ? |

InitializationOptions

If you are a client wanting to integrate go-langserver, you can use the following as initializationOptions in your initialize request to adjust the behaviour:

rface GoInitializationOptions {
*
 funcSnippetEnabled enables the returning of argument snippets
 on `func` completions, eg. func(foo string, arg2 bar).
 Requires code completion to be enabled.

 Defaults to true if not specified.
/
ncSnippetEnabled?: boolean;

*
 gocodeCompletionEnabled enables code completion feature (using gocode).

 Defaults to false if not specified.
/
codeCompletionEnabled?: boolean;

*
 MaxParallelism controls the maximum number of goroutines that should be used
 to fulfill requests. This is useful in editor environments where users do
 not want results ASAP, but rather just semi quickly without eating all of
 their CPU.

 Defaults to half of your CPU cores if not specified.
/
xParallelism?: number;

*
 useBinaryPkgCache controls whether or not $GOPATH/pkg binary .a files should
 be used.

 Defaults to true if not specified.
/
eBinaryPkgCache?: boolean;

Profiling

If you run into performance issues while using the language server, it can be very helpful to attach a CPU or memory profile with the issue report. To capture one, first install Go and then:

Capture a heap (memory) profile:

ool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/heap > heap.svg

Capture a CPU profile:

ool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/profile > cpu.svg

Since these capture the active resource usage, it's best to run these commands while the issue is occurring (i.e. while memory or CPU is high).


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.