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 11import * as rpc from 'vscode-jsonrpc/node'
22import * as proc from 'node:child_process'
33import * as path from 'node:path'
4+ import * as fs from 'node:fs/promises'
45import { type ScanOptions , type ScanResult } from './oxide'
56
67/**
@@ -32,7 +33,32 @@ export class OxideSession {
3233
3334 // TODO: Can we find a way to not require a build first?
3435 // 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' )
3662
3763 let helper = proc . fork ( module )
3864 let connection = rpc . createMessageConnection (
Original file line number Diff line number Diff line change 362362 }
363363 },
364364 "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" ,
366366 "dev" : " concurrently --raw --kill-others \" pnpm run watch\" \" pnpm run check --watch\" " ,
367367 "watch" : " pnpm run clean && pnpm run _esbuild --watch" ,
368368 "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