Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {

import { EXTENSION_NAME, SETTINGS } from './const';
import { getLogger } from './logger';
import { workspaceRoot } from './utils';

const LOGGER = getLogger();

Expand All @@ -18,9 +19,10 @@ export const createLanguageClient = async (): Promise<LanguageClient | null> =>

const isAvailable = await checkLspAvailability(lspPath);
if (!isAvailable) {
LOGGER.warning(`Just LSP binary not found at path: ${lspPath}.`);
vscode.window
.showWarningMessage(
`Just LSP binary found but not working: ${lspPath}. Please check the installation or configure the path in settings.`,
`Just LSP binary not found at path: ${lspPath}. Please check the installation or configure the path in settings.`,
'Install Instructions',
)
.then((selection) => {
Expand All @@ -37,6 +39,9 @@ export const createLanguageClient = async (): Promise<LanguageClient | null> =>
const serverOptions: ServerOptions = {
command: lspPath,
args: [],
options: {
cwd: workspaceRoot(),
},
};

const clientOptions: LanguageClientOptions = {
Expand Down Expand Up @@ -76,7 +81,10 @@ export const stopLanguageClient = async (): Promise<void> => {

const checkLspAvailability = (lspPath: string): Promise<boolean> => {
return new Promise((resolve) => {
const process = spawn(lspPath, ['--version'], { stdio: 'ignore' });
const process = spawn(lspPath, ['--version'], {
stdio: 'ignore',
cwd: workspaceRoot(),
});

process.on('close', (code: number) => {
resolve(code === 0);
Expand Down
Loading