Skip to content

Commit 5084b2d

Browse files
committed
Merge branch 'topic/dev-setup' into 'master'
Improve local development environment See merge request eng/ide/ada_language_server!1220
2 parents c17d59c + 4613542 commit 5084b2d

File tree

10 files changed

+203
-35
lines changed

10 files changed

+203
-35
lines changed

.github/workflows/build-binaries.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ set -x -e
66
DEBUG=$1 # Value is '' or 'debug'
77
RUNNER_OS=$2 # ${{ runner.os }} is Linux, Windiws, maxOS
88
TAG=$3 # For master it's 23.0.999, while for tag it's the tag itself
9+
NO_REBASE=$4 # Specify this to skip the rebase over the edge branch. Used for local debugging.
10+
911
prefix=/tmp/ADALIB_DIR
1012

1113
if [ $RUNNER_OS = Windows ]; then
@@ -29,7 +31,7 @@ echo PATH=$PATH
2931
BRANCH=master
3032

3133
# Rebase PR on edge branch
32-
if [[ ${GITHUB_REF##*/} != 2*.[0-9]*.[0-9]* ]]; then
34+
if [[ -z "$NO_REBASE" && ${GITHUB_REF##*/} != 2*.[0-9]*.[0-9]* ]]; then
3335
git config user.email "`git log -1 --pretty=format:'%ae'`"
3436
git config user.name "`git log -1 --pretty=format:'%an'`"
3537
git config core.autocrlf
@@ -96,7 +98,14 @@ if [ $RUNNER_OS = macOS ]; then
9698
fi
9799

98100
if [ "$DEBUG" != "debug" ]; then
99-
ALS=`ls integration/vscode/ada/*/ada_language_server*`
101+
# Here it's better to match an exact extension rather than mathing
102+
# ada_language_server* because when running locally, the latter could match
103+
# ada_language_server.dSYM from a previous run if it exists.
104+
if [ $RUNNER_OS = Windows ]; then
105+
ALS=`ls integration/vscode/ada/*/ada_language_server.exe`
106+
else
107+
ALS=`ls integration/vscode/ada/*/ada_language_server`
108+
fi
100109
cd `dirname $ALS`
101110
ALS=`basename ${ALS}`
102111
if [ $RUNNER_OS = macOS ]; then

.vscode/launch.json

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,57 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
"version": "0.2.0",
5-
"configurations": [
6-
{
7-
"type": "gdb",
8-
"request": "launch",
9-
"name": "Launch Program",
10-
"target": ".obj/server/ada_language_server",
11-
"cwd": "${workspaceRoot}",
12-
"valuesFormatting": "parseText"
13-
}
14-
]
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
"version": "0.2.0",
5+
"configurations": [
6+
{
7+
"name": "Launch Extension",
8+
"type": "extensionHost",
9+
"request": "launch",
10+
"runtimeExecutable": "${execPath}",
11+
"outFiles": [
12+
"${workspaceFolder}/integration/vscode/ada/out/**/*.js",
13+
"!**/node_modules/**"
14+
],
15+
"args": [
16+
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada",
17+
18+
// It is useful to have workspace available for local debugging. The
19+
// following one is provided within the repository with test folders
20+
// included.
21+
// "${workspaceFolder}/integration/vscode/ada/debug.code-workspace"
22+
23+
// An alternative is to use the ALS workspace itself as a runtime
24+
// workspace for debugging. However it is not possible to start the
25+
// debug instance on the same workspace as the development instance.
26+
// So you can checkout a second copy of the ALS repository under
27+
// ../als-rt and use it with the following line.
28+
"${workspaceFolder}/../als-rt"
29+
],
30+
"preLaunchTask": "npm: compile"
31+
},
32+
{
33+
"name": "Extension Tests",
34+
"type": "extensionHost",
35+
"request": "launch",
36+
"runtimeExecutable": "${execPath}",
37+
"outFiles": [
38+
"${workspaceFolder}/integration/vscode/ada/out/**/*.js",
39+
"!**/node_modules/**"
40+
],
41+
"args": [
42+
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada",
43+
"--extensionTestsPath=${workspaceFolder}/integration/vscode/ada/out/test/suite/index",
44+
"${workspaceFolder}/integration/vscode/ada/test/SampleProject"
45+
],
46+
"preLaunchTask": "npm: pretest"
47+
},
48+
{
49+
"type": "gdb",
50+
"request": "launch",
51+
"name": "Launch Program",
52+
"target": ".obj/server/ada_language_server",
53+
"cwd": "${workspaceRoot}",
54+
"valuesFormatting": "parseText"
55+
}
56+
]
1557
}

.vscode/settings.json

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
11
{
2-
"ada.projectFile": "gnat/lsp_server.gpr",
3-
"python.analysis.extraPaths": [
4-
"testsuite"
5-
]
6-
}
2+
"ada.projectFile": "gnat/lsp_server.gpr",
3+
"python.analysis.extraPaths": ["testsuite"],
4+
"terminal.integrated.env.osx": {
5+
// Dependencies can be provided under the subprojects/ directory. They
6+
// would automatically be included in GPR_PROJECT_PATH by the following
7+
// setting.
8+
//
9+
// Alternatively, dependencies can be obtained from different locations
10+
// and GPR_PROJECT_PATH can be set prior to invoking VS Code, making them
11+
// also visible if not overwritten in the subprojects/ directory.
12+
"GPR_PROJECT_PATH": "${workspaceFolder}/subprojects/VSS/gnat:${workspaceFolder}/subprojects/gnatdoc/gnat:${workspaceFolder}/subprojects/libadalang-tools/src:${workspaceFolder}/subprojects/spawn/gnat:${workspaceFolder}/subprojects/stubs:${workspaceFolder}/subprojects/prefix/share/gpr:${env:GPR_PROJECT_PATH}"
13+
},
14+
// To develop the VS Code extension, it is recommended to open the workspace
15+
// defined at integration/vscode/ada. Nonetheless, this configuration allows
16+
// ESLint to operate on the TypeScript sources of the extension from this
17+
// workspace.
18+
"eslint.workingDirectories": [
19+
{
20+
"directory": "integration/vscode/ada"
21+
}
22+
],
23+
// Please keep the following options in sync with integration/vscode/ada/.vscode/settings.json
24+
"[typescript]": {
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"editor.codeActionsOnSave": {
27+
"source.fixAll.eslint": true
28+
}
29+
},
30+
"[json]": {
31+
"editor.formatOnSave": true,
32+
"editor.defaultFormatter": "esbenp.prettier-vscode",
33+
"editor.detectIndentation": false,
34+
"files.trimFinalNewlines": true,
35+
"files.trimTrailingWhitespace": true
36+
},
37+
"[jsonc]": {
38+
"editor.formatOnSave": true,
39+
"editor.defaultFormatter": "esbenp.prettier-vscode",
40+
"editor.detectIndentation": false,
41+
"files.trimFinalNewlines": true,
42+
"files.trimTrailingWhitespace": true
43+
}
44+
}

.vscode/tasks.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"-cargs",
1313
"-gnatef"
1414
],
15-
"problemMatcher": ["$ada"],
15+
"problemMatcher": [
16+
"$ada"
17+
],
1618
"group": {
1719
"kind": "build",
1820
"isDefault": true
@@ -22,8 +24,27 @@
2224
"label": "Run tests",
2325
"type": "shell",
2426
"command": "make check",
25-
"problemMatcher": ["$ada"],
27+
"problemMatcher": [
28+
"$ada"
29+
],
2630
"group": "test"
31+
},
32+
{
33+
"type": "npm",
34+
"script": "compile",
35+
"path": "integration/vscode/ada",
36+
"group": "build",
37+
"problemMatcher": [],
38+
"label": "npm: compile",
39+
"detail": "node ./node_modules/typescript/bin/tsc",
40+
"presentation": {
41+
"echo": true,
42+
"reveal": "silent",
43+
"focus": false,
44+
"panel": "shared",
45+
"showReuseMessage": true,
46+
"clear": false
47+
}
2748
}
2849
]
29-
}
50+
}

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ To build the language server you need:
8080
Project files of the libraries must be available via the `GPR_PROJECT_PATH`
8181
environment variable.
8282

