Skip to content

Commit 01ab588

Browse files
committed
Run prettier automatic fixer
1 parent ccc78df commit 01ab588

File tree

377 files changed

+10041
-6216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+10041
-6216
lines changed

src/common.ts

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function getExtensionPath() {
2626
export function getUnixTempDirectory() {
2727
const envTmp = process.env.TMPDIR;
2828
if (!envTmp) {
29-
return "/tmp/";
29+
return '/tmp/';
3030
}
3131

3232
return envTmp;
@@ -38,14 +38,14 @@ export function sum<T>(arr: T[], selector: (item: T) => number): number {
3838

3939
export async function mapAsync<T1, T2>(
4040
array: T1[],
41-
selector: (value: T1, index: number, array: T1[]) => Promise<T2>,
41+
selector: (value: T1, index: number, array: T1[]) => Promise<T2>
4242
): Promise<T2[]> {
4343
return Promise.all(array.map(selector));
4444
}
4545

4646
export async function filterAsync<T>(
4747
array: T[],
48-
predicate: (value: T, index: number, array: T[]) => Promise<boolean>,
48+
predicate: (value: T, index: number, array: T[]) => Promise<boolean>
4949
): Promise<T[]> {
5050
const filterMap = await mapAsync(array, predicate);
5151
return array.filter((_, index) => filterMap[index]);
@@ -56,18 +56,22 @@ export function safeLength<T>(arr: T[] | undefined) {
5656
return arr ? arr.length : 0;
5757
}
5858

59-
export async function execChildProcess(command: string, workingDirectory: string = getExtensionPath(), env: NodeJS.ProcessEnv = {}): Promise<string> {
59+
export async function execChildProcess(
60+
command: string,
61+
workingDirectory: string = getExtensionPath(),
62+
env: NodeJS.ProcessEnv = {}
63+
): Promise<string> {
6064
return new Promise<string>((resolve, reject) => {
6165
cp.exec(command, { cwd: workingDirectory, maxBuffer: 500 * 1024, env: env }, (error, stdout, stderr) => {
6266
if (error) {
63-
reject(new Error(`${error}
67+
reject(
68+
new Error(`${error}
6469
${stdout}
65-
${stderr}`));
66-
}
67-
else if (stderr && !stderr.includes("screen size is bogus")) {
70+
${stderr}`)
71+
);
72+
} else if (stderr && !stderr.includes('screen size is bogus')) {
6873
reject(new Error(stderr));
69-
}
70-
else {
74+
} else {
7175
resolve(stdout);
7276
}
7377
});
@@ -81,7 +85,7 @@ export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
8185
return reject(error);
8286
}
8387

84-
if (stderr && !stderr.includes("screen size is bogus")) {
88+
if (stderr && !stderr.includes('screen size is bogus')) {
8589
return reject(new Error(stderr));
8690
}
8791

@@ -90,7 +94,7 @@ export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
9094
}
9195

9296
const lines = stdout.split(os.EOL);
93-
const pairs = lines.map(line => line.trim().split(/\s+/));
97+
const pairs = lines.map((line) => line.trim().split(/\s+/));
9498

9599
const children = [];
96100

@@ -111,36 +115,34 @@ export async function fileExists(filePath: string): Promise<boolean> {
111115
fs.stat(filePath, (err, stats) => {
112116
if (stats && stats.isFile()) {
113117
resolve(true);
114-
}
115-
else {
118+
} else {
116119
resolve(false);
117120
}
118121
});
119122
});
120123
}
121124

122125
export async function deleteIfExists(filePath: string): Promise<void> {
123-
return fileExists(filePath)
124-
.then(async (exists: boolean) => {
125-
return new Promise<void>((resolve, reject) => {
126-
if (!exists) {
127-
return resolve();
128-
}
126+
return fileExists(filePath).then(async (exists: boolean) => {
127+
return new Promise<void>((resolve, reject) => {
128+
if (!exists) {
129+
return resolve();
130+
}
129131

130-
fs.unlink(filePath, err => {
131-
if (err) {
132-
return reject(err);
133-
}
132+
fs.unlink(filePath, (err) => {
133+
if (err) {
134+
return reject(err);
135+
}
134136

135-
resolve();
136-
});
137+
resolve();
137138
});
138139
});
140+
});
139141
}
140142

141143
export enum InstallFileType {
142144
Begin,
143-
Lock
145+
Lock,
144146
}
145147

146148
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
@@ -154,7 +156,7 @@ export async function installFileExists(folderPath: AbsolutePath, type: InstallF
154156

155157
export async function touchInstallFile(folderPath: AbsolutePath, type: InstallFileType): Promise<void> {
156158
return new Promise<void>((resolve, reject) => {
157-
fs.writeFile(getInstallFilePath(folderPath, type), '', err => {
159+
fs.writeFile(getInstallFilePath(folderPath, type), '', (err) => {
158160
if (err) {
159161
reject(err);
160162
return;
@@ -167,7 +169,7 @@ export async function touchInstallFile(folderPath: AbsolutePath, type: InstallFi
167169

168170
export async function deleteInstallFile(folderPath: AbsolutePath, type: InstallFileType): Promise<void> {
169171
return new Promise<void>((resolve, reject) => {
170-
fs.unlink(getInstallFilePath(folderPath, type), err => {
172+
fs.unlink(getInstallFilePath(folderPath, type), (err) => {
171173
if (err) {
172174
reject(err);
173175
return;
@@ -196,25 +198,31 @@ export function isSubfolderOf(subfolder: string, folder: string): boolean {
196198
const folderArray: string[] = folder.split(path.sep);
197199

198200
// Check to see that every sub directory in subfolder exists in folder.
199-
return subfolderArray.length <= folderArray.length && subfolderArray.every((subpath, index) => folderArray[index] === subpath);
201+
return (
202+
subfolderArray.length <= folderArray.length &&
203+
subfolderArray.every((subpath, index) => folderArray[index] === subpath)
204+
);
200205
}
201206

202207
/**
203208
* Find PowerShell executable from PATH (for Windows only).
204209
*/
205210
export function findPowerShell(): string | undefined {
206-
const dirs: string[] = (process.env.PATH || '').replace(/"+/g, '').split(';').filter(x => x);
211+
const dirs: string[] = (process.env.PATH || '')
212+
.replace(/"+/g, '')
213+
.split(';')
214+
.filter((x) => x);
207215
const names: string[] = ['pwsh.exe', 'powershell.exe'];
208216
for (const name of names) {
209-
const candidates: string[] = dirs.reduce<string[]>((paths, dir) => [
210-
...paths, path.join(dir, name)
211-
], []);
217+
const candidates: string[] = dirs.reduce<string[]>((paths, dir) => [...paths, path.join(dir, name)], []);
212218
for (const candidate of candidates) {
213219
try {
214220
if (fs.statSync(candidate).isFile()) {
215221
return name;
216222
}
217-
} catch (e) { /* empty */ }
223+
} catch (e) {
224+
/* empty */
225+
}
218226
}
219227
}
220228
}

src/compositeDisposable.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Subscription } from "rxjs";
7-
import Disposable, { IDisposable } from "./disposable";
6+
import { Subscription } from 'rxjs';
7+
import Disposable, { IDisposable } from './disposable';
88

99
export default class CompositeDisposable extends Disposable {
1010
private disposables = new Subscription();
@@ -15,16 +15,15 @@ export default class CompositeDisposable extends Disposable {
1515
for (const disposable of disposables) {
1616
if (disposable) {
1717
this.add(disposable);
18-
}
19-
else {
20-
throw new Error("null disposables are not supported");
18+
} else {
19+
throw new Error('null disposables are not supported');
2120
}
2221
}
2322
}
2423

2524
public add(disposable: IDisposable) {
2625
if (!disposable) {
27-
throw new Error("disposable cannot be null");
26+
throw new Error('disposable cannot be null');
2827
}
2928

3029
this.disposables.add(() => disposable.dispose());

src/constants/IGetDotnetInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { DotnetInfo } from "../utils/getDotnetInfo";
6+
import { DotnetInfo } from '../utils/getDotnetInfo';
77

88
export interface IGetDotnetInfo {
99
(dotNetCliPaths: string[]): Promise<DotnetInfo>;
10-
}
10+
}

src/constants/csharpExtensionId.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
export const CSharpExtensionId = 'ms-dotnettools.csharp';
6+
export const CSharpExtensionId = 'ms-dotnettools.csharp';

0 commit comments

Comments
 (0)