Skip to content

Commit 73f3508

Browse files
committed
Apply auto-formatting
1 parent bba1518 commit 73f3508

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

integration/vscode/ada/src/taskProviders.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,10 @@ const predefinedTasks: PredefinedTask[] = [
366366
* both 'ada' and 'spark' tasks.
367367
*/
368368
export class SimpleTaskProvider implements vscode.TaskProvider {
369-
constructor(public taskType: string, private taskDecls: PredefinedTask[]) {}
369+
constructor(
370+
public taskType: string,
371+
private taskDecls: PredefinedTask[],
372+
) {}
370373

371374
async provideTasks(token?: vscode.CancellationToken): Promise<vscode.Task[]> {
372375
if (token?.isCancellationRequested) {
@@ -433,7 +436,7 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
433436
};
434437

435438
return [buildTask, runTask, buildAndRunTask];
436-
})
439+
}),
437440
);
438441
}
439442

@@ -461,7 +464,7 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
461464
tDecl.label,
462465
tDecl.taskDef.type,
463466
undefined,
464-
tDecl.problemMatchers
467+
tDecl.problemMatchers,
465468
);
466469

467470
/**
@@ -491,7 +494,7 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
491494

492495
async resolveTask(
493496
task: vscode.Task,
494-
token?: vscode.CancellationToken
497+
token?: vscode.CancellationToken,
495498
): Promise<vscode.Task | undefined> {
496499
/**
497500
* Note that this method is never called for tasks created by the
@@ -533,9 +536,8 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
533536
*/
534537
const args = taskDef.args ?? [];
535538
try {
536-
const evaluatedArgs: (string | vscode.ShellQuotedString)[] = await evaluateArgs(
537-
args
538-
);
539+
const evaluatedArgs: (string | vscode.ShellQuotedString)[] =
540+
await evaluateArgs(args);
539541
execution = new vscode.ShellExecution(taskDef.command, evaluatedArgs);
540542
} catch (err) {
541543
let msg = 'Error while evaluating task arguments.';
@@ -555,7 +557,7 @@ export class SimpleTaskProvider implements vscode.TaskProvider {
555557
task.name,
556558
task.source,
557559
execution,
558-
task.problemMatchers
560+
task.problemMatchers,
559561
);
560562
}
561563

