gopls: recognize the go.work file type

For golang/go#50930

Change-Id: I5bae56853f1e913fccd559d2a553ced4200bcb35
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382237
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Findley 2022-02-01 12:04:17 -05:00
parent 962260a678
commit 8305295d5d
3 changed files with 8 additions and 0 deletions

View File

@ -247,6 +247,8 @@ func (v *View) FileKind(fh source.FileHandle) source.FileKind {
return source.Mod
case ".sum":
return source.Sum
case ".work":
return source.Work
}
exts := v.Options().TemplateExtensions
for _, ext := range exts {

View File

@ -173,6 +173,8 @@ func FileKindForLang(langID string) FileKind {
return Sum
case "tmpl", "gotmpl":
return Tmpl
case "go.work":
return Work
default:
return UnknownKind
}
@ -188,6 +190,8 @@ func (k FileKind) String() string {
return "go.sum"
case Tmpl:
return "tmpl"
case Work:
return "go.work"
default:
return fmt.Sprintf("unk%d", k)
}

View File

@ -534,6 +534,8 @@ const (
Sum
// Tmpl is a template file.
Tmpl
// Work is a go.work file.
Work
)
// Analyzer represents a go/analysis analyzer with some boolean properties