Skip to content

Commit a1a08cc

Browse files
Ecmel ErcanEcmel Ercan
authored andcommitted
Fixes
1 parent 540d293 commit a1a08cc

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
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 in HTML documents",
5-
"version": "0.0.15",
5+
"version": "0.0.16",
66
"publisher": "ecmel",
77
"license": "MIT",
88
"homepage": "https://github.com/ecmel/vscode-html-css",

resource.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"css": {
3+
"test": [
4+
"test/test.css"
5+
]
6+
}
7+
}

src/extension.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class ClassServer implements vsc.CompletionItemProvider {
131131
for (let item in items) {
132132
ci.push(items[item]);
133133
}
134-
return new vsc.CompletionList(ci, false);
134+
return new vsc.CompletionList(ci);
135135
}
136136
return null;
137137
}
@@ -169,16 +169,21 @@ function parse(uri: vsc.Uri) {
169169
}
170170

171171
function parseResource(resource: any): string {
172-
let glob = '{'
172+
let glob = ''
173+
let count = 0;
173174
for (let key in resource.css) {
174175
for (let item of resource.css[key]) {
175-
glob = glob + item + ',';
176+
glob += item + ',';
177+
count++;
176178
}
177179
}
178-
if (glob.substring(glob.length - 1) === ',') {
179-
glob = glob.substring(0, glob.length - 2);
180+
if (count > 0) {
181+
glob = glob.slice(0, -1);
180182
}
181-
return glob + '}';
183+
if (count > 1) {
184+
glob = '{' + glob + '}';
185+
}
186+
return glob;
182187
}
183188

184189
export function activate(context: vsc.ExtensionContext) {

test/test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</head>
1515

1616
<body>
17-
<a href="#" style="color: white; background-color: ghostwhite;" class="test test2 test3">TEST</a>
17+
<a href="#" style="color: white; background-color: ghostwhite;" class="">TEST</a>
1818
<a href="#" style="
1919
color: white;
2020
background-color: ghostwhite;

0 commit comments

Comments
 (0)