Skip to content

Commit ff23eef

Browse files
authored
(fix) rename setting (#643)
Add typescript.rename.enable and svelte.rename.enable #640
1 parent db8eb76 commit ff23eef

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

packages/language-server/src/ls-config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const defaultLSConfig: LSConfig = {
3838
enable: true,
3939
compilerWarnings: {},
4040
diagnostics: { enable: true },
41+
rename: { enable: true },
4142
format: { enable: true },
4243
completions: { enable: true },
4344
hover: { enable: true },
@@ -84,7 +85,7 @@ export interface LSTypescriptConfig {
8485
enable: boolean;
8586
};
8687
selectionRange: {
87-
enable: boolean
88+
enable: boolean;
8889
};
8990
}
9091

@@ -110,7 +111,7 @@ export interface LSCSSConfig {
110111
enable: boolean;
111112
};
112113
selectionRange: {
113-
enable: boolean
114+
enable: boolean;
114115
};
115116
}
116117

@@ -141,6 +142,9 @@ export interface LSSvelteConfig {
141142
format: {
142143
enable: boolean;
143144
};
145+
rename: {
146+
enable: boolean;
147+
};
144148
completions: {
145149
enable: boolean;
146150
};
@@ -151,7 +155,7 @@ export interface LSSvelteConfig {
151155
enable: boolean;
152156
};
153157
selectionRange: {
154-
enable: boolean
158+
enable: boolean;
155159
};
156160
}
157161

packages/language-server/src/plugins/typescript/TypeScriptPlugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,12 @@ export class TypeScriptPlugin
317317
}
318318

319319
async updateImports(fileRename: FileRename): Promise<WorkspaceEdit | null> {
320-
if (!this.featureEnabled('rename')) {
320+
if (
321+
!(
322+
this.configManager.enabled('svelte.enable') &&
323+
this.configManager.enabled('svelte.rename.enable')
324+
)
325+
) {
321326
return null;
322327
}
323328

packages/svelte-vscode/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ Enable code actions for TypeScript. _Default_: `true`
102102

103103
Enable selection range for TypeScript. _Default_: `true`
104104

105+
##### `svelte.plugin.typescript.rename.enable`
106+
107+
Enable rename functionality for JS/TS variables inside Svelte files. _Default_: `true`
108+
105109
##### `svelte.plugin.css.enable`
106110

107111
Enable the CSS plugin. _Default_: `true`
@@ -184,7 +188,7 @@ Enable autocompletion for Svelte (for tags like #if/#each). _Default_: `true`
184188

185189
##### `svelte.plugin.svelte.rename.enable`
186190

187-
Enable rename functionality (rename svelte files or variables inside svelte files). _Default_: `true`
191+
Enable rename/move Svelte files functionality. _Default_: `true`
188192

189193
##### `svelte.plugin.svelte.codeActions.enable`
190194

packages/svelte-vscode/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@
116116
"title": "TypeScript: SelectionRange",
117117
"description": "Enable selection range for TypeScript"
118118
},
119+
"svelte.plugin.typescript.rename.enable": {
120+
"type": "boolean",
121+
"default": true,
122+
"title": "TypeScript: Rename",
123+
"description": "Enable rename functionality for JS/TS variables inside Svelte files"
124+
},
119125
"svelte.plugin.css.enable": {
120126
"type": "boolean",
121127
"default": true,
@@ -254,6 +260,12 @@
254260
"default": true,
255261
"title": "Svelte: Selection Range",
256262
"description": "Enable selection range for Svelte"
263+
},
264+
"svelte.plugin.svelte.rename.enable": {
265+
"type": "boolean",
266+
"default": true,
267+
"title": "Svelte: Rename",
268+
"description": "Enable rename/move Svelte files functionality"
257269
}
258270
}
259271
},

0 commit comments

Comments
 (0)