Code: enable prettier trailing commas
This commit is contained in:
@@ -46,17 +46,17 @@ function createTask(spec: Runnable): vscode.Task {
|
||||
label: spec.label,
|
||||
command: spec.bin,
|
||||
args: spec.args,
|
||||
env: spec.env
|
||||
env: spec.env,
|
||||
};
|
||||
|
||||
const execOption: vscode.ShellExecutionOptions = {
|
||||
cwd: spec.cwd || '.',
|
||||
env: definition.env
|
||||
env: definition.env,
|
||||
};
|
||||
const exec = new vscode.ShellExecution(
|
||||
definition.command,
|
||||
definition.args,
|
||||
execOption
|
||||
execOption,
|
||||
);
|
||||
|
||||
const f = vscode.workspace.workspaceFolders![0];
|
||||
@@ -66,7 +66,7 @@ function createTask(spec: Runnable): vscode.Task {
|
||||
definition.label,
|
||||
TASK_SOURCE,
|
||||
exec,
|
||||
['$rustc']
|
||||
['$rustc'],
|
||||
);
|
||||
t.presentationOptions.clear = true;
|
||||
return t;
|
||||
@@ -79,17 +79,17 @@ export async function handle() {
|
||||
return;
|
||||
}
|
||||
const textDocument: lc.TextDocumentIdentifier = {
|
||||
uri: editor.document.uri.toString()
|
||||
uri: editor.document.uri.toString(),
|
||||
};
|
||||
const params: RunnablesParams = {
|
||||
textDocument,
|
||||
position: Server.client.code2ProtocolConverter.asPosition(
|
||||
editor.selection.active
|
||||
)
|
||||
editor.selection.active,
|
||||
),
|
||||
};
|
||||
const runnables = await Server.client.sendRequest<Runnable[]>(
|
||||
'rust-analyzer/runnables',
|
||||
params
|
||||
params,
|
||||
);
|
||||
const items: RunnableQuickPick[] = [];
|
||||
if (prevRunnable) {
|
||||
@@ -124,7 +124,7 @@ export async function handleSingle(runnable: Runnable) {
|
||||
task.presentationOptions = {
|
||||
reveal: vscode.TaskRevealKind.Always,
|
||||
panel: vscode.TaskPanelKind.Dedicated,
|
||||
clear: true
|
||||
clear: true,
|
||||
};
|
||||
|
||||
return vscode.tasks.executeTask(task);
|
||||
@@ -136,7 +136,7 @@ export async function handleSingle(runnable: Runnable) {
|
||||
* that, when accepted, allow us to `cargo install cargo-watch` and then run it.
|
||||
*/
|
||||
export async function interactivelyStartCargoWatch(
|
||||
context: vscode.ExtensionContext
|
||||
context: vscode.ExtensionContext,
|
||||
): Promise<CargoWatchProvider | undefined> {
|
||||
if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') {
|
||||
return;
|
||||
@@ -146,7 +146,7 @@ export async function interactivelyStartCargoWatch(
|
||||
const watch = await vscode.window.showInformationMessage(
|
||||
'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)',
|
||||
'yes',
|
||||
'no'
|
||||
'no',
|
||||
);
|
||||
if (watch !== 'yes') {
|
||||
return;
|
||||
@@ -157,12 +157,12 @@ export async function interactivelyStartCargoWatch(
|
||||
}
|
||||
|
||||
export async function startCargoWatch(
|
||||
context: vscode.ExtensionContext
|
||||
context: vscode.ExtensionContext,
|
||||
): Promise<CargoWatchProvider | undefined> {
|
||||
const execPromise = util.promisify(child_process.exec);
|
||||
|
||||
const { stderr, code = 0 } = await execPromise(
|
||||
'cargo watch --version'
|
||||
'cargo watch --version',
|
||||
).catch(e => e);
|
||||
|
||||
if (stderr.includes('no such subcommand: `watch`')) {
|
||||
@@ -171,7 +171,7 @@ export async function startCargoWatch(
|
||||
const install = await vscode.window.showInformationMessage(
|
||||
msg,
|
||||
'yes',
|
||||
'no'
|
||||
'no',
|
||||
);
|
||||
if (install !== 'yes') {
|
||||
return;
|
||||
@@ -192,20 +192,20 @@ export async function startCargoWatch(
|
||||
label,
|
||||
bin: 'cargo',
|
||||
args: ['install', 'cargo-watch'],
|
||||
env: {}
|
||||
})
|
||||
env: {},
|
||||
}),
|
||||
);
|
||||
await taskFinished;
|
||||
const output = await execPromise('cargo watch --version').catch(e => e);
|
||||
if (output.stderr !== '') {
|
||||
vscode.window.showErrorMessage(
|
||||
`Couldn't install \`cargo-\`watch: ${output.stderr}`
|
||||
`Couldn't install \`cargo-\`watch: ${output.stderr}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else if (code !== 0) {
|
||||
vscode.window.showErrorMessage(
|
||||
`\`cargo watch\` failed with ${code}: ${stderr}`
|
||||
`\`cargo watch\` failed with ${code}: ${stderr}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user