Skip to content

Commit

Permalink
Fix #269 Consider the default variable value in FROM
Browse files Browse the repository at this point in the history
Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Jun 19, 2024
1 parent 5e94b77 commit 88a0b2c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [Unreleased]
### Fixed
- textDocument/publishDiagnostics
- consider default value of a variable when determining if FROM is invalid or not ([#269](https://github.com/rcjsuen/dockerfile-language-server/issues/269))

## [0.12.0] - 2024-05-23
### Added
- textDocument/definition
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"node": "*"
},
"dependencies": {
"dockerfile-language-service": "0.13.0",
"dockerfile-utils": "0.16.0",
"dockerfile-language-service": "0.14.0",
"dockerfile-utils": "0.16.1",
"vscode-languageserver": "~8.0.0",
"vscode-languageserver-textdocument": "~1.0.8"
},
Expand Down
30 changes: 30 additions & 0 deletions test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,36 @@ describe("Dockerfile LSP Tests", function() {
});
});

it("issue #269", (finished) => {
this.timeout(5000);

const documentURI = "uri://dockerfile/269.txt";
const diagnosticsListener = (json) => {
if (json.method === "textDocument/publishDiagnostics") {
if (json.params.uri === documentURI) {
lspProcess.removeListener("message", diagnosticsListener);
sendNotification("textDocument/didClose", {
textDocument: {
uri: documentURI,
}
});
assert.strictEqual(json.params.diagnostics.length, 0);
finished();
}
}
};
lspProcess.on("message", diagnosticsListener);

sendNotification("textDocument/didOpen", {
textDocument: {
languageId: "dockerfile",
version: 1,
uri: documentURI,
text: "FROM ${VAR:-alpine}"
}
});
});

after(() => {
// terminate the forked LSP process after all the tests have been run
lspProcess.kill();
Expand Down

0 comments on commit 88a0b2c

Please sign in to comment.