3 ms·
To add to the correct IntelliJ answer: VSCode, on the other hand, does not allow for multiple language services or servers to handle the same file at the same t
by phil294 3y ago
To add to the correct IntelliJ answer: VSCode, on the other hand, does not allow for multiple language services or servers to handle the same file at the same time. Instead, any language support (always by means of extension, either built-in or external) has to individually add support for embedded languages, either using language services or request forwarding [1]. For example, the built-in HTML plugin includes JS support inside <script/> tags by simply spinning up its own tsserver [2].
This seems to have been a design decision from the very start, but I have a hard time understanding why. It seems like a conceptual mistake to me. It also eats up system resources like crazy, but that's a lost cause anyway. Instead of harnessing the capabilities of existing implementations, every "wrapper" kind of language needs to build its own solution, which leads to these solutions often not being great. For example, said HTML/JS solution has issues with external dependencies [3]. Or, I've been trying to enable support for CoffeeScript or Elm inside Vue Single File Component files, but I couldn't so far, even though I'm the author of the CoffeeScript extension. [4][5]
Any source file always has exactly one language type assigned to it (possibly auto-detected), so no, dynamically "switching" is not possible without manually changing it for the entire file. For things like SQL inside PHP, Jetbrains products really are superior.
[1] https://code.visualstudio.com/api/language-extensions/embedded-languages https://code.visualstudio.com/api/language-extensions/embedd...
[2] https://github.com/microsoft/vscode/blob/7fd6f1b1d46bd2223a902406fccd20cc7a539825/extensions/html-language-features/server/src/modes/javascriptMode.ts https://github.com/microsoft/vscode/blob/7fd6f1b1d46bd2223a9...
[3] https://github.com/microsoft/vscode/issues/26338 https://github.com/microsoft/vscode/issues/26338
[4] https://github.com/vuejs/language-tools/issues/3200 https://github.com/vuejs/language-tools/issues/3200
[5] https://github.com/vuejs/vetur/issues/1184 https://github.com/vuejs/vetur/issues/1184
- ComputerGuru 3y agoI just want to say thanks for taking the time out to answer with technical attention and thoroughness!
- deleted 3y ago[deleted]