From bb3d460e8e3b77ac68c018b0faa6655d747a02db Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Wed, 13 Dec 2023 10:52:45 +0200 Subject: [PATCH 1/3] Fix passing `-gnatef` to GNAT in vscode tasks C compiler desn't understand `-gnatef` and raises error. (no-issue-check) --- integration/vscode/ada/src/taskProviders.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/vscode/ada/src/taskProviders.ts b/integration/vscode/ada/src/taskProviders.ts index be8e6dd17..2b13dd29b 100644 --- a/integration/vscode/ada/src/taskProviders.ts +++ b/integration/vscode/ada/src/taskProviders.ts @@ -80,7 +80,7 @@ async function computeProject(taskDef?: CustomTaskDefinition): Promise { // Call commonArgs on args and append `-gnatef` to generate full file names in errors/warnings export const getDiagnosticArgs = (): string[] => { - const p_gnatef = ['-cargs', '-gnatef']; + const p_gnatef = ['-cargs:ada', '-gnatef']; return p_gnatef; }; From 4a032fb8ac63c02a75b5c33c3eafded586757833 Mon Sep 17 00:00:00 2001 From: Anthony Leonardo Gracio Date: Tue, 12 Dec 2023 17:39:52 +0000 Subject: [PATCH 2/3] Add a Kill_Process procedure to LSP clients For eng/ide/gnatstudio#196 --- source/client/lsp-raw_clients.adb | 9 +++++++++ source/client/lsp-raw_clients.ads | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/client/lsp-raw_clients.adb b/source/client/lsp-raw_clients.adb index 7e3003322..7c59cd9e7 100644 --- a/source/client/lsp-raw_clients.adb +++ b/source/client/lsp-raw_clients.adb @@ -139,6 +139,15 @@ package body LSP.Raw_Clients is return Self.Server.Identifier; end Server_PID; + ------------------ + -- Kill_Process -- + ------------------ + + procedure Kill_Process (Self : in out Raw_Client'Class) is + begin + Self.Server.Kill_Process; + end Kill_Process; + ------------------- -- Set_Arguments -- ------------------- diff --git a/source/client/lsp-raw_clients.ads b/source/client/lsp-raw_clients.ads index 93442e6ed..203dc2495 100644 --- a/source/client/lsp-raw_clients.ads +++ b/source/client/lsp-raw_clients.ads @@ -112,11 +112,17 @@ package LSP.Raw_Clients is function Can_Send_Message (Self : Raw_Client'Class) return Boolean; -- Return True when server's process is running and send queue is empty, - -- thus send operation can start immidiately. + -- thus send operation can start immediately. function Server_PID (Self : Raw_Client'Class) return String; -- Return server process id (pid) if the server has been started. + procedure Kill_Process (Self : in out Raw_Client'Class); + -- Kill current server process. Process will exit immediately. + -- + -- On Windows, TerminateProcess() is called, and on POSIX, the SIGKILL + -- signal is sent. + private type Listener (Client : access Raw_Client'Class) is limited new Spawn.Processes.Process_Listener with null record; From 8b2b4750ddc979f181371e61170b1191a720e1a7 Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Wed, 13 Dec 2023 18:51:51 +0200 Subject: [PATCH 3/3] Add extra quotes around `-cargs:ada` in vscode tasks to make PowerShall happy. Closes #1268 --- integration/vscode/ada/src/taskProviders.ts | 3 ++- integration/vscode/ada/test/suite/general/tasks.test.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/integration/vscode/ada/src/taskProviders.ts b/integration/vscode/ada/src/taskProviders.ts index 2b13dd29b..be24b4458 100644 --- a/integration/vscode/ada/src/taskProviders.ts +++ b/integration/vscode/ada/src/taskProviders.ts @@ -80,7 +80,8 @@ async function computeProject(taskDef?: CustomTaskDefinition): Promise { // Call commonArgs on args and append `-gnatef` to generate full file names in errors/warnings export const getDiagnosticArgs = (): string[] => { - const p_gnatef = ['-cargs:ada', '-gnatef']; + const p_gnatef = ['"-cargs:ada"', '-gnatef']; + // PowerShell splits arguments on `:`, so we need extra quotes around `-cargs:ada` return p_gnatef; }; diff --git a/integration/vscode/ada/test/suite/general/tasks.test.ts b/integration/vscode/ada/test/suite/general/tasks.test.ts index 8f5b6335e..0b00c8aab 100644 --- a/integration/vscode/ada/test/suite/general/tasks.test.ts +++ b/integration/vscode/ada/test/suite/general/tasks.test.ts @@ -84,7 +84,7 @@ suite('GPR Tasks Provider', function () { const exec = resolved.execution as vscode.ShellExecution; const actualCmd = [exec.command].concat(exec.args).join(' '); - const expectedCmd = `gprbuild -P ${def.configuration.projectFile} -cargs -gnatef`; + const expectedCmd = `gprbuild -P ${def.configuration.projectFile} "-cargs:ada" -gnatef`; assert.strictEqual(actualCmd, expectedCmd); }); @@ -111,7 +111,7 @@ suite('GPR Tasks Provider', function () { const expectedCmd = `gprbuild -P ${def.configuration.projectFile} ${ def.configuration.main ?? '' - } -cargs -gnatef`; + } "-cargs:ada" -gnatef`; assert.strictEqual(actualCmd, expectedCmd); }); @@ -140,7 +140,7 @@ suite('GPR Tasks Provider', function () { // via project attributes const expectedCmd = `gprbuild -P ${def.configuration.projectFile} ${ def.configuration.main ?? '' - } -cargs -gnatef && obj/main1exec${process.platform == 'win32' ? '.exe' : ''}`; + } "-cargs:ada" -gnatef && obj/main1exec${process.platform == 'win32' ? '.exe' : ''}`; assert.strictEqual(actualCmd, expectedCmd); });