You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use createAsyncLanguageServicePlugin to develop the VS Code extension (vscode-css-modules) and TypeScript Language Service Plugin (typescript-plugin-css-modules) for CSS Modules.
vscode-css-modules makes tsserver load typescript-plugin-css-modules by setting contributes.typescriptServerPlugins. It also sets activationEvents so that tsserver starts when the CSS file is opened. In addition, disable VS Code's built-in CSS extension (vscode.css-language-features) so that it do not conflict with vscode-css-modules.
exports.activate=functionactivate(){console.log('[vscode-css-modules] Activated');// By default, `vscode.typescript-language-features` is not activated when a user opens *.css in VS Code.// So, activate it manually.consttsExtension=vscode.extensions.getExtension('vscode.typescript-language-features');if(tsExtension){console.log('[vscode-css-modules] Activating `vscode.typescript-language-features`');tsExtension.activate();}// ...
Summary
I use
createAsyncLanguageServicePlugin
to develop the VS Code extension (vscode-css-modules
) and TypeScript Language Service Plugin (typescript-plugin-css-modules
) for CSS Modules.vscode-css-modules
makes tsserver loadtypescript-plugin-css-modules
by settingcontributes.typescriptServerPlugins
. It also setsactivationEvents
so that tsserver starts when the CSS file is opened. In addition, disable VS Code's built-in CSS extension (vscode.css-language-features
) so that it do not conflict withvscode-css-modules
.packages/vscode/package.json
:packages/vscode/src/index.cjs
:packages/ts-plugin/src/index.cjs
:.vscode/launch.json
This usually works: tsserver has control over the CSS.
2024-12-27.2.00.33.mov
However, when VS Code is launched and the CSS file is first opened, the language feature does not work.
2024-12-27.1.59.12.mov
Reproduction
repository: https://github.com/mizdra/repro-volar-open-non-ts-file-first
npm i
in the terminal.a_2
and doFind all references
Expected behavior
a_2
inindex.ts
appears in the list.Actual behavior
a_2
inindex.ts
does not appear in the list.Additional context
This seems to be caused by
createAsyncLanguageServicePlugin
. If you usecreateLanguageServicePlugin
instead, the problem does not reproduce.You can try it by reverting mizdra/repro-volar-open-non-ts-file-first@028198a.
Environment
The text was updated successfully, but these errors were encountered: