Skip to content

Commit 7ceb6e8

Browse files
committed
Fixes
1 parent 67662d5 commit 7ceb6e8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/completion.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
workspace
2020
} from "vscode";
2121

22-
export type Selector = {
22+
export type Context = {
2323
ids: Map<string, CompletionItem>,
2424
classes: Map<string, CompletionItem>
2525
};
@@ -212,7 +212,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
212212
}
213213
}
214214

215-
async findAll(document: TextDocument): Promise<Selector> {
215+
async findAll(document: TextDocument): Promise<Context> {
216216
const keys = new Set<string>();
217217
const uri = document.uri;
218218
const text = document.getText();
@@ -233,7 +233,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
233233
}
234234

235235
async validate(document: TextDocument): Promise<Diagnostic[]> {
236-
const selector = await this.findAll(document);
236+
const context = await this.findAll(document);
237237
const text = document.getText();
238238
const diagnostics: Diagnostic[] = [];
239239
const findAttribute = /(id|class|className)\s*=\s*("|')(.*?)\2/gsi;
@@ -255,13 +255,13 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
255255
const start = document.positionAt(anchor - value[1].length);
256256

257257
if (attribute[1] === "id") {
258-
if (!selector.ids.has(value[1])) {
258+
if (!context.ids.has(value[1])) {
259259
diagnostics.push(new Diagnostic(new Range(start, end),
260260
`CSS id selector '${value[1]}' not found.`,
261261
DiagnosticSeverity.Information));
262262
}
263263
} else {
264-
if (!selector.classes.has(value[1])) {
264+
if (!context.classes.has(value[1])) {
265265
diagnostics.push(new Diagnostic(new Range(start, end),
266266
`CSS class selector '${value[1]}' not found.`,
267267
DiagnosticSeverity.Information));
@@ -285,10 +285,10 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
285285
const canComplete = this.canComplete.exec(text);
286286

287287
if (canComplete) {
288-
this.findAll(document).then(selector => resolve(
288+
this.findAll(document).then(context => resolve(
289289
[...(canComplete[1] === "id"
290-
? selector.ids
291-
: selector.classes).values()]));
290+
? context.ids
291+
: context.classes).values()]));
292292
} else {
293293
reject();
294294
}

0 commit comments

Comments
 (0)