Updated to pass workspace as parameter for server args

This commit is contained in:
2026-04-01 00:39:21 -05:00
parent 9115b93eda
commit 5b5850729c
2 changed files with 18 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ ENV PATH="${JAVA_LS_PATH}/:${PATH}"
ENV PATH="${JDTLS_PATH}/bin:${PATH}" ENV PATH="${JDTLS_PATH}/bin:${PATH}"
ENV PATH="${MAVEN_PATH}/bin:${PATH}" ENV PATH="${MAVEN_PATH}/bin:${PATH}"
ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV PATH="${JAVA_HOME}/bin:${PATH}"
ENV PATH="/opt:${PATH}"
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1

View File

@@ -28,24 +28,29 @@ console.log("Started websocket server on port: ", _port);
wss.on('connection', (ws, req) => { wss.on('connection', (ws, req) => {
const pathname = url.parse(req.url).pathname; // ws://localhost:6005/gdscript?workspace=/yolo
handleLanguageConnection(ws, pathname.substring(1)); const address = url.parse(req.url, true);
const pathname = address.pathname.substring(1);
const qdata = address.query;
const workspace = qdata.workspace;
handleLanguageConnection(ws, pathname, workspace);
}); });
function handleLanguageConnection(ws, pathname) { function handleLanguageConnection(ws, pathname, workspace) {
const server = servers.find(server => server.endpointName === pathname); const server = servers.find(server => server.endpointName === pathname);
setupLanguageServer(ws, server); setupLanguageServer(ws, server, workspace);
} }
function setupLanguageServer(ws, server) { function setupLanguageServer(ws, server, workspace) {
if (!server) return; if (!server) return;
const { const {
reader, reader,
writer writer
} = startLanguageServer(server); } = startLanguageServer(server, workspace);
server.writer = writer; server.writer = writer;
@@ -76,9 +81,12 @@ function setupLanguageServer(ws, server) {
}); });
} }
function startLanguageServer(languageServer) { function startLanguageServer(languageServer, workspace) {
let env = process.env; const env = process.env;
const serverProcess = spawn(...languageServer.args, {env, shell: true}); const args = languageServer.args.map(arg =>
typeof arg === 'string' ? arg.replace('{workspace.path}', workspace || '') : arg
).filter(arg => arg !== '');
const serverProcess = spawn(...args, {env, shell: true});
serverProcess.stderr.on('data', data => { serverProcess.stderr.on('data', data => {
console.error(`${serverProcess.spawnfile} error: ${data}`); console.error(`${serverProcess.spawnfile} error: ${data}`);