Skip to content

Commit

Permalink
gopls: recognize the go.work file type
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
findleyr committed Feb 4, 2022
1 parent 962260a commit 8305295
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/lsp/cache/view.go
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions internal/lsp/source/util.go
Expand Up @@ -173,6 +173,8 @@ func FileKindForLang(langID string) FileKind {
return Sum
case "tmpl", "gotmpl":
return Tmpl
case "go.work":
return Work
default:
return UnknownKind
}
Expand All @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/lsp/source/view.go
Expand Up @@ -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
Expand Down

0 comments on commit 8305295

Please sign in to comment.