diff options
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/commands.ts | 4 | ||||
-rw-r--r-- | editors/code/src/lsp_ext.ts | 3 | ||||
-rw-r--r-- | editors/code/src/main.ts | 14 | ||||
-rw-r--r-- | editors/code/src/run.ts | 6 |
4 files changed, 18 insertions, 9 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 0e78f5101..19a9c2a0d 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts | |||
@@ -330,8 +330,8 @@ export function expandMacro(ctx: Ctx): Cmd { | |||
330 | }; | 330 | }; |
331 | } | 331 | } |
332 | 332 | ||
333 | export function collectGarbage(ctx: Ctx): Cmd { | 333 | export function reloadWorkspace(ctx: Ctx): Cmd { |
334 | return async () => ctx.client.sendRequest(ra.collectGarbage, null); | 334 | return async () => ctx.client.sendRequest(ra.reloadWorkspace, null); |
335 | } | 335 | } |
336 | 336 | ||
337 | export function showReferences(ctx: Ctx): Cmd { | 337 | export function showReferences(ctx: Ctx): Cmd { |
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index e16ea799c..981b6f40e 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts | |||
@@ -6,7 +6,7 @@ import * as lc from "vscode-languageclient"; | |||
6 | 6 | ||
7 | export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus"); | 7 | export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus"); |
8 | 8 | ||
9 | export const collectGarbage = new lc.RequestType<null, null, void>("rust-analyzer/collectGarbage"); | 9 | export const reloadWorkspace = new lc.RequestType<null, null, void>("rust-analyzer/reloadWorkspace"); |
10 | 10 | ||
11 | export interface SyntaxTreeParams { | 11 | export interface SyntaxTreeParams { |
12 | textDocument: lc.TextDocumentIdentifier; | 12 | textDocument: lc.TextDocumentIdentifier; |
@@ -60,6 +60,7 @@ export interface Runnable { | |||
60 | workspaceRoot?: string; | 60 | workspaceRoot?: string; |
61 | cargoArgs: string[]; | 61 | cargoArgs: string[]; |
62 | executableArgs: string[]; | 62 | executableArgs: string[]; |
63 | expectTest?: boolean; | ||
63 | }; | 64 | }; |
64 | } | 65 | } |
65 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); | 66 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); |
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index ed26c887b..a1521a93b 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -96,7 +96,7 @@ async function tryActivate(context: vscode.ExtensionContext) { | |||
96 | }); | 96 | }); |
97 | 97 | ||
98 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); | 98 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); |
99 | ctx.registerCommand('collectGarbage', commands.collectGarbage); | 99 | ctx.registerCommand('reloadWorkspace', commands.reloadWorkspace); |
100 | ctx.registerCommand('matchingBrace', commands.matchingBrace); | 100 | ctx.registerCommand('matchingBrace', commands.matchingBrace); |
101 | ctx.registerCommand('joinLines', commands.joinLines); | 101 | ctx.registerCommand('joinLines', commands.joinLines); |
102 | ctx.registerCommand('parentModule', commands.parentModule); | 102 | ctx.registerCommand('parentModule', commands.parentModule); |
@@ -160,13 +160,17 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi | |||
160 | return; | 160 | return; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | const lastCheck = state.lastCheck; | ||
164 | const now = Date.now(); | 163 | const now = Date.now(); |
164 | if (config.package.releaseTag === NIGHTLY_TAG) { | ||
165 | // Check if we should poll github api for the new nightly version | ||
166 | // if we haven't done it during the past hour | ||
167 | const lastCheck = state.lastCheck; | ||
165 | 168 | ||
166 | const anHour = 60 * 60 * 1000; | 169 | const anHour = 60 * 60 * 1000; |
167 | const shouldDownloadNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour; | 170 | const shouldCheckForNewNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour; |
168 | 171 | ||
169 | if (!shouldDownloadNightly) return; | 172 | if (!shouldCheckForNewNightly) return; |
173 | } | ||
170 | 174 | ||
171 | const release = await fetchRelease("nightly").catch((e) => { | 175 | const release = await fetchRelease("nightly").catch((e) => { |
172 | log.error(e); | 176 | log.error(e); |
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 766b05112..e1430e31f 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -108,12 +108,16 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
108 | if (runnable.args.executableArgs.length > 0) { | 108 | if (runnable.args.executableArgs.length > 0) { |
109 | args.push('--', ...runnable.args.executableArgs); | 109 | args.push('--', ...runnable.args.executableArgs); |
110 | } | 110 | } |
111 | const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" }; | ||
112 | if (runnable.args.expectTest) { | ||
113 | env["UPDATE_EXPECT"] = "1"; | ||
114 | } | ||
111 | const definition: tasks.CargoTaskDefinition = { | 115 | const definition: tasks.CargoTaskDefinition = { |
112 | type: tasks.TASK_TYPE, | 116 | type: tasks.TASK_TYPE, |
113 | command: args[0], // run, test, etc... | 117 | command: args[0], // run, test, etc... |
114 | args: args.slice(1), | 118 | args: args.slice(1), |
115 | cwd: runnable.args.workspaceRoot, | 119 | cwd: runnable.args.workspaceRoot, |
116 | env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), | 120 | env: Object.assign({}, process.env as { [key: string]: string }, env), |
117 | }; | 121 | }; |
118 | 122 | ||
119 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() | 123 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() |