mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add basic task support
This adds basic support for running `cargo build`, `cargo run`, etc.
This commit is contained in:
parent
671926ac93
commit
768aa4259f
4 changed files with 77 additions and 6 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue