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

Improve semantic tokens for variables by splitting it up into more tokens #100

Closed rcjsuen closed 2 years ago

rcjsuen commented 2 years ago
RUN ${var:+word}
const lib = require("dockerfile-language-service");
const service = lib.DockerfileLanguageServiceFactory.createLanguageService();
const tokens = service.computeSemanticTokens("RUN ${var:+word}");
console.log(tokens.data.length);
10

At the moment, 10 is printed which implies there are two tokens (each taking up five numbers in the array) with the RUN instruction as one token and ${var:+word} as one token. We should split the one variable token into five separate tokens like so: