Skip to content

Commit 7974d59

Browse files
committed
Merge branch dev into published
2 parents af1b677 + a1e7ae8 commit 7974d59

6 files changed

Lines changed: 38 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changes to Calva.
44

55
## [Unreleased]
66

7+
## [2.0.538] - 2025-10-19
8+
9+
- Fix: [Semantic tokens fail on some input with ignored forms](https://github.com/BetterThanTomorrow/calva/issues/2956)
10+
711
## [2.0.537] - 2025-10-15
812

913
- [Add "Wrap Around #{}" paredit command](https://github.com/BetterThanTomorrow/calva/issues/2949)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Calva: Clojure & ClojureScript Interactive Programming",
44
"description": "Integrated REPL, formatter, Paredit, and more. Powered by cider-nrepl and clojure-lsp.",
55
"icon": "assets/calva.png",
6-
"version": "2.0.537",
6+
"version": "2.0.538",
77
"publisher": "betterthantomorrow",
88
"author": {
99
"name": "Better Than Tomorrow",

src/extension-test/unit/lsp/semantic-token-filter-test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,4 +392,28 @@ describe('Semantic token filtering', () => {
392392
0, // [foo] preserved relative
393393
]);
394394
});
395+
it('handles comment as first token with delta accumulation', () => {
396+
// Two tokens: first is a comment (type 10), second is not (type 0)
397+
// Should remove the comment and accumulate its deltaLine (3) into token 2's deltaLine (2)
398+
const input = [
399+
3, // Token 1: deltaLine
400+
0, // Token 1: deltaStart
401+
4, // Token 1: length
402+
10, // Token 1: tokenType (comment)
403+
0, // Token 1: modifiers
404+
2, // Token 2: deltaLine
405+
4, // Token 2: deltaStart
406+
3, // Token 2: length
407+
0, // Token 2: tokenType (namespace)
408+
0, // Token 2: modifiers
409+
];
410+
const expected = [
411+
5, // deltaLine (3 + 2, accumulated from removed comment)
412+
4, // deltaStart
413+
3, // length
414+
0, // tokenType
415+
0, // modifiers
416+
];
417+
expect(filterCommentTokens(new Uint32Array(input), 10)).toEqual(expected);
418+
});
395419
});

src/lsp/client/semantic-token-filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function filterCommentTokens(data: Uint32Array, remove: number) {
1717
}
1818

1919
filteredData.push(
20-
filteredData.length === 0 ? deltaLine : deltaLine + accumulatedDeltaLine,
20+
accumulatedDeltaLine === 0 ? deltaLine : deltaLine + accumulatedDeltaLine,
2121
deltaStart,
2222
length,
2323
tokenType,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
;
2+
;
3+
; 0123456789
4+
#_()
5+
;
6+
(ns foo)

0 commit comments

Comments
 (0)