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

Invalid hover request outside the range of the document causes an exception #22

Closed rcjsuen closed 6 years ago

rcjsuen commented 6 years ago
import { ValidationSeverity } from 'dockerfile-utils';
import { DockerfileLanguageServiceFactory } from '../src/main';

const file = `from node`;
const service = DockerfileLanguageServiceFactory.createLanguageService();
service.computeHover(file, { line: 1, character: 2});
dockerHover.js:108
        for (let instruction of image.getInstructions()) {
                                      ^

TypeError: Cannot read property 'getInstructions' of null
    at DockerHover.computeHoverKey (dockerHover.js:108:39)
    at DockerHover.onHover (dockerHover.js:19:24)
    at LanguageService.computeHover (languageService.js:63:28)
    at Object.<anonymous> (bug.js:6:26)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)