Skip to content

Commit

Permalink
Fix forwardSexp function for metadata skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
sashton committed Jan 12, 2022
1 parent 44a17b5 commit a6dcca1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changes to Calva.
## [Unreleased]

- [Improve LSP startup feedback on status bar](https://github.com/BetterThanTomorrow/calva/pull/1454)
- Fix: [Snippet in custom command doesn't work with function metadata] (https://github.com/BetterThanTomorrow/calva/issues/1463)

## [2.0.233] - 2022-01-07
- [Add experimental support for Test Explorer](https://github.com/BetterThanTomorrow/calva/issues/953)
Expand Down
11 changes: 10 additions & 1 deletion src/cursor-doc/token-cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export class LispTokenCursor extends TokenCursor {
if (this.getToken().type === 'close') {
return false;
}
const initialToken = this.getToken();
if (this.tokenBeginsMetadata()) {
isMetadata = true;
}
Expand Down Expand Up @@ -258,7 +259,15 @@ export class LispTokenCursor extends TokenCursor {
if (skipMetadata && this.getToken().raw.startsWith('^')) {
this.next();
} else {
this.next();
this.forwardWhitespace(skipComments);
// If the cursor is still pointed at the original token,
// or if the cursor is inside a nested sexp, move the cursor forward by one.
// Otherwise, the cursor has already moved past
// the original token, and should not be moved again
// for this invocation of forwardSexp.
if (token == initialToken || stack.length > 0) {
this.next();
}
if (stack.length <= 0) {
return true;
}
Expand Down

0 comments on commit a6dcca1

Please sign in to comment.