@@ -41,10 +41,9 @@ const getConfigValue = <T extends keyof WorkspaceConfig>(
4141 config : WorkspaceConfiguration ,
4242 key : T
4343) : WorkspaceConfig [ typeof key ] => {
44- let value = config . get < WorkspaceConfig [ typeof key ] > ( key ) ;
45- if ( value == null ) {
46- // Only overrride, if extension setting is untouched
47- value = DEFAULT_CONFIG [ key ] ;
44+ const value = config . get < WorkspaceConfig [ typeof key ] > ( key ) ;
45+ if ( value == null || ! config . has ( key ) ) {
46+ return DEFAULT_CONFIG [ key ] ;
4847 }
4948 return value ;
5049} ;
@@ -124,8 +123,7 @@ export async function setup(): Promise<{
124123 break ;
125124 }
126125 case "postcssPlugins" : {
127- const _plugins =
128- _config . get < WorkspaceConfig [ "postcssPlugins" ] > ( key ) ;
126+ const _plugins = getConfigValue ( _config , key ) ;
129127 let plugins : Config [ "postcssPlugins" ] = [ ] ;
130128 if ( _plugins ) {
131129 plugins = _plugins
@@ -144,7 +142,7 @@ export async function setup(): Promise<{
144142 break ;
145143 }
146144 case "postcssSyntax" : {
147- const syntaxes = _config . get < Record < string , string [ ] > > ( key ) ;
145+ const syntaxes = getConfigValue ( _config , key ) ;
148146 if ( syntaxes && ! Array . isArray ( syntaxes ) ) {
149147 config [ fsPathKey ] [ key ] = Object . keys ( syntaxes ) . reduce (
150148 ( syntaxMap , key ) => {
@@ -164,7 +162,7 @@ export async function setup(): Promise<{
164162 break ;
165163 }
166164 case "mode" : {
167- const mode = _config . get < WorkspaceConfig [ "mode" ] > ( key ) ;
165+ const mode = getConfigValue ( _config , key ) ;
168166 let _mode : Config [ "mode" ] ;
169167 if ( typeof mode === "string" ) {
170168 _mode = [ mode , { } ] ;
0 commit comments