Skip to content

Commit 7ce368c

Browse files
committed
Merge branch 'topic/sourcemap' into 'master'
Package a sourcemap file for the Ada extension Closes #1282 See merge request eng/ide/ada_language_server!1479
2 parents b58781a + 7e658dd commit 7ce368c

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

doc/HACKING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,40 @@ and run
7575

7676
On Mac OX X use [atos](https://www.unix.com/man-page/osx/1/atos/) instead.
7777

78+
## Getting symbolic backtrace for TypeScript
79+
80+
The Ada & SPARK extension for Visual Studio Code is published as minified
81+
JavaScript code. For that reason backtraces reported are not easily readable
82+
by humans. To alleviate that, the published .vsix includes a source map file
83+
at `out/src/extension.js.map`.
84+
85+
To resolve a backtrace to the original TypeScript source locations:
86+
87+
1. Unzip the .vsix
88+
89+
2. Copy the backtrace into a plain text file *while preserving the error message
90+
on the first line*, for example:
91+
92+
```
93+
2024-01-11 10:11:54.191 [Ada Extension] ERROR Error while starting Ada extension...
94+
at Gu (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:75:5911)
95+
at oS (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:75:6057)
96+
at w$ (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:85:2292)
97+
at b$ (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:85:2154)
98+
...
99+
```
100+
101+
3. Run the following command to obtain source locations:
102+
103+
```
104+
$ npx stacktracify out/src/extension.js.map -f trace.txt
105+
2024-01-11 10:11:54.191 [Ada Extension] ERROR Error while starting Ada extension...
106+
at [unknown] (../../src/helpers.ts:150:56)
107+
at getEvaluatedCustomEnv (../../src/helpers.ts:186:22)
108+
at assertSupportedEnvironments (../../src/extension.ts:128:4)
109+
at activateExtension (../../src/extension.ts:118:14)
110+
```
111+
78112
### Writing tests
79113

80114
To write a functional test for Ada Language Server:

integration/vscode/ada/.vscodeignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This file contains patterns to exclude from the packaging into a .vsix
12
.vscode-test/
23
advanced/
34
node_modules/
@@ -10,5 +11,6 @@ test/
1011
debug.code-workspace
1112
run_grammar_tests.sh
1213
tsconfig.json
13-
**/*.map
1414
**/*.ts
15+
**/*.ts.map
16+
xfail.yaml

integration/vscode/ada/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,14 +875,15 @@
875875
},
876876
"scripts": {
877877
"check-licenses": "npx license-checker-rseidelsohn --summary --onlyAllow \"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;BlueOak-1.0.0;CC0-1.0;GPL-3.0;GPL-3.0-or-later;ISC;MIT;Python-2.0;Zlib\"",
878-
"vscode:prepublish": "npm run esbuild-base -- --minify",
878+
"vscode:prepublish": "npm run esbuild-base -- --minify --sourcemap",
879879
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/src/extension.js --external:vscode --format=cjs --platform=node",
880880
"compile": "node ./node_modules/typescript/bin/tsc",
881881
"watch": "node ./node_modules/typescript/bin/tsc -watch",
882882
"pretest": "npm run compile",
883883
"lint": "eslint \"./src/**/*.{js,ts,tsx}\" --quiet --fix",
884884
"cilint": "eslint \"./src/**/*.{js,ts,tsx}\"",
885-
"test": "node ./out/test/runTest.js"
885+
"test": "node ./out/test/runTest.js",
886+
"resolve-backtrace": "npx stacktracify"
886887
},
887888
"dependencies": {
888889
"@types/command-exists": "1.2.0",

0 commit comments

Comments
 (0)