@@ -286,6 +286,52 @@ function provideCssHelperCompletions(
286
286
}
287
287
}
288
288
289
+ function provideScreenDirectiveCompletions (
290
+ state : State ,
291
+ { position, textDocument } : CompletionParams
292
+ ) : CompletionList {
293
+ let doc = state . editor . documents . get ( textDocument . uri )
294
+
295
+ if ( ! isCssContext ( doc , position ) ) {
296
+ return null
297
+ }
298
+
299
+ let text = doc . getText ( {
300
+ start : { line : position . line , character : 0 } ,
301
+ end : position ,
302
+ } )
303
+
304
+ const match = text . match ( / ^ \s * @ s c r e e n \s + (?< partial > [ ^ \s ] * ) $ / i)
305
+
306
+ if ( match === null ) return null
307
+
308
+ const screens = dlv (
309
+ state . config ,
310
+ [ 'screens' ] ,
311
+ dlv ( state . config , [ 'theme' , 'screens' ] , { } )
312
+ )
313
+
314
+ if ( ! isObject ( screens ) ) return null
315
+
316
+ return {
317
+ isIncomplete : false ,
318
+ items : Object . keys ( screens ) . map ( ( screen ) => ( {
319
+ label : screen ,
320
+ kind : CompletionItemKind . Constant ,
321
+ textEdit : {
322
+ newText : screen ,
323
+ range : {
324
+ start : {
325
+ line : position . line ,
326
+ character : position . character - match . groups . partial . length ,
327
+ } ,
328
+ end : position ,
329
+ } ,
330
+ } ,
331
+ } ) ) ,
332
+ }
333
+ }
334
+
289
335
function provideCssDirectiveCompletions (
290
336
state : State ,
291
337
{ position, textDocument } : CompletionParams
@@ -377,7 +423,8 @@ export function provideCompletions(
377
423
return (
378
424
provideClassNameCompletions ( state , params ) ||
379
425
provideCssHelperCompletions ( state , params ) ||
380
- provideCssDirectiveCompletions ( state , params )
426
+ provideCssDirectiveCompletions ( state , params ) ||
427
+ provideScreenDirectiveCompletions ( state , params )
381
428
)
382
429
}
383
430
0 commit comments