Skip to content

Commit

Permalink
Fix #91 Prevent infinite loop in semantic tokens if an instruction ha…
Browse files Browse the repository at this point in the history
…s an escape character

Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Sep 10, 2021
1 parent c248e14 commit 2bad66a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [Unreleased]
### Fixed
- prevent infinite loop when computing semantic tokens for a keyword with an escape character ([#91](https://github.com/rcjsuen/dockerfile-language-service/issues/91))

## [0.5.0] - 2021-09-01
### Added
- process heredoc syntax correctly when deciding what completion items to return for ADD and COPY ([#90](https://github.com/rcjsuen/dockerfile-language-service/issues/90))
Expand Down
37 changes: 30 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"node": "*"
},
"dependencies": {
"dockerfile-ast": "0.3.1",
"dockerfile-ast": "0.3.2",
"dockerfile-utils": "0.7.0",
"vscode-languageserver-types": "3.17.0-next.3"
},
Expand Down
7 changes: 7 additions & 0 deletions test/dockerSemanticTokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,13 @@ describe("Dockerfile Semantic Token tests", () => {
assertEdit(tokens.data, SemanticTokenTypes.keyword, 10, 1, 0, 2);
assertEdit(tokens.data, SemanticTokenTypes.class, 15, 0, 3, 6);
});

it("RU\\N\\nRUN", () => {
const tokens = computeSemanticTokens("RU\\N\nRUN");
assert.strictEqual(10, tokens.data.length);
assertEdit(tokens.data, SemanticTokenTypes.keyword, 0, 0, 0, 4);
assertEdit(tokens.data, SemanticTokenTypes.keyword, 5, 1, 0, 3);
});
});

describe("split arguments", () => {
Expand Down

0 comments on commit 2bad66a

Please sign in to comment.