Skip to content

Commit 9a48e61

Browse files
committed
fix: lsp multiline block comments
1 parent 9aabd4b commit 9a48e61

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## v0.0.14-next
44

55
- lsp: fix jump to definition
6+
- lsp: fix multiline block comments
67

78
## v0.0.13
89

langsrv/handler-text-document-semantic-tokens-full.go

+21-7
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,27 @@ func textDocumentSemanticTokensFull(context *glsp.Context, params *protocol.Sema
9999
continue
100100
}
101101
tokenModifiers := tokenModifiersForCaptureName(captureName)
102-
tokens = append(tokens, highlightedToken{
103-
line: uint32(capturedNode.StartPoint().Row),
104-
column: uint32(capturedNode.StartPoint().Column),
105-
length: capturedNode.EndByte() - capturedNode.StartByte(),
106-
tokenType: *tokenType,
107-
tokenModifiers: tokenModifiers,
108-
})
102+
column := uint32(capturedNode.StartPoint().Column)
103+
for row := uint32(capturedNode.StartPoint().Row); row <= capturedNode.EndPoint().Row; row++ {
104+
if row == capturedNode.EndPoint().Row {
105+
tokens = append(tokens, highlightedToken{
106+
line: row,
107+
column: column,
108+
length: capturedNode.EndPoint().Column,
109+
tokenType: *tokenType,
110+
tokenModifiers: tokenModifiers,
111+
})
112+
} else {
113+
tokens = append(tokens, highlightedToken{
114+
line: row,
115+
column: column,
116+
length: capturedNode.EndByte() - capturedNode.StartByte(),
117+
tokenType: *tokenType,
118+
tokenModifiers: tokenModifiers,
119+
})
120+
column = 0
121+
}
122+
}
109123
}
110124
}
111125
return &protocol.SemanticTokens{

0 commit comments

Comments
 (0)