1
1
import { defineExtension , useCommand , useDisposable } from 'reactive-vscode'
2
2
import { workspace } from 'vscode'
3
- import { config } from './config'
3
+ import { config , ffKey } from './config'
4
4
import * as Meta from './generated/meta'
5
5
import { createFileManagers } from './manager'
6
6
import { debounce , showMessage } from './utils'
@@ -23,13 +23,32 @@ const { activate, deactivate } = defineExtension(() => {
23
23
useCommand ( Meta . commands . reload , ( ) => reload ( changedMsg ) )
24
24
useCommand ( Meta . commands . rollback , ( ) => rollback ( rollbackMsg ) )
25
25
26
+ const notifyChanged = ( ) => showMessage (
27
+ 'Configuration changed, apply now?' ,
28
+ 'Yes' ,
29
+ 'No' ,
30
+ )
31
+ . then < any > ( item => item === 'Yes' && reload ( changedMsg ) )
32
+
26
33
useDisposable (
27
34
workspace . onDidChangeConfiguration (
28
35
debounce (
29
- e => ( e . affectsConfiguration ( Meta . name ) || e . affectsConfiguration ( 'editor.fontFamily' ) )
30
- && config . watch
31
- && showMessage ( 'Configuration changed, apply now?' , 'Yes' , 'No' )
32
- . then < any > ( item => item === 'Yes' && reload ( changedMsg ) ) ,
36
+ ( e ) => {
37
+ if ( ! config . watch ) {
38
+ return
39
+ }
40
+ if ( e . affectsConfiguration ( Meta . name ) ) {
41
+ notifyChanged ( )
42
+ } else if ( e . affectsConfiguration ( ffKey ) && ! config [ 'font.monospace' ] ) {
43
+ const {
44
+ globalValue,
45
+ workspaceValue,
46
+ } = workspace . getConfiguration ( ) . inspect < string > ( ffKey ) !
47
+ if ( globalValue === workspaceValue ) {
48
+ notifyChanged ( )
49
+ }
50
+ }
51
+ } ,
33
52
1000 ,
34
53
) ,
35
54
) ,
0 commit comments