2019-09-05 22:17:36 -06:00
|
|
|
// Copyright 2019 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package source
|
|
|
|
|
2019-09-09 11:04:12 -06:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"golang.org/x/tools/internal/lsp/protocol"
|
|
|
|
)
|
2019-09-05 22:17:36 -06:00
|
|
|
|
|
|
|
var (
|
|
|
|
DefaultSessionOptions = SessionOptions{
|
|
|
|
TextDocumentSyncKind: protocol.Incremental,
|
|
|
|
HoverKind: SynopsisDocumentation,
|
|
|
|
InsertTextFormat: protocol.PlainTextTextFormat,
|
|
|
|
SupportedCodeActions: map[FileKind]map[protocol.CodeActionKind]bool{
|
|
|
|
Go: {
|
|
|
|
protocol.SourceOrganizeImports: true,
|
|
|
|
protocol.QuickFix: true,
|
|
|
|
},
|
|
|
|
Mod: {},
|
|
|
|
Sum: {},
|
|
|
|
},
|
|
|
|
Completion: CompletionOptions{
|
|
|
|
Documentation: true,
|
2019-09-06 18:17:48 -06:00
|
|
|
Deep: true,
|
|
|
|
FuzzyMatching: true,
|
2019-09-05 22:17:36 -06:00
|
|
|
},
|
2019-09-09 11:04:12 -06:00
|
|
|
DefaultViewOptions: ViewOptions{
|
|
|
|
Env: os.Environ(),
|
|
|
|
},
|
2019-09-05 22:17:36 -06:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type SessionOptions struct {
|
|
|
|
Env []string
|
|
|
|
BuildFlags []string
|
|
|
|
HoverKind HoverKind
|
|
|
|
DisabledAnalyses map[string]struct{}
|
|
|
|
|
|
|
|
WatchFileChanges bool
|
|
|
|
InsertTextFormat protocol.InsertTextFormat
|
|
|
|
ConfigurationSupported bool
|
|
|
|
DynamicConfigurationSupported bool
|
|
|
|
DynamicWatchedFilesSupported bool
|
|
|
|
PreferredContentFormat protocol.MarkupKind
|
|
|
|
LineFoldingOnly bool
|
|
|
|
|
|
|
|
SupportedCodeActions map[FileKind]map[protocol.CodeActionKind]bool
|
|
|
|
|
|
|
|
TextDocumentSyncKind protocol.TextDocumentSyncKind
|
|
|
|
|
|
|
|
Completion CompletionOptions
|
2019-09-09 11:04:12 -06:00
|
|
|
|
|
|
|
DefaultViewOptions ViewOptions
|
2019-09-05 22:17:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type ViewOptions struct {
|
2019-09-09 11:04:12 -06:00
|
|
|
// Env is the current set of environment overrides on this view.
|
|
|
|
Env []string
|
|
|
|
|
|
|
|
// BuildFlags is used to adjust the build flags applied to the view.
|
|
|
|
BuildFlags []string
|
2019-09-05 22:17:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type CompletionOptions struct {
|
|
|
|
Deep bool
|
|
|
|
FuzzyMatching bool
|
|
|
|
Unimported bool
|
|
|
|
Documentation bool
|
|
|
|
FullDocumentation bool
|
2019-09-04 11:23:14 -06:00
|
|
|
Placeholders bool
|
2019-09-05 22:17:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type HoverKind int
|
|
|
|
|
|
|
|
const (
|
|
|
|
SingleLine = HoverKind(iota)
|
|
|
|
NoDocumentation
|
|
|
|
SynopsisDocumentation
|
|
|
|
FullDocumentation
|
|
|
|
|
|
|
|
// structured is an experimental setting that returns a structured hover format.
|
|
|
|
// This format separates the signature from the documentation, so that the client
|
|
|
|
// can do more manipulation of these fields.
|
|
|
|
//
|
|
|
|
// This should only be used by clients that support this behavior.
|
|
|
|
Structured
|
|
|
|
)
|