rcjsuen / dockerfile-language-service

Dockerfile language service for providing an API to create feature-rich Dockerfile editors in JavaScript.
MIT License
16 stars 2 forks source link

Parse heredoc syntax for ADD and COPY when calculating completion items #90

Closed rcjsuen closed 2 years ago

rcjsuen commented 2 years ago

There is still the file2 heredoc to process so we should not be prompting any completion items. We should include ADD and COPY in our heredoc support.

ADD a.txt <<file b.txt <<file2 /destination/
abc
file
COPY a.txt <<file b.txt <<file2 /destination/
abc
file
const lib = require("dockerfile-language-service");
const service = lib.DockerfileLanguageServiceFactory.createLanguageService();
console.log(service.computeCompletionItems("ADD a.txt <<file b.txt <<file2 /destination/\nabc\nfile\n", { line: 3, character: 0 }).length);
console.log(service.computeCompletionItems("COPY a.txt <<file b.txt <<file2 /destination/\nabc\nfile\n", { line: 3, character: 0 }).length);
19
19