@@ -14,6 +14,7 @@ import { isHtmlContext } from '../util/html'
14
14
import { isCssContext } from '../util/css'
15
15
import { findLast , findJsxStrings , arrFindLast } from '../util/find'
16
16
import { stringifyConfigValue , stringifyCss } from '../util/stringify'
17
+ import { stringifyScreen , Screen } from '../util/screens'
17
18
import isObject from '../util/isObject'
18
19
import * as emmetHelper from 'emmet-helper'
19
20
import { isValidLocationForEmmetAbbreviation } from '../util/isValidLocationForEmmetAbbreviation'
@@ -380,6 +381,7 @@ function provideScreenDirectiveCompletions(
380
381
items : Object . keys ( screens ) . map ( ( screen ) => ( {
381
382
label : screen ,
382
383
kind : CompletionItemKind . Constant ,
384
+ data : 'screen' ,
383
385
textEdit : {
384
386
newText : screen ,
385
387
range : {
@@ -564,11 +566,18 @@ export function resolveCompletionItem(
564
566
state : State ,
565
567
item : CompletionItem
566
568
) : CompletionItem {
567
- if (
568
- item . data === 'helper' ||
569
- item . data === 'directive' ||
570
- item . data === 'variant'
571
- ) {
569
+ if ( [ 'helper' , 'directive' , 'variant' ] . includes ( item . data ) ) {
570
+ return item
571
+ }
572
+
573
+ if ( item . data === 'screen' ) {
574
+ let screens = dlv (
575
+ state . config ,
576
+ [ 'theme' , 'screens' ] ,
577
+ dlv ( state . config , [ 'screens' ] , { } )
578
+ )
579
+ if ( ! isObject ( screens ) ) screens = { }
580
+ item . detail = stringifyScreen ( screens [ item . label ] as Screen )
572
581
return item
573
582
}
574
583
0 commit comments