Reformat using Prettier

This commit is contained in:
Igor Matuszewski 2019-03-18 22:15:03 +01:00
parent 7d2378ed7d
commit 5c3cc8c95f
2 changed files with 35 additions and 17 deletions

View File

@ -128,7 +128,7 @@ export const autoCargoWatchTask: vscode.Task = {
name: 'cargo watch',
source: 'rust-analyzer',
definition: {
type: "dupa",
type: 'watch'
},
execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }),
@ -138,8 +138,8 @@ export const autoCargoWatchTask: vscode.Task = {
clear: true
},
// Not yet exposed in the vscode.d.ts
runOptions: {
runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
} as unknown as vscode.RunOptions,
// https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
runOptions: ({
runOn: 2 // RunOnOptions.folderOpen
} as unknown) as vscode.RunOptions
};

View File

@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
const allNotifications: Iterable<
[string, lc.GenericNotificationHandler]
> = [
[
'rust-analyzer/publishDecorations',
notifications.publishDecorations.handle
]
];
[
'rust-analyzer/publishDecorations',
notifications.publishDecorations.handle
]
];
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
// The events below are plain old javascript events, triggered and handled by vscode
@ -146,10 +146,17 @@ async function askToCargoWatch() {
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`')) {
const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
const install = await vscode.window.showInformationMessage(msg, 'yes', 'no');
const msg =
'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
const install = await vscode.window.showInformationMessage(
msg,
'yes',
'no'
);
if (install === 'no') {
return;
}
@ -160,15 +167,26 @@ async function askToCargoWatch() {
if (execution.task.name === label) {
disposable.dispose();
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;
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 !== '') {
vscode.window.showErrorMessage(`Couldn't install \`cargo-\`watch: ${stderr}`);
vscode.window.showErrorMessage(
`Couldn't install \`cargo-\`watch: ${stderr}`
);
return;
}
}