@@ -7,7 +7,8 @@ import * as lst from 'vscode-languageserver-types';
77import * as css from 'vscode-css-languageservice' ;
88import * as fs from 'fs' ;
99import * as path from 'path' ;
10- import * as https from 'https' ;
10+ const request = require ( 'request' ) ;
11+ // import * as https from 'https';
1112
1213let service = css . getCSSLanguageService ( ) ;
1314let map : { [ index : string ] : vsc . CompletionItem [ ] ; } = { } ;
@@ -123,16 +124,13 @@ function parse(uri: vsc.Uri): void {
123124}
124125
125126function parseRemote ( url : string ) {
126- https . get ( url , res => {
127- let styles = '' ;
128- res . on ( 'data' , d => {
129- styles += d . toString ( ) ;
130- } ) . on ( 'end' , ( ) => {
131- let doc = lst . TextDocument . create ( url , 'css' , 1 , styles ) ;
127+ request ( url , ( err , response , body : string ) => {
128+ if ( body . length > 0 ) {
129+ let doc = lst . TextDocument . create ( url , 'css' , 1 , body ) ;
132130 let symbols = service . findDocumentSymbols ( doc , service . parseStylesheet ( doc ) ) ;
133131 pushSymbols ( url , symbols ) ;
134- } ) ;
135- } )
132+ }
133+ } ) ;
136134}
137135
138136function parseRemoteConfig ( ) {
@@ -153,7 +151,7 @@ export function activate(context: vsc.ExtensionContext) {
153151 parse ( uris [ i ] ) ;
154152 }
155153 } ) ;
156-
154+
157155 let watcher = vsc . workspace . createFileSystemWatcher ( glob ) ;
158156
159157 watcher . onDidCreate ( function ( uri : vsc . Uri ) {
0 commit comments