Skip to content

Commit af999f1

Browse files
Veykrilbruno-ortiz
authored andcommitted
Reformat VSCode client code
1 parent d1721b1 commit af999f1

File tree

4 files changed

+36
-41
lines changed

4 files changed

+36
-41
lines changed

editors/code/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { applySnippetWorkspaceEdit, applySnippetTextEdits } from "./snippets";
88
import { spawnSync } from "child_process";
99
import { RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
1010
import { AstInspector } from "./ast_inspector";
11-
import { isRustDocument, isCargoTomlDocument, sleep, isRustEditor, RustEditor } from './util';
11+
import { isRustDocument, isCargoTomlDocument, sleep, isRustEditor, RustEditor } from "./util";
1212
import { startDebugSession, makeDebugConfig } from "./debug";
1313
import { LanguageClient } from "vscode-languageclient/node";
1414
import { LINKED_COMMANDS } from "./client";

editors/code/src/ctx.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@ import * as lc from "vscode-languageclient/node";
33
import * as ra from "./lsp_ext";
44
import * as path from "path";
55

6-
import {Config, prepareVSCodeConfig} from './config';
7-
import {createClient} from './client';
6+
import {Config, prepareVSCodeConfig} from "./config";
7+
import {createClient} from "./client";
88
import {
99
executeDiscoverProject,
1010
isRustDocument,
1111
isRustEditor,
1212
LazyOutputChannel,
1313
log,
1414
RustEditor,
15-
} from './util';
16-
import {ServerStatusParams} from './lsp_ext';
17-
import { Dependency, DependencyFile, RustDependenciesProvider, DependencyId } from './dependencies_provider';
18-
import { execRevealDependency } from './commands';
15+
} from "./util";
16+
import {ServerStatusParams} from "./lsp_ext";
17+
import {
18+
Dependency,
19+
DependencyFile,
20+
RustDependenciesProvider,
21+
DependencyId,
22+
} from "./dependencies_provider";
23+
import { execRevealDependency } from "./commands";
1924
import {
2025
Dependency,
2126
DependencyFile,

editors/code/src/dependencies_provider.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { FetchDependencyGraphResult } from "./lsp_ext";
77

88

99

10-
export class RustDependenciesProvider implements vscode.TreeDataProvider<Dependency | DependencyFile>{
10+
export class RustDependenciesProvider
11+
implements vscode.TreeDataProvider<Dependency | DependencyFile>
12+
{
1113

1214
dependenciesMap: { [id: string]: Dependency | DependencyFile };ctx: CtxInit;
1315

@@ -49,7 +51,9 @@ export class RustDependenciesProvider implements vscode.TreeDataProvider<Depende
4951
return element;
5052
}
5153

52-
getChildren(element?: Dependency | DependencyFile): vscode.ProviderResult<Dependency[] | DependencyFile[]> {
54+
getChildren(
55+
element?: Dependency | DependencyFile
56+
): vscode.ProviderResult<Dependency[] | DependencyFile[]> {
5357
return new Promise((resolve, _reject) => {
5458
if (!this.workspaceRoot) {
5559
void vscode.window.showInformationMessage("No dependency in empty workspace");
@@ -61,19 +65,12 @@ export class RustDependenciesProvider implements vscode.TreeDataProvider<Depende
6165
const filePath = fspath.join(element.dependencyPath, fileName);
6266
const collapsibleState = fs.lstatSync(filePath).isDirectory()
6367
? vscode.TreeItemCollapsibleState.Collapsed
64-
:vscode.TreeItemCollapsibleState.None;
65-
const dep = new DependencyFile(
66-
fileName,
67-
filePath,
68-
element,
69-
collapsibleState);
70-
68+
: vscode.TreeItemCollapsibleState.None;
69+
const dep = new DependencyFile(fileName, filePath, element, collapsibleState);
7170
this.dependenciesMap[dep.dependencyPath.toLowerCase()] = dep;
7271
return dep;
7372
});
74-
return resolve(
75-
files
76-
);
73+
return resolve(files);
7774
} else {
7875
return resolve(this.getRootDependencies());
7976
}
@@ -118,7 +115,6 @@ export class Dependency extends vscode.TreeItem {
118115
}
119116

120117
export class DependencyFile extends vscode.TreeItem {
121-
122118
constructor(
123119
readonly label: string,
124120
readonly dependencyPath: string,

editors/code/src/toolchain.ts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ export class Cargo {
103103
return await new Promise((resolve, reject) => {
104104
const crates: Crate[] = [];
105105

106-
const cargo = cp.spawn(pathToCargo, ['tree', '--prefix', 'none'], {
107-
stdio: ['ignore', 'pipe', 'pipe'],
108-
cwd: this.rootFolder
106+
const cargo = cp.spawn(pathToCargo, ["tree", "--prefix", "none"], {
107+
stdio: ["ignore", "pipe", "pipe"],
108+
cwd: this.rootFolder,
109109
});
110110
const rl = readline.createInterface({ input: cargo.stdout });
111-
rl.on('line', line => {
111+
rl.on("line", (line) => {
112112
const match = line.match(TREE_LINE_PATTERN);
113113
if (match) {
114114
const name = match[1];
@@ -121,18 +121,15 @@ export class Cargo {
121121
crates.push({ name, version });
122122
}
123123
});
124-
cargo.on('exit', (exitCode, _) => {
125-
if (exitCode === 0)
126-
resolve(crates);
127-
else
128-
reject(new Error(`exit code: ${exitCode}.`));
124+
cargo.on("exit", (exitCode, _) => {
125+
if (exitCode === 0) resolve(crates);
126+
else reject(new Error(`exit code: ${exitCode}.`));
129127
});
130-
131128
});
132129
}
133130

134131
private shouldIgnore(extraInfo: string): boolean {
135-
return extraInfo !== undefined && (extraInfo === '*' || path.isAbsolute(extraInfo));
132+
return extraInfo !== undefined && (extraInfo === "*" || path.isAbsolute(extraInfo));
136133
}
137134

138135
private async runCargo(
@@ -169,26 +166,23 @@ export class Cargo {
169166
export async function activeToolchain(): Promise<string> {
170167
const pathToRustup = await rustupPath();
171168
return await new Promise((resolve, reject) => {
172-
const execution = cp.spawn(pathToRustup, ['show', 'active-toolchain'], {
173-
stdio: ['ignore', 'pipe', 'pipe'],
174-
cwd: os.homedir()
169+
const execution = cp.spawn(pathToRustup, ["show", "active-toolchain"], {
170+
stdio: ["ignore", "pipe", "pipe"],
171+
cwd: os.homedir(),
175172
});
176173
const rl = readline.createInterface({ input: execution.stdout });
177174

178175
let currToolchain: string | undefined = undefined;
179-
rl.on('line', line => {
176+
rl.on("line", (line) => {
180177
const match = line.match(TOOLCHAIN_PATTERN);
181178
if (match) {
182179
currToolchain = match[1];
183180
}
184181
});
185-
execution.on('exit', (exitCode, _) => {
186-
if (exitCode === 0 && currToolchain)
187-
resolve(currToolchain);
188-
else
189-
reject(new Error(`exit code: ${exitCode}.`));
182+
execution.on("exit", (exitCode, _) => {
183+
if (exitCode === 0 && currToolchain) resolve(currToolchain);
184+
else reject(new Error(`exit code: ${exitCode}.`));
190185
});
191-
192186
});
193187
}
194188

0 commit comments

Comments
 (0)