diff --git a/integration/vscode/ada/src/taskProviders.ts b/integration/vscode/ada/src/taskProviders.ts index be8e6dd17..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', '-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); }); 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;