99} from "vscode" ;
1010import { CssColorProvider } from "./providers/color-provider" ;
1111import { CssCompletionProvider } from "./providers/completion-provider" ;
12- import { CACHE , DEFAULT_CONFIG , EXTENSION_NAME } from "./constants" ;
12+ import { CACHE , EXTENSION_NAME } from "./constants" ;
1313import { CssDefinitionProvider } from "./providers/definition-provider" ;
1414import { LOGGER } from "./logger" ;
1515import { setup } from "./main" ;
@@ -27,6 +27,10 @@ const watchers: FileSystemWatcher[] = [];
2727export async function activate ( context : ExtensionContext ) : Promise < void > {
2828 try {
2929 const { config } = await setup ( ) ;
30+ if ( ! config [ CACHE . activeRootPath ] . enable ) {
31+ return ;
32+ }
33+
3034 const [ , errorPaths ] = await parseFiles ( config , { parseAll : true } ) ; // Cache Parsed CSS Vars for all Root folders
3135 if ( errorPaths . length > 0 ) {
3236 const relativePaths = errorPaths ;
@@ -42,7 +46,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
4246 ) ;
4347
4448 const completionDisposable = languages . registerCompletionItemProvider (
45- config [ CACHE . activeRootPath ] . extensions || DEFAULT_CONFIG . extensions ,
49+ config [ CACHE . activeRootPath ] . extensions ,
4650 new CssCompletionProvider ( ) ,
4751 "-" ,
4852 "v" ,
@@ -54,23 +58,23 @@ export async function activate(context: ExtensionContext): Promise<void> {
5458
5559 if ( config [ CACHE . activeRootPath ] . enableColors ) {
5660 const colorDisposable = languages . registerColorProvider (
57- config [ CACHE . activeRootPath ] . extensions || DEFAULT_CONFIG . extensions ,
61+ config [ CACHE . activeRootPath ] . extensions ,
5862 new CssColorProvider ( )
5963 ) ;
6064 context . subscriptions . push ( colorDisposable ) ;
6165 }
6266
6367 if ( config [ CACHE . activeRootPath ] . enableGotoDef ) {
6468 const definitionDisposable = languages . registerDefinitionProvider (
65- config [ CACHE . activeRootPath ] . extensions || DEFAULT_CONFIG . extensions ,
69+ config [ CACHE . activeRootPath ] . extensions ,
6670 new CssDefinitionProvider ( )
6771 ) ;
6872 context . subscriptions . push ( definitionDisposable ) ;
6973 }
7074
7175 if ( config [ CACHE . activeRootPath ] . enableHover ) {
7276 const definitionDisposable = languages . registerHoverProvider (
73- config [ CACHE . activeRootPath ] . extensions || DEFAULT_CONFIG . extensions ,
77+ config [ CACHE . activeRootPath ] . extensions ,
7478 new CssHoverProvider ( )
7579 ) ;
7680 context . subscriptions . push ( definitionDisposable ) ;
0 commit comments