Add basic task support

This adds basic support for running `cargo build`, `cargo run`, etc.
This commit is contained in:
Tim 2020-03-30 18:12:22 +01:00 committed by Tim Hutt
parent 671926ac93
commit 768aa4259f
4 changed files with 77 additions and 6 deletions

View file

@ -30,15 +30,14 @@ export function configToServerOptions(config: Config) {
};
}
export async function createClient(config: Config, serverPath: string): Promise<lc.LanguageClient> {
export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder | null): Promise<lc.LanguageClient> {
// '.' Is the fallback if no folder is open
// TODO?: Workspace folders support Uri's (eg: file://test.txt).
// It might be a good idea to test if the uri points to a file.
const workspaceFolderPath = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? '.';
const run: lc.Executable = {
command: serverPath,
options: { cwd: workspaceFolderPath },
options: { cwd: workspaceFolder?.uri.fsPath ?? '.' },
};
const serverOptions: lc.ServerOptions = {
run,