vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.79k stars 390 forks source link

feat(language-core): document links for classname within `:class` #4642

Closed KazariEX closed 1 month ago

KazariEX commented 1 month ago

resolve #4641

image

johnsoncodehk commented 1 month ago

I think rename support can be left out for now. The current class name rename solution is unreliable due to a upstream issue (https://github.com/volarjs/volar.js/issues/176).

KazariEX commented 1 month ago

This commit treats repeated class declarations as references to the first class, ensuring synchronization when renaming classes with the same name.

This requires ignoring the CSS renaming behavior when using the typescript-semantic renaming feature. Currently, since no interception is implemented, class renaming in the <style> will be overridden by the CSS functionality. We need to address this issue later.

KazariEX commented 1 month ago

Since we have extracted the classnames as much as possible, the logic previously used for renaming support is no longer necessary.

pkg-pr-new[bot] commented 1 month ago

commit: 4dd2bd5

vue-component-meta

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4642 ```

vue-component-type-helpers

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4642 ```

@vue/language-core

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4642 ```

@vue/language-plugin-pug

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4642 ```

@vue/language-server

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4642 ```

@vue/language-service

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4642 ```

vue-tsc

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-tsc@4642 ```

@vue/typescript-plugin

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4642 ```

Open in Stackblitz

johnsoncodehk commented 1 month ago

Awesome, thanks! I tested it manually, it would be great if you could add a test case for it.

I plan to extract this feature to the language service plugin instead of relying on TS virtual code, which will improve the robustness of this feature.