83-
To run the language server you need `gnatls` (parts of GNAT installation)
83+
If you intend to use VS Code on this workspace, it is recommended to check out
84+
these dependencies under `subprojects/` or install them under
85+
`subprojects/prefix`. That will make them automatically visible to the VS Code
86+
Ada extension in this workspace.
87+
88+
To run the language server you need `gnatls` (part of GNAT installation)
8489
somewhere in the path.
8590

8691
## Usage

integration/vscode/ada/.vscode/extensions.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See https://go.microsoft.com/fwlink/?LinkId=733558
33
// for the documentation about the extensions.json format
44
"recommendations": [
5-
"dbaeumer.vscode-eslint"
6-
]
7-
}
5+
"dbaeumer.vscode-eslint",
6+
"esbenp.prettier-vscode"
7+
]
8+
}

integration/vscode/ada/.vscode/launch.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
"request": "launch",
88
"runtimeExecutable": "${execPath}",
99
"args": [
10-
"--extensionDevelopmentPath=${workspaceFolder}"
10+
"--extensionDevelopmentPath=${workspaceFolder}",
11+
"${workspaceFolder}/debug.code-workspace"
1112
],
12-
"preLaunchTask": "npm: compile",
13+
"preLaunchTask": "npm: compile"
1314
},
1415
{
1516
"name": "Extension Tests",
@@ -24,4 +25,4 @@
2425
"preLaunchTask": "npm: pretest"
2526
}
2627
]
27-
}
28+
}

