Closed as not planned
Description
π Search Terms
rename, ts server, plugin
β Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
β Suggestion
Current ls interface:
interface LanguageService {
...
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences): readonly RenameLocation[] | undefined;
...
}
Add textStyle
property to RenameLocation
interface RenameLocation extends DocumentSpan {
readonly prefixText?: string;
readonly suffixText?: string;
readonly textStyle?: 'origin' | 'kebab' | 'camel'
}
As far as I know, this does not require changing the LSP
π Motivating Example
When renaming, some templates need to perform symbol conversion
π» Use Cases
my case:
@customElements('e-my')
class MyElement extends GemElement {
@emitter sayHi
}
html`<e-my @say-hi=${console.log}></e-my>`
When I rename an emitter name(camelCase), I want the event name(kebabCase) in the html template to transform
@customElements('e-my')
class MyElement extends GemElement {
@emitter goodBye
}
html`<e-my @good-bye=${console.log}></e-my>`
example: https://github.com/mantou132/gem/blob/main/packages/ts-gem-plugin/src/decorate-ts.ts#L159
vscode issue: microsoft/vscode#248912