Skip to content

Commit 125cfdb

Browse files
committed
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 <[email protected]> Reviewed-by: Ian Cottrell <[email protected]>
1 parent 9c4a82a commit 125cfdb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/lsp/cache/load.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ func (v *view) checkMetadata(ctx context.Context, f *goFile, fh source.FileHandl
136136
// determine if they have changed.
137137
// It assumes that the caller holds the lock on the f.mu lock.
138138
func (v *view) shouldRunGopackages(ctx context.Context, f *goFile, file *ast.File, metadata []*metadata) bool {
139+
f.mu.Lock()
140+
defer f.mu.Unlock()
141+
139142
// Check if the package's name has changed, by checking if this is a filename
140143
// we already know about, and if so, check if its package name has changed.
141144
for _, m := range metadata {

internal/lsp/source/completion_literal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func (c *completer) basicLiteral(T types.Type, typeName string, matchScore float
284284
InsertText: nonSnippet,
285285
Detail: T.String(),
286286
Score: matchScore * literalCandidateScore,
287-
Kind: VariableCompletionItem,
287+
Kind: protocol.VariableCompletion,
288288
snippet: snip,
289289
})
290290
}

0 commit comments

Comments
 (0)