Skip to content

Commit 3d76124

Browse files
committed
Add prompt source file
1 parent 89d5015 commit 3d76124

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/provider.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from "vscode";
2929
import { getStyleSheets } from "./settings";
3030
import { Style, StyleType, parse } from "./parser";
31+
import path from "path";
3132

3233
const start = new Position(0, 0);
3334
const cache = new Map<string, Style[]>();
@@ -108,11 +109,14 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
108109
const map = new Map<string, CompletionItem>();
109110
const styles = await this.getStyles(document);
110111

111-
for (const value of styles.values()) {
112+
for (const [key, value] of styles) {
112113
for (const style of value) {
113114
if (style.type === type) {
114115
const item = new CompletionItem(
115-
style.selector,
116+
{
117+
label: style.selector,
118+
description: path.basename(key)
119+
},
116120
style.type === StyleType.ID
117121
? CompletionItemKind.Value
118122
: CompletionItemKind.Enum
@@ -153,12 +157,12 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
153157
return new Promise((resolve, reject) =>
154158
match && !token.isCancellationRequested
155159
? resolve(
156-
this.getCompletionItems(
157-
document,
158-
position,
159-
match[1] === "id" ? StyleType.ID : StyleType.CLASS
160-
)
160+
this.getCompletionItems(
161+
document,
162+
position,
163+
match[1] === "id" ? StyleType.ID : StyleType.CLASS
161164
)
165+
)
162166
: reject()
163167
);
164168
}

0 commit comments

Comments
 (0)