resolve "~" in raLspServerPath
This commit is contained in:
xfoxfu 2019-08-19 10:48:39 +08:00
parent 2bac1bdf17
commit d07a85ed7e

View file

@ -1,9 +1,17 @@
import { homedir } from 'os';
import * as lc from 'vscode-languageclient'; import * as lc from 'vscode-languageclient';
import { window, workspace } from 'vscode'; import { window, workspace } from 'vscode';
import { Config } from './config'; import { Config } from './config';
import { Highlighter } from './highlighting'; import { Highlighter } from './highlighting';
function expandPathResolving(path: string) {
if (path.startsWith('~/')) {
return path.replace('~', homedir());
}
return path;
}
export class Server { export class Server {
public static highlighter = new Highlighter(); public static highlighter = new Highlighter();
public static config = new Config(); public static config = new Config();
@ -20,7 +28,7 @@ export class Server {
} }
const run: lc.Executable = { const run: lc.Executable = {
command: this.config.raLspServerPath, command: expandPathResolving(this.config.raLspServerPath),
options: { cwd: folder } options: { cwd: folder }
}; };
const serverOptions: lc.ServerOptions = { const serverOptions: lc.ServerOptions = {