@@ -28,6 +28,7 @@ import {
28
28
} from "vscode" ;
29
29
import { getStyleSheets } from "./settings" ;
30
30
import { Style , StyleType , parse } from "./parser" ;
31
+ import path from "path" ;
31
32
32
33
const start = new Position ( 0 , 0 ) ;
33
34
const cache = new Map < string , Style [ ] > ( ) ;
@@ -108,11 +109,14 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
108
109
const map = new Map < string , CompletionItem > ( ) ;
109
110
const styles = await this . getStyles ( document ) ;
110
111
111
- for ( const value of styles . values ( ) ) {
112
+ for ( const [ key , value ] of styles ) {
112
113
for ( const style of value ) {
113
114
if ( style . type === type ) {
114
115
const item = new CompletionItem (
115
- style . selector ,
116
+ {
117
+ label : style . selector ,
118
+ description : path . basename ( key )
119
+ } ,
116
120
style . type === StyleType . ID
117
121
? CompletionItemKind . Value
118
122
: CompletionItemKind . Enum
@@ -153,12 +157,12 @@ export class Provider implements CompletionItemProvider, DefinitionProvider {
153
157
return new Promise ( ( resolve , reject ) =>
154
158
match && ! token . isCancellationRequested
155
159
? 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
161
164
)
165
+ )
162
166
: reject ( )
163
167
) ;
164
168
}
0 commit comments