(filepath: string, ide: IDE)
| 16 | And writes them to the shared config |
| 17 | */ |
| 18 | export function migrateJsonSharedConfig(filepath: string, ide: IDE): void { |
| 19 | const globalContext = new GlobalContext(); |
| 20 | const currentSharedConfig = globalContext.getSharedConfig(); // for merging security concerns |
| 21 | |
| 22 | try { |
| 23 | let config = resolveSerializedConfig(filepath); |
| 24 | const shareConfigUpdates: SharedConfigSchema = {}; |
| 25 | |
| 26 | let effected = false; |
| 27 | |
| 28 | const { allowAnonymousTelemetry, ...withoutAllowTelemetry } = config; |
| 29 | if (allowAnonymousTelemetry !== undefined) { |
| 30 | if (currentSharedConfig.allowAnonymousTelemetry !== false) { |
| 31 | // safe merge for security |
| 32 | shareConfigUpdates.allowAnonymousTelemetry = allowAnonymousTelemetry; |
| 33 | } |
| 34 | config = withoutAllowTelemetry; |
| 35 | effected = true; |
| 36 | } |
| 37 | |
| 38 | const { disableIndexing, ...withoutDisableIndexing } = config; |
| 39 | if (disableIndexing !== undefined) { |
| 40 | if (currentSharedConfig.disableIndexing !== true) { |
| 41 | // safe merge for security |
| 42 | shareConfigUpdates.disableIndexing = disableIndexing; |
| 43 | } |
| 44 | config = withoutDisableIndexing; |
| 45 | effected = true; |
| 46 | } |
| 47 | |
| 48 | const { disableSessionTitles, ...withoutDisableSessionTitles } = config; |
| 49 | if (config.disableSessionTitles !== undefined) { |
| 50 | if (currentSharedConfig.disableSessionTitles !== true) { |
| 51 | // safe merge for security |
| 52 | shareConfigUpdates.disableSessionTitles = config.disableSessionTitles; |
| 53 | } |
| 54 | config = withoutDisableSessionTitles; |
| 55 | effected = true; |
| 56 | } |
| 57 | |
| 58 | const { tabAutocompleteOptions, ...withoutAutocompleteOptions } = config; |
| 59 | if (tabAutocompleteOptions !== undefined) { |
| 60 | let migratedAutocomplete = { ...tabAutocompleteOptions }; |
| 61 | |
| 62 | const { useCache, ...withoutUseCache } = migratedAutocomplete; |
| 63 | if (useCache !== undefined) { |
| 64 | shareConfigUpdates.useAutocompleteCache = useCache; |
| 65 | migratedAutocomplete = withoutUseCache; |
| 66 | effected = true; |
| 67 | } |
| 68 | |
| 69 | const { multilineCompletions, ...withoutMultiline } = |
| 70 | migratedAutocomplete; |
| 71 | if (multilineCompletions !== undefined) { |
| 72 | shareConfigUpdates.useAutocompleteMultilineCompletions = |
| 73 | multilineCompletions; |
| 74 | migratedAutocomplete = withoutMultiline; |
| 75 | effected = true; |
no test coverage detected