mirror of
https://github.com/golang/go
synced 2024-11-18 16:04:44 -07:00
internal/lsp: stop requiring a .go extension for all Go files
This change should fix the TryBot failures exposed by https://golang.org/cl/181317. Updates golang/go#31561 Change-Id: Ie77c9e3bfd6825dcd2608523e72f804f81d3f48c Reviewed-on: https://go-review.googlesource.com/c/tools/+/181546 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
4bfb4c74ac
commit
ff694a2184
22
internal/lsp/cache/view.go
vendored
22
internal/lsp/cache/view.go
vendored
@ -6,7 +6,6 @@ package cache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/types"
|
||||
@ -314,16 +313,6 @@ func (v *view) getFile(uri span.URI) (viewFile, error) {
|
||||
filename := uri.Filename()
|
||||
var f viewFile
|
||||
switch ext := filepath.Ext(filename); ext {
|
||||
case ".go":
|
||||
f = &goFile{
|
||||
fileBase: fileBase{
|
||||
view: v,
|
||||
fname: filename,
|
||||
},
|
||||
}
|
||||
v.session.filesWatchMap.Watch(uri, func() {
|
||||
f.(*goFile).invalidateContent()
|
||||
})
|
||||
case ".mod":
|
||||
f = &modFile{
|
||||
fileBase: fileBase{
|
||||
@ -339,7 +328,16 @@ func (v *view) getFile(uri span.URI) (viewFile, error) {
|
||||
},
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported file extension: %s", ext)
|
||||
// Assume that all other files are Go files, regardless of extension.
|
||||
f = &goFile{
|
||||
fileBase: fileBase{
|
||||
view: v,
|
||||
fname: filename,
|
||||
},
|
||||
}
|
||||
v.session.filesWatchMap.Watch(uri, func() {
|
||||
f.(*goFile).invalidateContent()
|
||||
})
|
||||
}
|
||||
v.mapFile(uri, f)
|
||||
return f, nil
|
||||
|
Loading…
Reference in New Issue
Block a user