mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
internal/lsp: add LocalPrefix configuration
Updates golang/go#32049 Change-Id: I64e5201170b5be8b470c436264e18e12ec8d12f2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/204820 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
6b7b8b79ae
commit
3c3d1ad199
3
internal/lsp/cache/view.go
vendored
3
internal/lsp/cache/view.go
vendored
@ -185,7 +185,8 @@ func (v *view) buildProcessEnv(ctx context.Context) (*imports.ProcessEnv, error)
|
||||
Logf: func(format string, args ...interface{}) {
|
||||
log.Print(ctx, fmt.Sprintf(format, args...))
|
||||
},
|
||||
Debug: true,
|
||||
LocalPrefix: v.options.LocalPrefix,
|
||||
Debug: true,
|
||||
}
|
||||
for _, kv := range cfg.Env {
|
||||
split := strings.Split(kv, "=")
|
||||
|
@ -105,6 +105,9 @@ type Options struct {
|
||||
ComputeEdits diff.ComputeEdits
|
||||
|
||||
Analyzers []*analysis.Analyzer
|
||||
|
||||
// LocalPrefix is used to specify goimports's -local behavior.
|
||||
LocalPrefix string
|
||||
}
|
||||
|
||||
type CompletionOptions struct {
|
||||
@ -243,7 +246,7 @@ func (o *Options) set(name string, value interface{}) OptionResult {
|
||||
case "hoverKind":
|
||||
hoverKind, ok := value.(string)
|
||||
if !ok {
|
||||
result.errorf("Invalid type %T for string option %q", value, name)
|
||||
result.errorf("invalid type %T for string option %q", value, name)
|
||||
break
|
||||
}
|
||||
switch hoverKind {
|
||||
@ -278,6 +281,14 @@ func (o *Options) set(name string, value interface{}) OptionResult {
|
||||
case "go-diff":
|
||||
result.setBool(&o.GoDiff)
|
||||
|
||||
case "local":
|
||||
localPrefix, ok := value.(string)
|
||||
if !ok {
|
||||
result.errorf("invalid type %T for string option %q", value, name)
|
||||
break
|
||||
}
|
||||
o.LocalPrefix = localPrefix
|
||||
|
||||
// Deprecated settings.
|
||||
case "wantSuggestedFixes":
|
||||
result.State = OptionDeprecated
|
||||
|
Loading…
x
Reference in New Issue
Block a user