From 40524bff12c7d176f8264eeb4c1e3b231ce4b86f Mon Sep 17 00:00:00 2001 From: Anthony Leonardo Gracio Date: Wed, 18 Oct 2023 09:43:12 +0000 Subject: [PATCH 1/2] Document how to create non-LSP custom ALS features For eng/ide/ada_language_server#1188 --- doc/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index f58ce5786..8deb2c67a 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,6 +6,21 @@ The Ada Language Server (ALS) supports some features that are not in the officia [Language Server Protocol](https://microsoft.github.io/language-server-protocol) specification. This document specifies how these features are documented. +## Developing a custom feature + +Usually we tend to implement custom features through [LSP commands](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command). These commands can then be executed by the LSP clients running the ALS (e.g: VS Code). + +Commands can either do something on the codebase directly (e.g: refactorings) or be used to query specific information (e.g: return all the function declarations within a scope). + +Commands can be directly accessible to users through [LSP codeActions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction). This is the case for all ALS-specific refactorings. + +You can also use custom commands to perform queries on the code base, to develop an IDD-specific tool integration on top of the ALS for instance. In that case you can directly execute the command via the [LSP workspace/executeCommand](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_executeCommand) request and use the command's results as you want. + +Here are some implementations of custom features in the ALS implemented through this mechanism: + +* [Show Dependencies](../source/ada/lsp-ada_handlers-show_dependencies_commands.ads) +* [Other File](../source/ada/lsp-ada_handlers-other_file_commands.ads) + ## Feature description document Each feature is described in a dedicated Markdown document. @@ -39,7 +54,7 @@ It includes TypeScript definitions, as the official specification does. This section includes related feature description documents and links to others related resources. -## List of features +## List of custom features * [Debug](debug.md) * [Other File](other_file.md) * [Reference kinds](reference_kinds.md) From cc1bfaad1de818a28d5bd660b6b3640344104fc5 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Wed, 18 Oct 2023 15:53:49 +0000 Subject: [PATCH 2/2] Rename vscode launch configurations to meaningful names --- .vscode/launch.json | 70 ++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 350b1f731..4c31c5b3c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,35 +4,7 @@ "version": "0.2.0", "configurations": [ { - "name": "(gdb) Attach", - "type": "cppdbg", - "request": "attach", - "program": "${workspaceFolder}/integration/vscode/ada/x64/linux/ada_language_server", - "processId": "${command:pickProcess}", - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "Set Disassembly Flavor to Intel", - "text": "-gdb-set disassembly-flavor intel", - "ignoreFailures": true - } - ] - }, - { - "type": "gdb", - "request": "launch", - "name": "Launch Program", - "target": ".obj/server/ada_language_server", - "cwd": "${workspaceRoot}", - "valuesFormatting": "parseText" - }, - { - "name": "Launch Extension", + "name": "(vscode) Launch vscode with the Ada extension", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", @@ -67,15 +39,7 @@ } }, { - "name": "Launch Extension Testsuite", - "type": "node", - "request": "launch", - "cwd": "${workspaceFolder}/integration/vscode/ada/", - "runtimeExecutable": "npm", - "runtimeArgs": ["run-script", "test"] - }, - { - "name": "General Testsuite", + "name": "(vscode) Run testsuite 'general'", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", @@ -109,7 +73,7 @@ "internalConsoleOptions": "openOnSessionStart" }, { - "name": "GNATtest Integration Testsuite", + "name": "(vscode) Run testsuite 'gnattest'", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", @@ -142,6 +106,34 @@ "preLaunchTask": "npm: pretest", // Switch to Debug Console to see test results "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": "(npm) Launch all vscode tests with npm", + "type": "node", + "request": "launch", + "cwd": "${workspaceFolder}/integration/vscode/ada/", + "runtimeExecutable": "npm", + "runtimeArgs": ["run-script", "test"] + }, + { + "name": "(gdb) Attach", + "type": "cppdbg", + "request": "attach", + "program": "${workspaceFolder}/integration/vscode/ada/x64/linux/ada_language_server", + "processId": "${command:pickProcess}", + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] } ], "inputs": [