Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed Jan 9, 2021
1 parent a11d3f6 commit 2ac011f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the extension will be documented in this file.

## [1.7.1] - 2021-01-09

- Update documentation.

## [1.7.0] - 2021-01-09

- Removed validation.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-html-css",
"displayName": "HTML CSS Support",
"description": "CSS Intellisense for HTML",
"version": "1.7.0",
"version": "1.7.1",
"publisher": "ecmel",
"license": "MIT",
"homepage": "https://github.com/ecmel/vscode-html-css",
Expand Down
11 changes: 4 additions & 7 deletions src/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
}
}

async findAll(document: TextDocument, kind: CompletionItemKind): Promise<Map<string, CompletionItem>> {
async findAll(document: TextDocument, tag: string): Promise<CompletionItem[]> {
const keys = new Set<string>();
const uri = document.uri;
const text = document.getText();
Expand All @@ -199,14 +199,15 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
await this.findExtendedStyles(uri, keys, text);

const items = new Map<string, CompletionItem>();
const kind = tag === "id" ? CompletionItemKind.Value : CompletionItemKind.Enum;

keys.forEach(key => this.cache.get(key)?.forEach((v, k) => {
if (v.kind === kind) {
items.set(k, v);
}
}));

return items;
return [...items.values()];
}

provideCompletionItems(
Expand All @@ -224,11 +225,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
const canComplete = this.canComplete.exec(text);

if (canComplete) {
const kind = canComplete[1] === "id"
? CompletionItemKind.Value
: CompletionItemKind.Enum;

this.findAll(document, kind).then((items => resolve([...items.values()])));
this.findAll(document, canComplete[1]).then(resolve);
} else {
reject();
}
Expand Down

0 comments on commit 2ac011f

Please sign in to comment.