integration/vscode/ada/.vscode/settings.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"**/node_modules": true,
44
"**/out": true
55
},
6+
// Please keep the following options in sync with ../../../../.vscode/settings.json
67
"[typescript]": {
78
"editor.defaultFormatter": "esbenp.prettier-vscode",
89
"editor.codeActionsOnSave": {
@@ -11,16 +12,16 @@
1112
},
1213
"[json]": {
1314
"editor.formatOnSave": true,
14-
"editor.defaultFormatter": "vscode.json-language-features",
15+
"editor.defaultFormatter": "esbenp.prettier-vscode",
1516
"editor.detectIndentation": false,
1617
"files.trimFinalNewlines": true,
17-
"files.trimTrailingWhitespace": true,
18+
"files.trimTrailingWhitespace": true
1819
},
1920
"[jsonc]": {
2021
"editor.formatOnSave": true,
21-
"editor.defaultFormatter": "vscode.json-language-features",
22+
"editor.defaultFormatter": "esbenp.prettier-vscode",
2223
"editor.detectIndentation": false,
2324
"files.trimFinalNewlines": true,
24-
"files.trimTrailingWhitespace": true,
25+
"files.trimTrailingWhitespace": true
2526
}
26-
}
27+
}

integration/vscode/ada/CONTRIBUTING.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
This document will describe the necessary information required to contribute to the [VS Code](https://code.visualstudio.com/) extension.
44

5+
## Developer Setup
6+
7+
It is recommended to use the VS Code workspace defined at the root of this Git
8+
repository for development of the VS Code Ada extension. Run this initially to install all dependencies:
9+
10+
```
11+
cd integration/vscode/ada; npm install
12+
```
13+
14+
And then use the task `npm: compile` for compilation and the launch
15+
configuration `Launch Extension` for local testing and debugging.
16+
17+
### macOS on Apple M1/M2 processors
18+
19+
On macOS with Apple M1/M2 processors, using a native arm64 `node`/`npm` will
20+
result in an error as the VS Code Ada extension is not yet ready to support the
21+
arm64 architecture on all platforms. To work around this, install and use an
22+
x86_64 version of Node.js. You can download it from the
23+
[Node.js](https://nodejs.org/en/download) website or using an x86_64
24+
installation of [Homebrew](https://brew.sh/).
25+
26+
Homebrew x86_64 can be installed by prefixing the Homebrew installation command
27+
with `arch -x86_64 ...`. By default the x86_64 Homebrew uses the `/usr/local`
28+
prefix while the arm64 Homebrew uses the `/opt/homebrew` prefix so both
29+
installations can co-exist. To use the x86_64 Homebrew, e.g. to install the
30+
x86_64 Node.js, invoke it as follows:
31+
32+
```
33+
arch -x86_64 /usr/local/bin/brew install node npm
34+
```
35+
36+
And then update the `PATH` environment variable to make sure the x86_64 `node` executable gets used:
37+
38+
```
39+
cd integration/vscode/ada; PATH=/usr/local/bin:$PATH npm install
40+
```
41+
42+
Once the initial `npm install` step is done in x86_64 mode, VS Code will be able
43+
to use the installed x86_64 dependencies seemlessly.
44+
545
## Terminology
646

747
### Syntax Highlighter
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "test"
5+
},
6+
{
7+
"path": "testsuite_grammar"
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)