Skip to content

Commit

Permalink
Merge pull request #664 from BetterThanTomorrow/fix/var_quote_lexing
Browse files Browse the repository at this point in the history
Fix higlight of var quote before open token
  • Loading branch information
bpringe authored Jun 5, 2020
2 parents 95ef693 + 09e07bd commit 646b7c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Changes to Calva.

## [Unreleased]
- Fix [Stream output messages to Calva Says as they're received](https://github.com/BetterThanTomorrow/calva/pull/662)
- Fix [Stream output messages to Calva Says as they're received](https://github.com/BetterThanTomorrow/calva/issues/638)
- Fix [highlighting of var quote before open token](https://github.com/BetterThanTomorrow/calva/issues/663)

## [2.0.102] - 2020-06-04
- Fix [Format Document sometimes causes Calva to stop working](https://github.com/BetterThanTomorrow/calva/issues/651)
Expand Down
2 changes: 1 addition & 1 deletion src/cursor-doc/clojure-lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ toplevel.terminal(/;.*/, (l, m) => ({ type: "comment" }))
// (#[^\(\)\[\]\{\}"_@~\s,]+[\s,]*)*

// open parens
toplevel.terminal(/(#[^\(\)\[\]\{\}"_@~\s,]+[\s,]*)*((?<=(^|[\(\)\[\]\{\}\s,]))['`~#@?^]\s*)*['`~#@?^]*[\(\[\{"]/, (l, m) => ({ type: "open" }))
toplevel.terminal(/(#[^\(\)\[\]\{\}'"_@~\s,]+[\s,]*)*((?<=(^|[\(\)\[\]\{\}\s,]))['`~#@?^]\s*)*['`~#@?^]*[\(\[\{"]/, (l, m) => ({ type: "open" }))
// close parens
toplevel.terminal(/\)|\]|\}/, (l, m) => ({ type: "close" }))

Expand Down
11 changes: 11 additions & 0 deletions src/extension-test/unit/cursor-doc/clojure-lexer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ describe('Scanner', () => {
expect(tokens[2].type).equals('close');
expect(tokens[2].raw).equals(')');
});
it('does not treat var quote plus open token as reader tag plus open token', () => {
const tokens = scanner.processLine("#'foo []")
expect(tokens[0].type).equals('id');
expect(tokens[0].raw).equals("#'foo");
expect(tokens[1].type).equals('ws');
expect(tokens[1].raw).equals(' ');
expect(tokens[2].type).equals('open');
expect(tokens[2].raw).equals('[');
expect(tokens[3].type).equals('close');
expect(tokens[3].raw).equals(']');
});
});
describe('strings', () => {
it('tokenizes words in strings', () => {
Expand Down

0 comments on commit 646b7c7

Please sign in to comment.