@@ -261,29 +261,25 @@ export function completionsFromClassList(
261261
262262 // TODO: This is a bit of a hack
263263 if ( prefix . length > 0 ) {
264- // No variants seen: suggest the prefix only
264+ // No variants seen:
265+ // - suggest the prefix as a variant
266+ // - Modify the remaining items to include the prefix in the variant name
265267 if ( existingVariants . length === 0 ) {
266- items = items . slice ( 0 , 1 )
268+ items = items . map ( ( item , idx ) => {
269+ if ( idx === 0 ) return item
267270
268- return withDefaults (
269- {
270- isIncomplete : false ,
271- items,
272- } ,
273- {
274- data : {
275- ...( state . completionItemData ?? { } ) ,
276- ...( important ? { important } : { } ) ,
277- variants : existingVariants ,
278- } ,
279- range : replacementRange ,
280- } ,
281- state . editor . capabilities . itemDefaults ,
282- )
271+ item . label = `${ prefix } :${ item . label } `
272+
273+ if ( item . textEditText ) {
274+ item . textEditText = `${ prefix } :${ item . textEditText } `
275+ }
276+
277+ return item
278+ } )
283279 }
284280
285281 // The first variant is not the prefix: don't suggest anything
286- if ( existingVariants [ 0 ] !== prefix ) {
282+ if ( existingVariants . length > 0 && existingVariants [ 0 ] !== prefix ) {
287283 return null
288284 }
289285 }
@@ -304,6 +300,10 @@ export function completionsFromClassList(
304300 documentation = formatColor ( color )
305301 }
306302
303+ if ( prefix . length > 0 && existingVariants . length === 0 ) {
304+ className = `${ prefix } :${ className } `
305+ }
306+
307307 items . push ( {
308308 label : className ,
309309 kind,
0 commit comments