Skip to content

Commit 7e658dd

Browse files
committed
Document how to get symbolic backtraces for TypeScript
1 parent aac9549 commit 7e658dd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
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:

0 commit comments

Comments
 (0)