Skip to content

Commit

Permalink
resolve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xzbdmw committed Dec 16, 2024
1 parent 1ff997d commit cfe58a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gopls/internal/golang/highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Highlight(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, po
}
}
}
result, err := highlightPath(path, pgf.File, pkg.TypesInfo(), pos)
result, err := highlightPath(pkg.TypesInfo(), path, pos)
if err != nil {
return nil, err
}
Expand All @@ -71,9 +71,8 @@ func Highlight(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, po

// highlightPath returns ranges to highlight for the given enclosing path,
// which should be the result of astutil.PathEnclosingInterval.
func highlightPath(path []ast.Node, file *ast.File, info *types.Info, pos token.Pos) (map[posRange]protocol.DocumentHighlightKind, error) {
func highlightPath(info *types.Info, path []ast.Node, pos token.Pos) (map[posRange]protocol.DocumentHighlightKind, error) {
result := make(map[posRange]protocol.DocumentHighlightKind)

// Inside a printf-style call, printf("...%v...", arg)?
// Treat each corresponding ("%v", arg) pair as a highlight class.
for _, node := range path {
Expand All @@ -88,6 +87,7 @@ func highlightPath(path []ast.Node, file *ast.File, info *types.Info, pos token.
}
}

file := path[len(path)-1].(*ast.File)
switch node := path[0].(type) {
case *ast.BasicLit:
// Import path string literal?
Expand Down
2 changes: 0 additions & 2 deletions internal/fmtstr/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
package fmtstr

import (
_ "embed"
"fmt"
"go/ast"
"go/constant"
"go/types"
"strconv"
"strings"
"unicode/utf8"
// "golang.org/x/tools/go/analysis/passes/internal/analysisutil"
)

// ParsePrintf takes a printf-like call expression,
Expand Down

0 comments on commit cfe58a6

Please sign in to comment.