diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-02 22:22:45 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-02 22:22:45 +0100 |
commit | cb482e6351c4005f29bb89d38c64c4e3f93d7a6d (patch) | |
tree | c96d88e98c1a4fd59c37741e94faeefe465f4fb3 /editors/code | |
parent | 57cd936c5262c3b43626618be42d7a72f71c3539 (diff) | |
parent | 2f6ab77708ae104c854712285af19516287b6906 (diff) |
Merge remote-tracking branch 'upstream/master' into compute-lazy-assits
# Conflicts:
# crates/rust-analyzer/src/to_proto.rs
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package.json | 4 | ||||
-rw-r--r-- | editors/code/src/debug.ts | 12 | ||||
-rw-r--r-- | editors/code/src/lsp_ext.ts | 17 | ||||
-rw-r--r-- | editors/code/src/run.ts | 21 |
4 files changed, 31 insertions, 23 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index 75dbafc05..d8f4287fd 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -238,7 +238,7 @@ | |||
238 | }, | 238 | }, |
239 | "rust-analyzer.cargo.allFeatures": { | 239 | "rust-analyzer.cargo.allFeatures": { |
240 | "type": "boolean", | 240 | "type": "boolean", |
241 | "default": true, | 241 | "default": false, |
242 | "description": "Activate all available features" | 242 | "description": "Activate all available features" |
243 | }, | 243 | }, |
244 | "rust-analyzer.cargo.features": { | 244 | "rust-analyzer.cargo.features": { |
@@ -319,7 +319,7 @@ | |||
319 | }, | 319 | }, |
320 | "rust-analyzer.checkOnSave.allFeatures": { | 320 | "rust-analyzer.checkOnSave.allFeatures": { |
321 | "type": "boolean", | 321 | "type": "boolean", |
322 | "default": true, | 322 | "default": false, |
323 | "markdownDescription": "Check with all features (will be passed as `--all-features`)" | 323 | "markdownDescription": "Check with all features (will be passed as `--all-features`)" |
324 | }, | 324 | }, |
325 | "rust-analyzer.inlayHints.enable": { | 325 | "rust-analyzer.inlayHints.enable": { |
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 1e421d407..a0c9b3ab2 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts | |||
@@ -114,8 +114,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v | |||
114 | } | 114 | } |
115 | 115 | ||
116 | async function getDebugExecutable(runnable: ra.Runnable): Promise<string> { | 116 | async function getDebugExecutable(runnable: ra.Runnable): Promise<string> { |
117 | const cargo = new Cargo(runnable.cwd || '.', debugOutput); | 117 | const cargo = new Cargo(runnable.args.workspaceRoot || '.', debugOutput); |
118 | const executable = await cargo.executableFromArgs(runnable.args); | 118 | const executable = await cargo.executableFromArgs(runnable.args.cargoArgs); |
119 | 119 | ||
120 | // if we are here, there were no compilation errors. | 120 | // if we are here, there were no compilation errors. |
121 | return executable; | 121 | return executable; |
@@ -127,8 +127,8 @@ function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFil | |||
127 | request: "launch", | 127 | request: "launch", |
128 | name: runnable.label, | 128 | name: runnable.label, |
129 | program: executable, | 129 | program: executable, |
130 | args: runnable.extraArgs, | 130 | args: runnable.args.executableArgs, |
131 | cwd: runnable.cwd, | 131 | cwd: runnable.args.workspaceRoot, |
132 | sourceMap: sourceFileMap, | 132 | sourceMap: sourceFileMap, |
133 | sourceLanguages: ["rust"] | 133 | sourceLanguages: ["rust"] |
134 | }; | 134 | }; |
@@ -140,8 +140,8 @@ function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFi | |||
140 | request: "launch", | 140 | request: "launch", |
141 | name: runnable.label, | 141 | name: runnable.label, |
142 | program: executable, | 142 | program: executable, |
143 | args: runnable.extraArgs, | 143 | args: runnable.args.executableArgs, |
144 | cwd: runnable.cwd, | 144 | cwd: runnable.args.workspaceRoot, |
145 | sourceFileMap: sourceFileMap, | 145 | sourceFileMap: sourceFileMap, |
146 | }; | 146 | }; |
147 | } | 147 | } |
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index f881bae47..35d73ce31 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts | |||
@@ -53,18 +53,17 @@ export interface RunnablesParams { | |||
53 | position: lc.Position | null; | 53 | position: lc.Position | null; |
54 | } | 54 | } |
55 | 55 | ||
56 | export type RunnableKind = "cargo" | "rustc" | "rustup"; | ||
57 | |||
58 | export interface Runnable { | 56 | export interface Runnable { |
59 | range: lc.Range; | ||
60 | label: string; | 57 | label: string; |
61 | kind: RunnableKind; | 58 | location?: lc.LocationLink; |
62 | args: string[]; | 59 | kind: "cargo"; |
63 | extraArgs: string[]; | 60 | args: { |
64 | env: { [key: string]: string }; | 61 | workspaceRoot?: string; |
65 | cwd: string | null; | 62 | cargoArgs: string[]; |
63 | executableArgs: string[]; | ||
64 | }; | ||
66 | } | 65 | } |
67 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("rust-analyzer/runnables"); | 66 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); |
68 | 67 | ||
69 | export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; | 68 | export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; |
70 | 69 | ||
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 5fc4f8e41..5c790741f 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -103,18 +103,27 @@ interface CargoTaskDefinition extends vscode.TaskDefinition { | |||
103 | env?: { [key: string]: string }; | 103 | env?: { [key: string]: string }; |
104 | } | 104 | } |
105 | 105 | ||
106 | export function createTask(spec: ra.Runnable): vscode.Task { | 106 | export function createTask(runnable: ra.Runnable): vscode.Task { |
107 | const TASK_SOURCE = 'Rust'; | 107 | const TASK_SOURCE = 'Rust'; |
108 | |||
109 | let command; | ||
110 | switch (runnable.kind) { | ||
111 | case "cargo": command = toolchain.getPathForExecutable("cargo"); | ||
112 | } | ||
113 | const args = runnable.args.cargoArgs; | ||
114 | if (runnable.args.executableArgs.length > 0) { | ||
115 | args.push('--', ...runnable.args.executableArgs); | ||
116 | } | ||
108 | const definition: CargoTaskDefinition = { | 117 | const definition: CargoTaskDefinition = { |
109 | type: 'cargo', | 118 | type: 'cargo', |
110 | label: spec.label, | 119 | label: runnable.label, |
111 | command: toolchain.getPathForExecutable(spec.kind), | 120 | command, |
112 | args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, | 121 | args, |
113 | env: Object.assign({}, process.env, spec.env), | 122 | env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), |
114 | }; | 123 | }; |
115 | 124 | ||
116 | const execOption: vscode.ShellExecutionOptions = { | 125 | const execOption: vscode.ShellExecutionOptions = { |
117 | cwd: spec.cwd || '.', | 126 | cwd: runnable.args.workspaceRoot || '.', |
118 | env: definition.env, | 127 | env: definition.env, |
119 | }; | 128 | }; |
120 | const exec = new vscode.ShellExecution( | 129 | const exec = new vscode.ShellExecution( |