Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(language-service): ignore css rename when use typescript-semanitc rename #4681

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

linghaoSu
Copy link
Contributor

@linghaoSu linghaoSu commented Aug 12, 2024

fix #4677

When performing a rename, if the rename action is done on the name itself rather than on the . (dot), it triggers both the typescript-semantic and css plugins. However, if the rename is performed on the . (dot), only the css plugin's rename operation is triggered.

  1. When both typescript-semantic and css plugins are triggered:

The typescript-semantic plugin correctly generates the modification based on the TypeScript files generated by Vue.

On the other hand, the css plugin analyzes the CSS block and extracts the range including the . for the rename operation. When we trigger the rename, the content we input does not include the ., but the target range for replacement does include it, leading to a misalignment issue.

  .foo
// typescript-semantic
->.foo1

// css
      ! This is the leftover content from the TypeScript plugin above
->foo11
  ^^^^
   Generated by the CSS plugin
  1. When only the css plugin is triggered:

In this case, the input needs to include the entire selector, including the .. However, triggering the rename only for the CSS part does not update the class names in the template area, so the desired effect is not achieved.

@linghaoSu
Copy link
Contributor Author

I'm not entirely sure if this is the best approach, but it seems to resolve the issue effectively.

@KazariEX
Copy link
Collaborator

KazariEX commented Aug 12, 2024

This solves another problem: renaming variables in v-bind() does not take effect on the source definition.

However, this will make the normal CSS renaming behavior unavailable. We might need to reimplement it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renaming a class with multiple class names fails
2 participants