diff --git a/integration/vscode/ada/src/taskProviders.ts b/integration/vscode/ada/src/taskProviders.ts index 2d015d310..5768bf2db 100644 --- a/integration/vscode/ada/src/taskProviders.ts +++ b/integration/vscode/ada/src/taskProviders.ts @@ -114,6 +114,24 @@ const predefinedTasks: PredefinedTask[] = [ }, problemMatchers: DEFAULT_PROBLEM_MATCHER, }, + { + label: 'Compile current file', + taskDef: { + type: TASK_TYPE_ADA, + command: 'gprbuild', + args: [ + '-q', + '-f', + '-c', + '-u', + '${command:ada.gprProjectArgs}', + '${fileBasename}', + '-cargs:ada', + '-gnatef', + ], + }, + problemMatchers: DEFAULT_PROBLEM_MATCHER, + }, { label: 'Analyze the project with GNAT SAS', taskDef: { @@ -170,6 +188,21 @@ const predefinedTasks: PredefinedTask[] = [ */ problemMatchers: '', }, + { + label: 'Analyze the current file with GNAT SAS and produce a report', + taskDef: { + type: TASK_TYPE_ADA, + compound: [ + 'Analyze the current file with GNAT SAS', + 'Create a report after a GNAT SAS analysis', + ], + }, + /** + * Analysis results are not printed on stdio so no need to parse them + * with a problem matcher. + */ + problemMatchers: '', + }, { label: 'Generate documentation from the project', taskDef: { diff --git a/integration/vscode/ada/test/suite/general/codelens.test.ts b/integration/vscode/ada/test/suite/general/codelens.test.ts index f57f24b48..b2b6c34d8 100644 --- a/integration/vscode/ada/test/suite/general/codelens.test.ts +++ b/integration/vscode/ada/test/suite/general/codelens.test.ts @@ -72,6 +72,7 @@ suite('CodeLens', function () { }); }); +// eslint-disable-next-line @typescript-eslint/no-unused-vars function toString(codelenses: import('vscode').CodeLens[] | null | undefined): unknown { return JSON.stringify( codelenses?.map((cl) => ({ diff --git a/integration/vscode/ada/test/suite/general/tasks.test.ts b/integration/vscode/ada/test/suite/general/tasks.test.ts index 76218a08b..9af87ce1b 100644 --- a/integration/vscode/ada/test/suite/general/tasks.test.ts +++ b/integration/vscode/ada/test/suite/general/tasks.test.ts @@ -9,7 +9,14 @@ import { createAdaTaskProvider, getConventionalTaskLabel, } from '../../../src/taskProviders'; -import { activate, getCmdLine, getCommandLines, runTaskAndGetResult, testTask } from '../utils'; +import { + activate, + closeAllEditors, + getCmdLine, + getCommandLines, + runTaskAndGetResult, + testTask, +} from '../utils'; suite('Task Providers', function () { let projectPath: string; @@ -31,10 +38,12 @@ suite('Task Providers', function () { ada: Clean current project ada: Build current project ada: Check current file +ada: Compile current file ada: Analyze the project with GNAT SAS ada: Analyze the current file with GNAT SAS ada: Create a report after a GNAT SAS analysis ada: Analyze the project with GNAT SAS and produce a report +ada: Analyze the current file with GNAT SAS and produce a report ada: Generate documentation from the project ada: Create/update test skeletons for the project ada: Build main - src/main1.adb @@ -54,6 +63,7 @@ ada: Build and run main - src/test.adb ada: Clean current project - gprclean -P ${projectPath} ada: Build current project - gprbuild -P ${projectPath} -cargs:ada -gnatef ada: Check current file - gprbuild -q -f -c -u -gnatc -P ${projectPath} \${fileBasename} -cargs:ada -gnatef +ada: Compile current file - gprbuild -q -f -c -u -P ${projectPath} \${fileBasename} -cargs:ada -gnatef ada: Analyze the project with GNAT SAS - gnatsas analyze -P ${projectPath} ada: Analyze the current file with GNAT SAS - gnatsas analyze -P ${projectPath} --file=\${fileBasename} ada: Create a report after a GNAT SAS analysis - gnatsas report sarif -P ${projectPath} -o report.sarif @@ -212,10 +222,15 @@ suite('Task Execution', function () { allProvidedTasks.push(...(await createAdaTaskProvider().provideTasks())); }); + this.beforeEach(async function () { + await closeAllEditors(); + }); + declTaskTest('ada: Build current project'); declTaskTest('ada: Run main - src/main1.adb'); declTaskTest('ada: Run main - src/test.adb'); declTaskTest('ada: Check current file', openSrcFile); + declTaskTest('ada: Compile current file', openSrcFile); declTaskTest('ada: Clean current project'); declTaskTest('ada: Build main - src/main1.adb'); declTaskTest('ada: Build main - src/test.adb'); @@ -224,6 +239,7 @@ suite('Task Execution', function () { declTaskTest('ada: Analyze the project with GNAT SAS'); declTaskTest('ada: Create a report after a GNAT SAS analysis'); declTaskTest('ada: Analyze the project with GNAT SAS and produce a report'); + declTaskTest('ada: Analyze the current file with GNAT SAS and produce a report', openSrcFile); declTaskTest('ada: Analyze the current file with GNAT SAS', openSrcFile); declTaskTest('ada: Generate documentation from the project'); declTaskTest('ada: Create/update test skeletons for the project');