mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
internal/lsp: fix merge conflict and race condition
Race condition: I deleted the code that acquired the mutex when checking if a file's imports have changed. Merge conflict: I submitted a change without rebasing and re-running TryBots. Change-Id: Iae351f2fff893cfd94db79d9f79578d9827a8c21 Reviewed-on: https://go-review.googlesource.com/c/tools/+/197297 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
9c4a82ab32
commit
125cfdbd7b
3
internal/lsp/cache/load.go
vendored
3
internal/lsp/cache/load.go
vendored
@ -136,6 +136,9 @@ func (v *view) checkMetadata(ctx context.Context, f *goFile, fh source.FileHandl
|
|||||||
// determine if they have changed.
|
// determine if they have changed.
|
||||||
// It assumes that the caller holds the lock on the f.mu lock.
|
// It assumes that the caller holds the lock on the f.mu lock.
|
||||||
func (v *view) shouldRunGopackages(ctx context.Context, f *goFile, file *ast.File, metadata []*metadata) bool {
|
func (v *view) shouldRunGopackages(ctx context.Context, f *goFile, file *ast.File, metadata []*metadata) bool {
|
||||||
|
f.mu.Lock()
|
||||||
|
defer f.mu.Unlock()
|
||||||
|
|
||||||
// Check if the package's name has changed, by checking if this is a filename
|
// Check if the package's name has changed, by checking if this is a filename
|
||||||
// we already know about, and if so, check if its package name has changed.
|
// we already know about, and if so, check if its package name has changed.
|
||||||
for _, m := range metadata {
|
for _, m := range metadata {
|
||||||
|
@ -284,7 +284,7 @@ func (c *completer) basicLiteral(T types.Type, typeName string, matchScore float
|
|||||||
InsertText: nonSnippet,
|
InsertText: nonSnippet,
|
||||||
Detail: T.String(),
|
Detail: T.String(),
|
||||||
Score: matchScore * literalCandidateScore,
|
Score: matchScore * literalCandidateScore,
|
||||||
Kind: VariableCompletionItem,
|
Kind: protocol.VariableCompletion,
|
||||||
snippet: snip,
|
snippet: snip,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user