@@ -11,16 +11,16 @@ function activate(context) {
1111 vscode . window . showInformationMessage ( 'HTML CSS Class Completion: Fetching CSS rules from CSS files, please wait.' ) ;
1212 // fetches the css files excluding the ones within node_modules folders that are within another node_modules folder
1313 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 ) { }
1619 // goes through each css file found and open it
1720 uris . forEach ( function ( uri , index ) {
1821 vscode . workspace . openTextDocument ( uri ) . then ( function ( textDocument ) {
19- // extracts the text of the file and concatenates it
20- cssFilesConcatenated += textDocument . getText ( ) ;
2122 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
2424 vscode . window . showInformationMessage ( "HTML CSS Class Completion: Finished fetching CSS rules from CSS files." ) ;
2525 }
2626 } ) ;
@@ -146,4 +146,4 @@ exports.activate = activate;
146146// this method is called when your extension is deactivated
147147function deactivate ( ) {
148148}
149- exports . deactivate = deactivate ;
149+ exports . deactivate = deactivate ;
0 commit comments