mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Reformat using Prettier
This commit is contained in:
parent
7d2378ed7d
commit
5c3cc8c95f
2 changed files with 35 additions and 17 deletions
|
@ -128,7 +128,7 @@ export const autoCargoWatchTask: vscode.Task = {
|
||||||
name: 'cargo watch',
|
name: 'cargo watch',
|
||||||
source: 'rust-analyzer',
|
source: 'rust-analyzer',
|
||||||
definition: {
|
definition: {
|
||||||
type: "dupa",
|
type: 'watch'
|
||||||
},
|
},
|
||||||
execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }),
|
execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }),
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ export const autoCargoWatchTask: vscode.Task = {
|
||||||
clear: true
|
clear: true
|
||||||
},
|
},
|
||||||
// Not yet exposed in the vscode.d.ts
|
// Not yet exposed in the vscode.d.ts
|
||||||
runOptions: {
|
// https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
|
||||||
runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
|
runOptions: ({
|
||||||
} as unknown as vscode.RunOptions,
|
runOn: 2 // RunOnOptions.folderOpen
|
||||||
|
} as unknown) as vscode.RunOptions
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
const allNotifications: Iterable<
|
const allNotifications: Iterable<
|
||||||
[string, lc.GenericNotificationHandler]
|
[string, lc.GenericNotificationHandler]
|
||||||
> = [
|
> = [
|
||||||
[
|
[
|
||||||
'rust-analyzer/publishDecorations',
|
'rust-analyzer/publishDecorations',
|
||||||
notifications.publishDecorations.handle
|
notifications.publishDecorations.handle
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
||||||
|
|
||||||
// The events below are plain old javascript events, triggered and handled by vscode
|
// The events below are plain old javascript events, triggered and handled by vscode
|
||||||
|
@ -146,10 +146,17 @@ async function askToCargoWatch() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e);
|
const { stderr } = await util
|
||||||
|
.promisify(exec)('cargo watch --version')
|
||||||
|
.catch(e => e);
|
||||||
if (stderr.includes('no such subcommand: `watch`')) {
|
if (stderr.includes('no such subcommand: `watch`')) {
|
||||||
const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
|
const msg =
|
||||||
const install = await vscode.window.showInformationMessage(msg, 'yes', 'no');
|
'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
|
||||||
|
const install = await vscode.window.showInformationMessage(
|
||||||
|
msg,
|
||||||
|
'yes',
|
||||||
|
'no'
|
||||||
|
);
|
||||||
if (install === 'no') {
|
if (install === 'no') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -160,15 +167,26 @@ async function askToCargoWatch() {
|
||||||
if (execution.task.name === label) {
|
if (execution.task.name === label) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
resolve();
|
resolve();
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.tasks.executeTask(createTask({ label, bin: 'cargo', args: ['install', 'cargo-watch'], env: {} }));
|
vscode.tasks.executeTask(
|
||||||
|
createTask({
|
||||||
|
label,
|
||||||
|
bin: 'cargo',
|
||||||
|
args: ['install', 'cargo-watch'],
|
||||||
|
env: {}
|
||||||
|
})
|
||||||
|
);
|
||||||
await taskFinished;
|
await taskFinished;
|
||||||
const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e);
|
const { stderr } = await util
|
||||||
|
.promisify(exec)('cargo watch --version')
|
||||||
|
.catch(e => e);
|
||||||
if (stderr !== '') {
|
if (stderr !== '') {
|
||||||
vscode.window.showErrorMessage(`Couldn't install \`cargo-\`watch: ${stderr}`);
|
vscode.window.showErrorMessage(
|
||||||
|
`Couldn't install \`cargo-\`watch: ${stderr}`
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue