mirror of
https://github.com/golang/go
synced 2024-11-18 21:54:49 -07:00
3d22a3cfff
We now wait to build views until we have the options for that view, and pass the options in to the view constructor. The environment and build flags are now part of the view options. Change-Id: I303c8ba1eefd01b66962ba9cadb4847d3d2e1d3b Reviewed-on: https://go-review.googlesource.com/c/tools/+/194278 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
92 lines
2.2 KiB
Go
92 lines
2.2 KiB
Go
// 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
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/tools/internal/lsp/protocol"
|
|
)
|
|
|
|
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,
|
|
Deep: true,
|
|
FuzzyMatching: true,
|
|
},
|
|
DefaultViewOptions: ViewOptions{
|
|
Env: os.Environ(),
|
|
},
|
|
}
|
|
)
|
|
|
|
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
|
|
|
|
DefaultViewOptions ViewOptions
|
|
}
|
|
|
|
type ViewOptions struct {
|
|
// 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
|
|
}
|
|
|
|
type CompletionOptions struct {
|
|
Deep bool
|
|
FuzzyMatching bool
|
|
Unimported bool
|
|
Documentation bool
|
|
FullDocumentation bool
|
|
Placeholders bool
|
|
}
|
|
|
|
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
|
|
)
|