From 2ac011fa60a720f01a595e11270c55749504add1 Mon Sep 17 00:00:00 2001 From: ecmel Date: Sat, 9 Jan 2021 13:45:45 +0300 Subject: [PATCH] Fixes --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/completion.ts | 11 ++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c5d9e..8a71b62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/package.json b/package.json index ac8b890..c481c0b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/completion.ts b/src/completion.ts index 3d8d726..e08c0cf 100644 --- a/src/completion.ts +++ b/src/completion.ts @@ -187,7 +187,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D } } - async findAll(document: TextDocument, kind: CompletionItemKind): Promise> { + async findAll(document: TextDocument, tag: string): Promise { const keys = new Set(); const uri = document.uri; const text = document.getText(); @@ -199,6 +199,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D await this.findExtendedStyles(uri, keys, text); const items = new Map(); + const kind = tag === "id" ? CompletionItemKind.Value : CompletionItemKind.Enum; keys.forEach(key => this.cache.get(key)?.forEach((v, k) => { if (v.kind === kind) { @@ -206,7 +207,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D } })); - return items; + return [...items.values()]; } provideCompletionItems( @@ -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(); }