internal/lsp: fix some incorrect spelling
Fix misspellings caught by github.com/client9/misspell/cmd/misspell.
Change-Id: I6e9cb858429bf0724453829693c36a99c481e88f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/272689
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/internal/event/core/event.go b/internal/event/core/event.go
index e37b494..a6cf0e6 100644
--- a/internal/event/core/event.go
+++ b/internal/event/core/event.go
@@ -12,7 +12,7 @@
"golang.org/x/tools/internal/event/label"
)
-// Event holds the information about an event of note that ocurred.
+// Event holds the information about an event of note that occurred.
type Event struct {
at time.Time
diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go
index 0faaacd..e611d62 100644
--- a/internal/lsp/cache/snapshot.go
+++ b/internal/lsp/cache/snapshot.go
@@ -191,7 +191,7 @@
s.view.optionsMu.Unlock()
// Forcibly disable GOPACKAGESDRIVER. It's incompatible with the
- // packagesinternal APIs we use, and we really only support the go commmand
+ // packagesinternal APIs we use, and we really only support the go command
// anyway.
env := append(append([]string{}, inv.Env...), "GOPACKAGESDRIVER=off")
cfg := &packages.Config{
@@ -1283,7 +1283,7 @@
}
result.ids[k] = ids
}
- // Copy the set of initally loaded packages.
+ // Copy the set of initially loaded packages.
for id, pkgPath := range s.workspacePackages {
// Packages with the id "command-line-arguments" are generated by the
// go command when the user is outside of GOPATH and outside of a
diff --git a/internal/lsp/diff/difftest/difftest.go b/internal/lsp/diff/difftest/difftest.go
index 513a925..c8a97fa 100644
--- a/internal/lsp/diff/difftest/difftest.go
+++ b/internal/lsp/diff/difftest/difftest.go
@@ -178,7 +178,7 @@
LineEdits: []diff.TextEdit{{Span: newSpan(2, 4), NewText: "C\n\n"}},
},
{
- Name: "mulitple_replace",
+ Name: "multiple_replace",
In: "A\nB\nC\nD\nE\nF\nG\n",
Out: "A\nH\nI\nJ\nE\nF\nK\n",
Unified: UnifiedPrefix + `
diff --git a/internal/lsp/general.go b/internal/lsp/general.go
index 558767b..b0099e3 100644
--- a/internal/lsp/general.go
+++ b/internal/lsp/general.go
@@ -141,7 +141,7 @@
s.stateMu.Lock()
if s.state >= serverInitialized {
defer s.stateMu.Unlock()
- return errors.Errorf("%w: initalized called while server in %v state", jsonrpc2.ErrInvalidRequest, s.state)
+ return errors.Errorf("%w: initialized called while server in %v state", jsonrpc2.ErrInvalidRequest, s.state)
}
s.state = serverInitialized
s.stateMu.Unlock()
diff --git a/internal/lsp/lsprpc/lsprpc.go b/internal/lsp/lsprpc/lsprpc.go
index dc3e29c..623533f 100644
--- a/internal/lsp/lsprpc/lsprpc.go
+++ b/internal/lsp/lsprpc/lsprpc.go
@@ -302,7 +302,7 @@
// the user.
event.Error(ctx, "unable to check daemon socket owner, failing open", err)
} else if !ok {
- // We succesfully checked that the socket is not owned by us, we fail
+ // We successfully checked that the socket is not owned by us, we fail
// closed.
return nil, fmt.Errorf("socket %q is owned by a different user", address)
}
diff --git a/internal/lsp/protocol/typescript/code.ts b/internal/lsp/protocol/typescript/code.ts
index 5eb081a..7509532 100644
--- a/internal/lsp/protocol/typescript/code.ts
+++ b/internal/lsp/protocol/typescript/code.ts
@@ -769,7 +769,7 @@
// some of the intersection types A&B are ok as struct{A;B;} and some
// could be expanded, and ClientCapabilites has to be expanded,
// at least for workspace. It's possible to check algorithmically,
-// but much simpler just to check explicity.
+// but much simpler just to check explicitly.
function goIntersectionType(n: ts.IntersectionTypeNode, nm: string): string {
if (nm == 'ClientCapabilities') return expandIntersection(n);
if (nm == 'ServerCapabilities') return expandIntersection(n);
diff --git a/internal/lsp/source/completion/completion.go b/internal/lsp/source/completion/completion.go
index b87154a..19fcb5f 100644
--- a/internal/lsp/source/completion/completion.go
+++ b/internal/lsp/source/completion/completion.go
@@ -699,7 +699,7 @@
}
// Then sort by label so order stays consistent. This also has the
- // effect of prefering shorter candidates.
+ // effect of preferring shorter candidates.
return c.items[i].Label < c.items[j].Label
})
}
@@ -1003,8 +1003,8 @@
c.setMatcherFromPrefix(c.surrounding.Prefix())
}
-// isValidIdentifierChar returns true if a byte is a valid go identifier character
-// i.e unicode letter or digit or undescore
+// isValidIdentifierChar returns true if a byte is a valid go identifier
+// character, i.e. unicode letter or digit or underscore.
func isValidIdentifierChar(char byte) bool {
charRune := rune(char)
return unicode.In(charRune, unicode.Letter, unicode.Digit) || char == '_'
diff --git a/internal/lsp/source/completion/printf.go b/internal/lsp/source/completion/printf.go
index c90a365..ce74af5 100644
--- a/internal/lsp/source/completion/printf.go
+++ b/internal/lsp/source/completion/printf.go
@@ -71,7 +71,7 @@
if kind == kindAny {
kind = v.kind
} else if v.kind != kindAny {
- // If mulitple verbs refer to the same operand, take the
+ // If multiple verbs refer to the same operand, take the
// intersection of their kinds.
kind &= v.kind
}
diff --git a/internal/lsp/source/extract.go b/internal/lsp/source/extract.go
index 4aee845..e163554 100644
--- a/internal/lsp/source/extract.go
+++ b/internal/lsp/source/extract.go
@@ -175,7 +175,7 @@
// It also replaces the selected block of code with a call to the extracted
// function. First, we manually adjust the selection range. We remove trailing
// and leading whitespace characters to ensure the range is precisely bounded
-// by AST nodes. Next, we determine the variables that will be the paramters
+// by AST nodes. Next, we determine the variables that will be the parameters
// and return values of the extracted function. Lastly, we construct the call
// of the function and insert this call as well as the extracted function into
// their proper locations.
@@ -197,7 +197,7 @@
// TODO: Support non-nested return statements.
// A return statement is non-nested if its parent node is equal to the parent node
- // of the first node in the selection. These cases must be handled seperately because
+ // of the first node in the selection. These cases must be handled separately because
// non-nested return statements are guaranteed to execute. Our control flow does not
// properly consider these situations yet.
var retStmts []*ast.ReturnStmt
@@ -248,7 +248,7 @@
// Some variables on the left-hand side of our assignment statement may be free. If our
// selection begins in the same scope in which the free variable is defined, we can
// redefine it in our assignment statement. See the following example, where 'b' and
- // 'err' (both free variables) can be redefined in the second funcCall() while maintaing
+ // 'err' (both free variables) can be redefined in the second funcCall() while maintaining
// correctness.
//
//
@@ -404,7 +404,7 @@
pkg, extractedBlock); err != nil {
return nil, err
}
- // Collect the additional return values and types needed to accomodate return
+ // Collect the additional return values and types needed to accommodate return
// statements in the selection. Update the type signature of the extracted
// function and construct the if statement that will be inserted in the enclosing
// function.
@@ -854,8 +854,8 @@
}, true, nil
}
-// objUsed checks if the object is used within the range. It returns the first occurence of
-// the object in the range, if it exists.
+// objUsed checks if the object is used within the range. It returns the first
+// occurrence of the object in the range, if it exists.
func objUsed(info *types.Info, rng span.Range, obj types.Object) (bool, *ast.Ident) {
var firstUse *ast.Ident
for id, objUse := range info.Uses {
diff --git a/internal/lsp/source/highlight.go b/internal/lsp/source/highlight.go
index d18a971..3af3f49 100644
--- a/internal/lsp/source/highlight.go
+++ b/internal/lsp/source/highlight.go
@@ -333,13 +333,13 @@
return
}
- // Find labeled branch statements in any loop
+ // Find labeled branch statements in any loop.
ast.Inspect(loop, func(n ast.Node) bool {
b, ok := n.(*ast.BranchStmt)
if !ok {
return true
}
- // Statment with labels that matches the loop.
+ // statement with labels that matches the loop
if b.Label != nil && labelDecl(b.Label) == loopLabel {
result[posRange{start: b.Pos(), end: b.End()}] = struct{}{}
}
diff --git a/internal/lsp/source/identifier_test.go b/internal/lsp/source/identifier_test.go
index f07e401..5e191e4 100644
--- a/internal/lsp/source/identifier_test.go
+++ b/internal/lsp/source/identifier_test.go
@@ -16,7 +16,7 @@
func TestSearchForEnclosing(t *testing.T) {
tests := []struct {
desc string
- // For convenience, consider the first occurence of the identifier "X" in
+ // For convenience, consider the first occurrence of the identifier "X" in
// src.
src string
// By convention, "" means no type found.
diff --git a/internal/lsp/testdata/keywords/accidental_keywords.go.in b/internal/lsp/testdata/keywords/accidental_keywords.go.in
index 711841c..3833081 100644
--- a/internal/lsp/testdata/keywords/accidental_keywords.go.in
+++ b/internal/lsp/testdata/keywords/accidental_keywords.go.in
@@ -4,7 +4,7 @@
var apple = "apple"
func _() {
- foo.bar() // insert some extra statements to excercise our AST surgery
+ foo.bar() // insert some extra statements to exercise our AST surgery
variance := 123 //@item(kwVariance, "variance", "int", "var")
foo.bar()
println(var) //@complete(")", kwVariance)
diff --git a/internal/lsp/tests/tests.go b/internal/lsp/tests/tests.go
index 2456c2f..05bd5ee 100644
--- a/internal/lsp/tests/tests.go
+++ b/internal/lsp/tests/tests.go
@@ -784,9 +784,9 @@
t.Run("Link", func(t *testing.T) {
t.Helper()
for uri, wantLinks := range data.Links {
- // If we are testing GOPATH, then we do not want links with
- // the versions attached (pkg.go.dev/repoa/moda@v1.1.0/pkg),
- // unless the file is a go.mod, then we can skip it alltogether.
+ // If we are testing GOPATH, then we do not want links with the versions
+ // attached (pkg.go.dev/repoa/moda@v1.1.0/pkg), unless the file is a
+ // go.mod, then we can skip it altogether.
if data.Exported.Exporter == packagestest.GOPATH {
if strings.HasSuffix(uri.Filename(), ".mod") {
continue