Skip to content

Commit df7b186

Browse files
Ecmel ErcanEcmel Ercan
authored andcommitted
Fixes
1 parent e2937f4 commit df7b186

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-html-css",
33
"displayName": "HTML CSS Support",
44
"description": "CSS support for HTML documents",
5-
"version": "0.0.27",
5+
"version": "0.0.28",
66
"publisher": "ecmel",
77
"license": "MIT",
88
"homepage": "https://github.com/ecmel/vscode-html-css",

src/extension.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export function activate(context: vsc.ExtensionContext) {
189189

190190
if (vsc.workspace.rootPath) {
191191
let resourceJson = path.resolve(vsc.workspace.rootPath, 'resource.json');
192+
let hasResourceJson = false;
192193

193194
fs.readFile(resourceJson, 'utf8', function (err: any, data: string) {
194195
let glob = '**/*.css';
@@ -204,15 +205,25 @@ export function activate(context: vsc.ExtensionContext) {
204205

205206
for (let key in resources.css) {
206207
for (let resource of resources.css[key]) {
207-
parse(vsc.Uri.file(path.resolve(vsc.workspace.rootPath, resource)));
208+
let uri = vsc.Uri.file(path.resolve(vsc.workspace.rootPath, resource));
209+
parse(uri);
208210
}
209211
}
212+
hasResourceJson = true;
210213
}
211214

212215
let watcher = vsc.workspace.createFileSystemWatcher(glob); // TODO
213216

214-
watcher.onDidCreate(parse);
215-
watcher.onDidChange(parse);
217+
watcher.onDidCreate(function (uri: vsc.Uri) {
218+
if (!hasResourceJson || map[uri.fsPath]) {
219+
parse(uri);
220+
}
221+
});
222+
watcher.onDidChange(function (uri: vsc.Uri) {
223+
if (!hasResourceJson || map[uri.fsPath]) {
224+
parse(uri);
225+
}
226+
});
216227
watcher.onDidDelete(function (uri: vsc.Uri) {
217228
delete map[uri.fsPath];
218229
});

0 commit comments

Comments
 (0)