@@ -175,100 +175,6 @@ export class Config {
175175 }
176176}
177177
178- export async function updateConfig ( config : vscode . WorkspaceConfiguration ) {
179- const renames = [
180- [ "assist.allowMergingIntoGlobImports" , "imports.merge.glob" ] ,
181- [ "assist.exprFillDefault" , "assist.expressionFillDefault" ] ,
182- [ "assist.importEnforceGranularity" , "imports.granularity.enforce" ] ,
183- [ "assist.importGranularity" , "imports.granularity.group" ] ,
184- [ "assist.importMergeBehavior" , "imports.granularity.group" ] ,
185- [ "assist.importMergeBehaviour" , "imports.granularity.group" ] ,
186- [ "assist.importGroup" , "imports.group.enable" ] ,
187- [ "assist.importPrefix" , "imports.prefix" ] ,
188- [ "primeCaches.enable" , "cachePriming.enable" ] ,
189- [ "cache.warmup" , "cachePriming.enable" ] ,
190- [ "cargo.loadOutDirsFromCheck" , "cargo.buildScripts.enable" ] ,
191- [ "cargo.runBuildScripts" , "cargo.buildScripts.enable" ] ,
192- [ "cargo.runBuildScriptsCommand" , "cargo.buildScripts.overrideCommand" ] ,
193- [ "cargo.useRustcWrapperForBuildScripts" , "cargo.buildScripts.useRustcWrapper" ] ,
194- [ "completion.snippets" , "completion.snippets.custom" ] ,
195- [ "diagnostics.enableExperimental" , "diagnostics.experimental.enable" ] ,
196- [ "experimental.procAttrMacros" , "procMacro.attributes.enable" ] ,
197- [ "highlighting.strings" , "semanticHighlighting.strings.enable" ] ,
198- [ "highlightRelated.breakPoints" , "highlightRelated.breakPoints.enable" ] ,
199- [ "highlightRelated.exitPoints" , "highlightRelated.exitPoints.enable" ] ,
200- [ "highlightRelated.yieldPoints" , "highlightRelated.yieldPoints.enable" ] ,
201- [ "highlightRelated.references" , "highlightRelated.references.enable" ] ,
202- [ "hover.documentation" , "hover.documentation.enable" ] ,
203- [ "hover.linksInHover" , "hover.links.enable" ] ,
204- [ "hoverActions.linksInHover" , "hover.links.enable" ] ,
205- [ "hoverActions.debug" , "hover.actions.debug.enable" ] ,
206- [ "hoverActions.enable" , "hover.actions.enable.enable" ] ,
207- [ "hoverActions.gotoTypeDef" , "hover.actions.gotoTypeDef.enable" ] ,
208- [ "hoverActions.implementations" , "hover.actions.implementations.enable" ] ,
209- [ "hoverActions.references" , "hover.actions.references.enable" ] ,
210- [ "hoverActions.run" , "hover.actions.run.enable" ] ,
211- [ "inlayHints.chainingHints" , "inlayHints.chainingHints.enable" ] ,
212- [ "inlayHints.closureReturnTypeHints" , "inlayHints.closureReturnTypeHints.enable" ] ,
213- [ "inlayHints.hideNamedConstructorHints" , "inlayHints.typeHints.hideNamedConstructor" ] ,
214- [ "inlayHints.parameterHints" , "inlayHints.parameterHints.enable" ] ,
215- [ "inlayHints.reborrowHints" , "inlayHints.reborrowHints.enable" ] ,
216- [ "inlayHints.typeHints" , "inlayHints.typeHints.enable" ] ,
217- [ "lruCapacity" , "lru.capacity" ] ,
218- [ "runnables.cargoExtraArgs" , "runnables.extraArgs" ] ,
219- [ "runnables.overrideCargo" , "runnables.command" ] ,
220- [ "rustcSource" , "rustc.source" ] ,
221- [ "rustfmt.enableRangeFormatting" , "rustfmt.rangeFormatting.enable" ] ,
222- ] ;
223-
224- for ( const [ oldKey , newKey ] of renames ) {
225- const inspect = config . inspect ( oldKey ) ;
226- if ( inspect !== undefined ) {
227- const valMatrix = [
228- {
229- val : inspect . globalValue ,
230- langVal : inspect . globalLanguageValue ,
231- target : vscode . ConfigurationTarget . Global ,
232- } ,
233- {
234- val : inspect . workspaceFolderValue ,
235- langVal : inspect . workspaceFolderLanguageValue ,
236- target : vscode . ConfigurationTarget . WorkspaceFolder ,
237- } ,
238- {
239- val : inspect . workspaceValue ,
240- langVal : inspect . workspaceLanguageValue ,
241- target : vscode . ConfigurationTarget . Workspace ,
242- } ,
243- ] ;
244- for ( const { val, langVal, target } of valMatrix ) {
245- const patch = ( val : unknown ) => {
246- // some of the updates we do only append "enable" or "custom"
247- // that means on the next run we would find these again, but as objects with
248- // these properties causing us to destroy the config
249- // so filter those already updated ones out
250- return (
251- val !== undefined &&
252- ! (
253- typeof val === "object" &&
254- val !== null &&
255- ( oldKey === "completion.snippets" || ! val . hasOwnProperty ( "custom" ) )
256- )
257- ) ;
258- } ;
259- if ( patch ( val ) ) {
260- await config . update ( newKey , val , target , false ) ;
261- await config . update ( oldKey , undefined , target , false ) ;
262- }
263- if ( patch ( langVal ) ) {
264- await config . update ( newKey , langVal , target , true ) ;
265- await config . update ( oldKey , undefined , target , true ) ;
266- }
267- }
268- }
269- }
270- }
271-
272178export function substituteVariablesInEnv ( env : Env ) : Env {
273179 const missingDeps = new Set < string > ( ) ;
274180 // vscode uses `env:ENV_NAME` for env vars resolution, and it's easier
0 commit comments