File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
tailwindcss-language-server/src Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
1
import * as rpc from 'vscode-jsonrpc/node'
2
2
import * as proc from 'node:child_process'
3
3
import * as path from 'node:path'
4
+ import * as fs from 'node:fs/promises'
4
5
import { type ScanOptions , type ScanResult } from './oxide'
5
6
6
7
/**
@@ -32,7 +33,32 @@ export class OxideSession {
32
33
33
34
// TODO: Can we find a way to not require a build first?
34
35
// let module = path.resolve(path.dirname(__filename), './oxide-helper.ts')
35
- let module = path . resolve ( path . dirname ( __filename ) , '../bin/oxide-helper.js' )
36
+
37
+ let modulePaths = [
38
+ // Separate Language Server package
39
+ '../bin/oxide-helper.js' ,
40
+
41
+ // Bundled with the VSCode extension
42
+ '../dist/oxide-helper.js' ,
43
+ ]
44
+
45
+ let module : string | null = null
46
+
47
+ for ( let relativePath of modulePaths ) {
48
+ let filepath = path . resolve ( path . dirname ( __filename ) , relativePath )
49
+
50
+ if (
51
+ await fs . access ( filepath ) . then (
52
+ ( ) => true ,
53
+ ( ) => false ,
54
+ )
55
+ ) {
56
+ module = filepath
57
+ break
58
+ }
59
+ }
60
+
61
+ if ( ! module ) throw new Error ( 'unable to load' )
36
62
37
63
let helper = proc . fork ( module )
38
64
let connection = rpc . createMessageConnection (
Original file line number Diff line number Diff line change 362
362
}
363
363
},
364
364
"scripts" : {
365
- "_esbuild" : " node ../../esbuild.mjs src/extension.ts src/server.ts src/cssServer.ts --outdir=dist" ,
365
+ "_esbuild" : " node ../../esbuild.mjs src/extension.ts src/server.ts src/cssServer.ts src/oxide-helper.ts --outdir=dist" ,
366
366
"dev" : " concurrently --raw --kill-others \" pnpm run watch\" \" pnpm run check --watch\" " ,
367
367
"watch" : " pnpm run clean && pnpm run _esbuild --watch" ,
368
368
"build" : " pnpm run check && pnpm run clean && pnpm run _esbuild --minify && move-file dist/server.js dist/tailwindServer.js && move-file dist/cssServer.js dist/tailwindModeServer.js" ,
Original file line number Diff line number Diff line change
1
+ import '@tailwindcss/language-server/src/oxide-helper'
You can’t perform that action at this time.
0 commit comments