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

Collision with Typescript formatter #11

Closed st-schneider closed 4 months ago

st-schneider commented 5 years ago

Issue Type: Bug

It seems like there is some problem with formatting with literally active while typescript formatter is as well.

<syntax>
TypeScript Server Error (3.6.3) Cannot read property 'getSourceFile' of undefined
TypeError: Cannot read property 'getSourceFile' of undefined
  at StandardScriptSourceHelper.getAllNodes (~/.vscode-insiders/extensions/webreflection.literally-html-0.1.1/node_modules/typescript-template-language-service-decorator/lib/standard-script-source-helper.js:16:50)
  at StandardTemplateSourceHelper.getAllTemplates (~/.vscode-insiders/extensions/webreflection.literally-html-0.1.1/node_modules/typescript-template-language-service-decorator/lib/standard-template-source-helper.js:95:43)
  at Object.getFormattingEditsForRange (~/.vscode-insiders/extensions/webreflection.literally-html-0.1.1/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:114:54)
  at IOSession.Session.getFormattingEditsForRange (tsserver.js:134666:45)
  at Session.handlers.ts.createMapFromTemplate._a.(anonymous ...

VS Code version: Code - Insiders 1.39.0-insider (c8252b63f547674d2faf361d4181bb76b0b5f81a, 2019-10-04T09:23:20.797Z) OS version: Darwin x64 17.7.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (8 x 2800)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|3, 2, 2| |Memory (System)|16.00GB (2.30GB free)| |Process Argv|-psn_0_94231| |Screen Reader|no| |VM|0%|
Extensions (67) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|2.0.5 cucumberautocomplete|ale|2.14.1 cypress-snippets|and|1.2.0 atlascode|atl|2.0.4 vscode-custom-css|be5|3.0.8 color-info|bie|0.5.1 markdown-mermaid|bie|1.2.0 mermaid-markdown-syntax-highlighting|bpr|1.0.1 better-toml|bun|0.3.2 twigcs|cer|1.1.0 path-intellisense|chr|1.4.2 scss-grammar-extended|dan|1.0.0 vscode-eslint|dba|1.9.1 hsnips|dra|0.0.15 eslint-disable-snippets|drK|1.2.0 gitlens|eam|10.1.0 EditorConfig|Edi|0.13.0 file-icons|fil|1.0.19 vscode-firefox-debug|fir|2.3.4 vscode-architect|gil|0.1.0 vscode-pull-request-github|Git|0.12.0 sass-lint|gle|1.0.6 todo-tree|Gru|0.0.158 beautify|Hoo|1.5.0 rest-client|hum|0.22.2 output-colorizer|IBM|0.1.2 smarty|imp|0.3.0 svelte-vscode|Jam|0.9.3 plantuml|jeb|2.12.1 polacode-2019|jef|0.5.1 browsersync|jer|2.1.0 vscode-peacock|joh|3.1.5 vscode-commitizen|Kni|0.8.3 twig-language-2|mbl|0.8.10 plantumlpreviewer|Meb|0.6.0 git-graph|mhu|1.17.0 auto-barrel|mik|1.6.5 dotenv|mik|1.0.1 vscode-docker|ms-|0.8.1 remote-containers|ms-|0.81.0 remote-ssh|ms-|0.46.1 remote-ssh-edit|ms-|0.46.1 remote-ssh-explorer|ms-|0.46.1 vscode-remote-extensionpack|ms-|0.17.0 references-view|ms-|0.0.30 debugger-for-chrome|msj|4.12.0 ts-prop-dag|nat|1.0.6 vscode-versionlens|pfl|0.24.0 rpa-eslint-snippets|rav|0.0.2 vscode-yaml|red|0.5.3 explorer-exclude-vscode-extension|Red|1.2.0 elastic|ria|0.13.3 preview-vscode|sea|2.0.3 code-settings-sync|Sha|3.4.3 vscode-barreler|shi|0.0.1 sourcegraph|sou|1.0.14 cucumber|ste|0.12.0 gif-code-snippet|sub|1.0.2 vscode-mermaid-editor|tom|0.4.3 vscodeintellicode|Vis|1.1.9 vscode-icons|vsc|9.4.0 snippet|vsc|0.7.0 vim|vsc|1.11.0 vscode-mermaid-preview|vst|1.2.0 quokka-vscode|Wal|1.0.254 literally-html|web|0.1.1 highlight-bad-chars|wen|0.0.3 (1 theme extensions excluded)
WebReflection commented 5 years ago

I'm afraid I don't typescript, so I wouldn't know how to solve ...any help welcoy

st-schneider commented 5 years ago

Actually it is a javascript file with no typescript but using the Typescript and Javascript language feature formatter.

WebReflection commented 5 years ago

Yeah, I don't typescript in general 😅

aihkas commented 4 years ago

Have been facing the same issue for a while now, couldn't format any jsx or js unless literally html was disabled. Trying out the nightly version of the typescript/javascript language support with ext install ms-vscode.vscode-typescript-next or reverting to an older version of literally html didn't help, so there might be something else at play.

It seems like there is some problem with formatting with literally active while typescript formatter is as well.

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