@@ -100,29 +100,29 @@ export async function activate(
100100 }
101101
102102 const path = await findBinary ( ) ;
103-
104- const run : Executable =
105- process . env . OXLINT_LSP_TEST === 'true'
106- ? {
107- command : 'node' ,
108- args : [ path ! , '--lsp' ] ,
109- options : {
110- env : serverEnv ,
111- } ,
112- }
113- : {
114- command : path ! ,
115- args : [ '--lsp' ] ,
116- options : {
117- // On Windows we need to run the binary in a shell to be able to execute the shell npm bin script.
118- // Searching for the right `.exe` file inside `node_modules/` is not reliable as it depends on
119- // the package manager used (npm, yarn, pnpm, etc) and the package version.
120- // The npm bin script is a shell script that points to the actual binary.
121- // Security: We validated the userDefinedBinary in `configService.getUserServerBinPath()`.
122- shell : process . platform === 'win32' ,
123- env : serverEnv ,
124- } ,
125- } ;
103+ const isNode = path . endsWith ( '.js' ) || path . endsWith ( '.cjs' ) || path . endsWith ( '.mjs' ) ;
104+
105+ const run : Executable = isNode
106+ ? {
107+ command : 'node' ,
108+ args : [ path ! , '--lsp' ] ,
109+ options : {
110+ env : serverEnv ,
111+ } ,
112+ }
113+ : {
114+ command : path ! ,
115+ args : [ '--lsp' ] ,
116+ options : {
117+ // On Windows we need to run the binary in a shell to be able to execute the shell npm bin script.
118+ // Searching for the right `.exe` file inside `node_modules/` is not reliable as it depends on
119+ // the package manager used (npm, yarn, pnpm, etc) and the package version.
120+ // The npm bin script is a shell script that points to the actual binary.
121+ // Security: We validated the userDefinedBinary in `configService.getUserServerBinPath()`.
122+ shell : process . platform === 'win32' ,
123+ env : serverEnv ,
124+ } ,
125+ } ;
126126
127127 const serverOptions : ServerOptions = {
128128 run,
0 commit comments