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