forked from sourcegraph/go-langserver
/
lspx.go
73 lines (56 loc) · 2.24 KB
/
lspx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package langserver
import "github.com/sourcegraph/go-langserver/pkg/lsp"
// This file contains Go-specific extensions to LSP types.
//
// The Go language server MUST NOT rely on these extensions for
// standalone operation on the local file system. (VSCode has no way
// of including these fields.)
// InitializationOptions are the options supported by go-langserver. It is the
// Config struct, but each field is optional.
type InitializationOptions struct {
// FuncSnippetEnabled is an optional version of Config.FuncSnippetEnabled
FuncSnippetEnabled *bool `json:"funcSnippetEnabled"`
// GocodeCompletionEnabled is an optional version of
// Config.GocodeCompletionEnabled
GocodeCompletionEnabled *bool `json:"gocodeCompletionEnabled"`
// FormatTool is an optional version of
// Config.FormatTool
FormatTool *string `json:"formatTool"`
// GoimportsLocalPrefix is an optional version of
// Config.GoimportsLocalPrefix
GoimportsLocalPrefix *string `json:"goimportsLocalPrefix"`
// MaxParallelism is an optional version of Config.MaxParallelism
MaxParallelism *int `json:"maxParallelism"`
// UseBinaryPkgCache is an optional version of Config.UseBinaryPkgCache
UseBinaryPkgCache *bool `json:"useBinaryPkgCache"`
}
type InitializeParams struct {
lsp.InitializeParams
InitializationOptions *InitializationOptions `json:"initializationOptions,omitempty"`
// TODO these should be InitializationOptions
// NoOSFileSystemAccess makes the server never access the OS file
// system. It exclusively uses the file overlay (from
// textDocument/didOpen) and the LSP proxy's VFS.
NoOSFileSystemAccess bool
// BuildContext, if set, configures the language server's default
// go/build.Context.
BuildContext *InitializeBuildContextParams
// RootImportPath is the root Go import path for this
// workspace. For example,
// "golang.org/x/tools" is the root import
// path for "github.com/golang/tools".
RootImportPath string
}
type InitializeBuildContextParams struct {
// These fields correspond to the fields of the same name from
// go/build.Context.
GOOS string
GOARCH string
GOPATH string
GOROOT string
CgoEnabled bool
UseAllFiles bool
Compiler string
BuildTags []string
// Irrelevant fields: ReleaseTags, InstallSuffix.
}