@@ -4,6 +4,7 @@ import { defaultJsSupersetLangs } from '@zardoy/vscode-utils/build/langs'
4
4
import { Settings , extensionCtx , getExtensionSetting , getExtensionSettingId , registerExtensionCommand } from 'vscode-framework'
5
5
import { pickObj } from '@zardoy/utils'
6
6
import { watchExtensionSettings } from '@zardoy/vscode-utils/build/settings'
7
+ import { ConditionalPick } from 'type-fest'
7
8
import webImports from './webImports'
8
9
import { sendCommand } from './sendCommand'
9
10
import { registerEmmet } from './emmet'
@@ -16,7 +17,6 @@ import vueVolarSupport from './vueVolarSupport'
16
17
import moreCompletions from './moreCompletions'
17
18
import { mergeSettingsFromScopes } from './mergeSettings'
18
19
import codeActionProvider from './codeActionProvider'
19
- import { ConditionalPick } from 'type-fest'
20
20
21
21
let isActivated = false
22
22
// let erroredStatusBarItem: vscode.StatusBarItem | undefined
@@ -144,12 +144,13 @@ export const activate = async () => {
144
144
const registerDisableOptionalFeaturesCommand = ( ) => {
145
145
registerExtensionCommand ( 'disableAllOptionalFeatures' , async ( ) => {
146
146
const config = vscode . workspace . getConfiguration ( process . env . IDS_PREFIX , null )
147
- const toDisable : [ keyof Settings , any ] [ ] = [ ]
147
+ const toDisable : Array < [ keyof Settings , any ] > = [ ]
148
148
for ( const optionalExperience of optionalExperiences ) {
149
149
const desiredKey = Array . isArray ( optionalExperience ) ? optionalExperience [ 0 ] : optionalExperience
150
150
const desiredValue = Array . isArray ( optionalExperience ) ? optionalExperience [ 1 ] : false
151
151
if ( config . get ( desiredKey ) !== desiredValue ) toDisable . push ( [ desiredKey , desiredValue ] )
152
152
}
153
+
153
154
const action = await vscode . window . showInformationMessage (
154
155
`${ toDisable . length } features are going to be disabled` ,
155
156
{ detail : '' , modal : true } ,
@@ -160,20 +161,22 @@ const registerDisableOptionalFeaturesCommand = () => {
160
161
switch ( action ) {
161
162
case 'Write to settings NOW' : {
162
163
for ( const [ key , value ] of toDisable ) {
163
- config . update ( key , value , vscode . ConfigurationTarget . Global )
164
+ void config . update ( key , value , vscode . ConfigurationTarget . Global )
164
165
}
166
+
165
167
break
166
168
}
169
+
167
170
case 'Copy settings' : {
168
- vscode . env . clipboard . writeText ( JSON . stringify ( Object . fromEntries ( toDisable ) , undefined , 4 ) )
171
+ await vscode . env . clipboard . writeText ( JSON . stringify ( Object . fromEntries ( toDisable ) , undefined , 4 ) )
169
172
break
170
173
}
171
174
}
172
175
} )
173
176
}
174
177
175
178
/** Experiences that are enabled out of the box */
176
- const optionalExperiences : ( keyof ConditionalPick < Settings , boolean > | [ keyof Settings , any ] ) [ ] = [
179
+ const optionalExperiences : Array < keyof ConditionalPick < Settings , boolean > | [ keyof Settings , any ] > = [
177
180
'enableMethodSnippets' ,
178
181
'removeUselessFunctionProps.enable' ,
179
182
'patchToString.enable' ,
0 commit comments