@@ -630,12 +632,12 @@ async function useAlire() {
630632
*/
631633
async function evaluateArgs(args: (string | vscode.ShellQuotedString)[]) {
632634
const commandRegex = new RegExp(
633-
`^\\\${command:\\s*((${TASK_TYPE_ADA}|${TASK_TYPE_SPARK})\\.[^}]*)\\s*}$`
635+
`^\\\${command:\\s*((${TASK_TYPE_ADA}|${TASK_TYPE_SPARK})\\.[^}]*)\\s*}$`,
634636
);
635637
const evaluatedArgs: (string | vscode.ShellQuotedString)[] = (
636638
await Promise.all(
637639
args.flatMap(async function (
638-
a: string | vscode.ShellQuotedString
640+
a: string | vscode.ShellQuotedString,
639641
): Promise<(string | vscode.ShellQuotedString)[]> {
640642
if (typeof a == 'string') {
641643
/**
@@ -675,7 +677,7 @@ async function evaluateArgs(args: (string | vscode.ShellQuotedString)[]) {
675677
}
676678

677679
return [a];
678-
})
680+
}),
679681
)
680682
).flat();
681683
return evaluatedArgs;
@@ -750,14 +752,14 @@ export function getBuildAndRunTaskName(main?: AdaMain) {
750752
export function createSparkTaskProvider(): SimpleTaskProvider {
751753
return new SimpleTaskProvider(
752754
TASK_TYPE_SPARK,
753-
predefinedTasks.filter((v) => v.taskDef.type == TASK_TYPE_SPARK)
755+
predefinedTasks.filter((v) => v.taskDef.type == TASK_TYPE_SPARK),
754756
);
755757
}
756758

757759
export function createAdaTaskProvider(): SimpleTaskProvider {
758760
return new SimpleTaskProvider(
759761
TASK_TYPE_ADA,
760-
predefinedTasks.filter((v) => v.taskDef.type == TASK_TYPE_ADA)
762+
predefinedTasks.filter((v) => v.taskDef.type == TASK_TYPE_ADA),
761763
);
762764
}
763765

@@ -857,7 +859,7 @@ abstract class SequentialExecution extends vscode.CustomExecution {
857859
} finally {
858860
closeEmitter.fire(2);
859861
}
860-
}
862+
},
861863
);
862864
},
863865
close() {
@@ -891,7 +893,7 @@ abstract class SequentialExecution extends vscode.CustomExecution {
891893
*/
892894
export async function findTaskByName(
893895
taskName: string,
894-
tasks?: vscode.Task[]
896+
tasks?: vscode.Task[],
895897
): Promise<vscode.Task> {
896898
if (!tasks) {
897899
tasks = (
@@ -929,7 +931,10 @@ export async function findTaskByName(
929931
* of the tasks to run are given at construction.
930932
*/
931933
class SequentialExecutionByName extends SequentialExecution {
932-
constructor(private taskName: string, private taskNames: string[]) {
934+
constructor(
935+
private taskName: string,
936+
private taskNames: string[],
937+
) {
933938
super();
934939
}
935940

@@ -949,7 +954,7 @@ class SequentialExecutionByName extends SequentialExecution {
949954
*/
950955
function runTaskSequence(
951956
tasks: vscode.Task[],
952-
writeEmitter: vscode.EventEmitter<string>
957+
writeEmitter: vscode.EventEmitter<string>,
953958
): Promise<number> {
954959
let p = new Promise<number>((resolve) => resolve(0));
955960
for (const t of tasks) {
@@ -1004,15 +1009,15 @@ export async function getBuildAndRunTasks(): Promise<vscode.Task[]> {
10041009
.filter((t) => getConventionalTaskLabel(t).startsWith(getBuildAndRunTaskName()))
10051010

10061011
// Return workspace-defined tasks first
1007-
.sort(workspaceTasksFirst)
1012+
.sort(workspaceTasksFirst),
10081013
);
10091014
}
10101015

10111016
export async function findBuildAndRunTask(adaMain: AdaMain): Promise<vscode.Task | undefined> {
10121017
return (await getBuildAndRunTasks()).find(
10131018
// Tasks defined in tasks.json will have a leading 'ada: ' while the
10141019
// ones auto-generated by the extension don't. We want to match both.
1015-
(t) => getConventionalTaskLabel(t) == getBuildAndRunTaskName(adaMain)
1020+
(t) => getConventionalTaskLabel(t) == getBuildAndRunTaskName(adaMain),
10161021
);
10171022
}
10181023

@@ -1047,15 +1052,15 @@ export async function getBuildMainTasks() {
10471052
tasks
10481053
.filter((t) => getConventionalTaskLabel(t).startsWith(getBuildTaskName()))
10491054
// Return workspace-defined tasks first
1050-
.sort(workspaceTasksFirst)
1055+
.sort(workspaceTasksFirst),
10511056
);
10521057
}
10531058

10541059
export async function findBuildMainTask(adaMain: AdaMain): Promise<vscode.Task | undefined> {
10551060
return (await getBuildMainTasks()).find(
10561061
// Tasks defined in tasks.json will have a leading 'ada: ' while the
10571062
// ones auto-generated by the extension don't. We want to match both.
1058-
(t) => getConventionalTaskLabel(t) == getBuildTaskName(adaMain)
1063+
(t) => getConventionalTaskLabel(t) == getBuildTaskName(adaMain),
10591064
);
10601065
}
10611066

integration/vscode/ada/test/suite/general/tasks.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ada: Run main - src/test.adb - obj/test${exe}
121121
const testAdbUri = vscode.Uri.joinPath(
122122
vscode.workspace.workspaceFolders[0].uri,
123123
'src',
124-
'test.adb'
124+
'test.adb',
125125
);
126126

127127
/**
@@ -134,7 +134,7 @@ ada: Run main - src/test.adb - obj/test${exe}
134134
(await getEnclosingSymbol(vscode.window.activeTextEditor, [vscode.SymbolKind.Function]))
135135
?.range,
136136
// The expected range is that of the inner-most subprogram P3
137-
new vscode.Range(13, 9, 18, 16)
137+
new vscode.Range(13, 9, 18, 16),
138138
);
139139
assert.equal(getSelectedRegion(vscode.window.activeTextEditor), '18:18');
140140

@@ -185,7 +185,7 @@ ada: Run main - src/test.adb - obj/test${exe}
185185
assert(resolved.execution);
186186
assert(
187187
isFromWorkspace(resolved),
188-
'Build task does not come from workspace. Source is: ' + resolved.source
188+
'Build task does not come from workspace. Source is: ' + resolved.source,
189189
);
190190

191191
const exec = buildTask.execution as vscode.ShellExecution;
@@ -215,7 +215,7 @@ ada: Run main - src/test.adb - obj/test${exe}
215215
obsoleteTaskDef,
216216
vscode.TaskScope.Workspace,
217217
'Obsolete Task',
218-
'Workspace'
218+
'Workspace',
219219
);
220220

221221
const prov = createAdaTaskProvider();
@@ -259,7 +259,7 @@ ada: Run main - src/test.adb - obj/test${exe}
259259
t,
260260
vscode.TaskScope.Workspace,
261261
'Invalid Task',
262-
'Workspace'
262+
'Workspace',
263263
);
264264

265265
/**
@@ -353,7 +353,7 @@ suite('Task Execution', function () {
353353
.getConfiguration()
354354
.update(
355355
'ada.projectFile',
356-
initialProjectFile === '' ? undefined : initialProjectFile
356+
initialProjectFile === '' ? undefined : initialProjectFile,
357357
);
358358
}
359359
});
@@ -428,7 +428,7 @@ async function openSrcFile() {
428428
const testAdbUri = vscode.Uri.joinPath(
429429
vscode.workspace.workspaceFolders[0].uri,
430430
'src',
431-
'test.adb'
431+
'test.adb',
432432
);
433433

434434
await vscode.window.showTextDocument(testAdbUri);

integration/vscode/ada/test/suite/utils.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function activate(): Promise<void> {
8484
*/
8585
export async function getCommandLines(
8686
prov: SimpleTaskProvider,
87-
filter?: (t: vscode.Task) => boolean
87+
filter?: (t: vscode.Task) => boolean,
8888
) {
8989
let tasks = await prov.provideTasks();
9090
assert(tasks);
@@ -97,7 +97,7 @@ export async function getCommandLines(
9797
await Promise.all(
9898
tasks.map(async (t) => {
9999
return { task: t, execution: (await prov.resolveTask(t))?.execution };
100-
})
100+
}),
101101
)
102102
)
103103
.filter(function ({ execution }) {
@@ -147,7 +147,7 @@ export async function runTaskAndGetResult(task: vscode.Task): Promise<number | u
147147
*/
148148
if (!started) {
149149
const msg = `The task '${getConventionalTaskLabel(
150-
task
150+
task,
151151
)}' was not started, likely due to an error.\n`;
152152
reject(Error(msg));
153153
}
@@ -160,7 +160,7 @@ export async function runTaskAndGetResult(task: vscode.Task): Promise<number | u
160160
msg += await vscode.tasks.fetchTasks({ type: task.definition.type }).then(
161161
(list) => list.map(getConventionalTaskLabel).join('\n'),
162162
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
163-
(reason) => `fetchTasks promise was rejected: ${reason}`
163+
(reason) => `fetchTasks promise was rejected: ${reason}`,
164164
);
165165

166166
reason.message += '\n' + msg;
@@ -201,7 +201,7 @@ export function getCmdLine(exec: vscode.ShellExecution): string {
201201
export async function testTask(
202202
taskName: string,
203203
testedTasks?: Set<string>,
204-
allProvidedTasks?: vscode.Task[]
204+
allProvidedTasks?: vscode.Task[],
205205
) {
206206
assert(vscode.workspace.workspaceFolders);
207207

@@ -319,11 +319,11 @@ export function simplifyCodelenses(cls: CodeLens[]) {
319319
*/
320320
workspace.asRelativePath(a.fsPath).split(path.sep).join(path.posix.sep)
321321
: a instanceof vscode.Range
322-
? /**
323-
* Represent Ranges as a string
324-
*/
325-
rangeToStr(a)
326-
: a
322+
? /**
323+
* Represent Ranges as a string
324+
*/
325+
rangeToStr(a)
326+
: a,
327327
),
328328
},
329329
}));

0 commit comments

Comments
 (0)