Skip to content

Commit e50c882

Browse files
committed
fix(language-core): renaming classname within scoped not working
close #4355
1 parent 05ece9d commit e50c882

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

packages/language-core/lib/codegen/script/index.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@ export const codeFeatures = {
2525
navigation: {
2626
navigation: true,
2727
} as VueCodeInformation,
28-
referencesCodeLens: {
29-
navigation: true,
30-
__referencesCodeLens: true,
31-
} as VueCodeInformation,
32-
cssClassNavigation: {
28+
navigationWithoutRename: {
3329
navigation: {
34-
resolveRenameNewName: normalizeCssRename,
35-
resolveRenameEditText: applyCssRename,
30+
shouldRename() {
31+
return false;
32+
},
3633
},
3734
} as VueCodeInformation,
3835
};
@@ -149,11 +146,3 @@ export function* generateScript(options: ScriptCodegenOptions): Generator<Code>
149146
];
150147
}
151148
}
152-
153-
function normalizeCssRename(newName: string) {
154-
return newName.startsWith('.') ? newName.slice(1) : newName;
155-
}
156-
157-
function applyCssRename(newName: string) {
158-
return '.' + newName;
159-
}

packages/language-core/lib/codegen/script/template.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { forEachInterpolationSegment } from '../template/interpolation';
77
import type { ScriptCodegenContext } from './context';
88
import { codeFeatures, type ScriptCodegenOptions } from './index';
99
import { generateInternalComponent } from './internalComponent';
10-
import { combineLastMapping } from '../common';
1110

1211
export function* generateTemplate(
1312
options: ScriptCodegenOptions,
@@ -176,29 +175,24 @@ function* generateCssClassProperty(
176175
'',
177176
'style_' + styleIndex,
178177
offset,
179-
referencesCodeLens
180-
? codeFeatures.navigation
181-
: codeFeatures.referencesCodeLens,
178+
{
179+
...codeFeatures.navigationWithoutRename,
180+
__referencesCodeLens: referencesCodeLens,
181+
},
182182
];
183183
yield `'`;
184-
yield [
185-
'',
186-
'style_' + styleIndex,
187-
offset,
188-
codeFeatures.cssClassNavigation,
189-
];
190184
yield [
191185
classNameWithDot.substring(1),
192186
'style_' + styleIndex,
193187
offset + 1,
194-
combineLastMapping,
188+
codeFeatures.navigation,
195189
];
196190
yield `'`;
197191
yield [
198192
'',
199193
'style_' + styleIndex,
200194
offset + classNameWithDot.length,
201-
codeFeatures.none,
195+
codeFeatures.navigationWithoutRename,
202196
];
203197
yield `${optional ? '?' : ''}: ${propertyType}`;
204198
yield ` }`;

0 commit comments

Comments
 (0)