File tree 3 files changed +43
-0
lines changed
packages/tailwindcss-language-server
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ export class CssServer {
40
40
const stylesheets = getLanguageModelCache < Stylesheet > ( 10 , 60 , ( document ) =>
41
41
cssLanguageService . parseStylesheet ( document ) ,
42
42
)
43
+ documents . onDidOpen ( ( { document } ) => {
44
+ connection . sendNotification ( '@/tailwindCSS/documentReady' , {
45
+ uri : document . uri ,
46
+ } )
47
+ } )
43
48
documents . onDidClose ( ( { document } ) => {
44
49
stylesheets . onDocumentRemoved ( document )
45
50
} )
Original file line number Diff line number Diff line change
1
+ import { expect } from 'vitest'
2
+ import { css , defineTest } from '../../src/testing'
3
+ import { createClient } from '../utils/client'
4
+
5
+ defineTest ( {
6
+ name : 'css language handles custom-variant at-rule' ,
7
+ fs : {
8
+ //
9
+ } ,
10
+ prepare : async ( { root } ) => ( {
11
+ client : await createClient ( {
12
+ server : 'css' ,
13
+ root,
14
+ } ) ,
15
+ } ) ,
16
+ handle : async ( { client } ) => {
17
+ let doc = await client . open ( {
18
+ lang : 'tailwindcss' ,
19
+ name : 'file-1.css' ,
20
+ text : css `
21
+ @import 'tailwindcss' ;
22
+ @custom-variant foo (& : hover);
23
+ @custom-variant bar {
24
+ & : hover {
25
+ @slot ;
26
+ }
27
+ }
28
+ ` ,
29
+ } )
30
+
31
+ expect ( await doc . diagnostics ( ) ) . toEqual ( [ ] )
32
+ } ,
33
+ } )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { createConnection } from 'vscode-languageserver/node'
3
3
import type { ProtocolConnection } from 'vscode-languageclient/node'
4
4
import { Duplex , type Readable , type Writable } from 'node:stream'
5
5
import { TW } from '../../src/tw'
6
+ import { CssServer } from '../../src/language/css-server'
6
7
7
8
class TestStream extends Duplex {
8
9
_write ( chunk : string , _encoding : string , done : ( ) => void ) {
@@ -18,6 +19,10 @@ const SERVERS = {
18
19
ServerClass : TW ,
19
20
binaryPath : './bin/tailwindcss-language-server' ,
20
21
} ,
22
+ css : {
23
+ ServerClass : CssServer ,
24
+ binaryPath : './bin/css-language-server' ,
25
+ } ,
21
26
}
22
27
23
28
export interface ConnectOptions {
You can’t perform that action at this time.
0 commit comments