@@ -28,6 +28,7 @@ import {
2828} from "vscode" ;
2929import { getStyleSheets } from "./settings" ;
3030import { Style , StyleType , parse } from "./parser" ;
31+ import path from "path" ;
3132
3233const start = new Position ( 0 , 0 ) ;
3334const 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