@@ -21,7 +21,7 @@ func (l *LanguageService) ProvideDocumentHighlights(ctx context.Context, documen
21
21
node := astnav .GetTouchingPropertyName (sourceFile , position )
22
22
23
23
if node .Parent .Kind == ast .KindJsxOpeningElement || (node .Parent .Kind == ast .KindJsxClosingElement && node .Parent .TagName () == node ) {
24
- documentHighlights := []* lsproto.DocumentHighlight {}
24
+ var documentHighlights []* lsproto.DocumentHighlight
25
25
kind := lsproto .DocumentHighlightKindRead
26
26
if node .Parent .Kind == ast .KindJsxOpeningElement {
27
27
documentHighlights = append (documentHighlights , & lsproto.DocumentHighlight {
@@ -41,7 +41,7 @@ func (l *LanguageService) ProvideDocumentHighlights(ctx context.Context, documen
41
41
}
42
42
43
43
documentHighlights := l .getSemanticDocumentHighlights (ctx , position , node , program , sourceFile )
44
- if documentHighlights == nil {
44
+ if len ( documentHighlights ) == 0 {
45
45
documentHighlights = l .getSyntacticDocumentHighlights (node , sourceFile )
46
46
}
47
47
// if nil is passed here we never generate an error, just pass an empty higlight
@@ -173,7 +173,7 @@ func (l *LanguageService) highlightSpans(nodes []*ast.Node, sourceFile *ast.Sour
173
173
174
174
func (l * LanguageService ) getFromAllDeclarations (nodeTest func (* ast.Node ) bool , keywords []ast.Kind , node * ast.Node , sourceFile * ast.SourceFile ) []* lsproto.DocumentHighlight {
175
175
return l .useParent (node .Parent , nodeTest , func (decl * ast.Node , sf * ast.SourceFile ) []* ast.Node {
176
- symbolDecls := []* ast.Node {}
176
+ var symbolDecls []* ast.Node
177
177
if ast .CanHaveSymbol (decl ) {
178
178
symbol := decl .Symbol ()
179
179
if ast .CanHaveSymbol (decl ) && symbol != nil && symbol .Declarations != nil {
0 commit comments