@@ -11,16 +11,16 @@ function activate(context) {
11
11
vscode . window . showInformationMessage ( 'HTML CSS Class Completion: Fetching CSS rules from CSS files, please wait.' ) ;
12
12
// fetches the css files excluding the ones within node_modules folders that are within another node_modules folder
13
13
vscode . workspace . findFiles ( '**/*.css' , 'node_modules/**/node_modules/**/*' ) . then ( function ( uris ) {
14
- // will contain all the css files concatenated
15
- var cssFilesConcatenated = "" ;
14
+ // extracts the text of the file and directly parse it.
15
+ // if an error occurs during the parse hide the error (it could be shown into an error log)
16
+ try {
17
+ fetchClasses ( textDocument . getText ( ) , classes ) ;
18
+ } catch ( err ) { }
16
19
// goes through each css file found and open it
17
20
uris . forEach ( function ( uri , index ) {
18
21
vscode . workspace . openTextDocument ( uri ) . then ( function ( textDocument ) {
19
- // extracts the text of the file and concatenates it
20
- cssFilesConcatenated += textDocument . getText ( ) ;
21
22
if ( uris . length == index + 1 ) {
22
- // after finishing the process the css classes are fetched from this large string and added to the classes array
23
- fetchClasses ( cssFilesConcatenated , classes ) ;
23
+ // Display message to user
24
24
vscode . window . showInformationMessage ( "HTML CSS Class Completion: Finished fetching CSS rules from CSS files." ) ;
25
25
}
26
26
} ) ;
@@ -146,4 +146,4 @@ exports.activate = activate;
146
146
// this method is called when your extension is deactivated
147
147
function deactivate ( ) {
148
148
}
149
- exports . deactivate = deactivate ;
149
+ exports . deactivate = deactivate ;
0 commit comments