WebReflection / vscode-literally-html

Adds syntax highlighting for html inside of JavaScript and TypeScript tagged template strings
https://marketplace.visualstudio.com/items?itemName=webreflection.literally-html
MIT License
34 stars 6 forks source link

error when trying to use code formatter #16

Closed prof7bit closed 4 months ago

prof7bit commented 3 years ago

When the literally-html extension is installed and I try to invoke the default built in code formatter of vscode

    "[javascript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },
}

then the following error is shown when I press ctrl+shift+I:

<syntax> TypeScript Server Error (3.9.6)
Cannot read property 'getSourceFile' of undefined
TypeError: Cannot read property 'getSourceFile' of undefined
    at StandardScriptSourceHelper.getAllNodes (/home/bernd/.vscode/extensions/webreflection.literally-html-0.1.3/node_modules/typescript-template-language-service-decorator/lib/standard-script-source-helper.js:16:50)
    at StandardTemplateSourceHelper.getAllTemplates (/home/bernd/.vscode/extensions/webreflection.literally-html-0.1.3/node_modules/typescript-template-language-service-decorator/lib/standard-template-source-helper.js:149:43)
    at Proxy.<anonymous> (/home/bernd/.vscode/extensions/webreflection.literally-html-0.1.3/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:125:54)
    at IOSession.Session.getFormattingEditsForRange (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:148901:45)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:147898:61)
    at /usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:149553:88
    at IOSession.Session.executeWithRequestId (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:149544:28)
    at IOSession.Session.executeCommand (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:149553:33)
    at IOSession.Session.onMessage (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:149577:35)
    at Interface.<anonymous> (/usr/share/code/resources/app/extensions/node_modules/typescript/lib/tsserver.js:150893:27)
    at Interface.emit (events.js:203:13)
    at Interface._onLine (readline.js:316:10)
    at Interface._normalWrite (readline.js:461:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:203:13)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

I assume it has to do with literally-html because:

Additional info:

WebReflection commented 4 months ago

Added a WARNING in the README with suggested alternatives: https://github.com/WebReflection/vscode-literally-html/tree/master?tab=readme-ov-file#warning