Skip to content

Commit bdf57eb

Browse files
authored
feat: handle trace data in extension (#19)
1 parent 08f34c8 commit bdf57eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+17784
-2532
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.js]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[{package.json,*.yml,*.cjson}]
14+
indent_style = space
15+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ logs
2424
!.env.example
2525

2626
examples/*
27+
playground/.vscode

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"runtimeExecutable": "${execPath}",
99
"args": [
1010
"--extensionDevelopmentPath=${workspaceFolder}",
11+
"--profile=TracerDebug",
1112
"${workspaceFolder}/playground"
1213
],
1314
"outFiles": [

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
77
🚧 It is a work in progress - help is wanted! 🚧
88

9-
## How it works
9+
## Real-time type checking estimates
1010

11-
To avoid the overhead of launching a separate tsserver, it currently queries the VSCode language server to get information about every token in an open file, and uses the timings of the responses as a proxy for the complexity of the types, following the pattern of [`@definitelytyped/perf`](https://github.com/microsoft/DefinitelyTyped-tools/blob/41ba894ba571e55fa91ef0bb0d44d6eb6d201943/packages/perf).
11+
To avoid the overhead of launching a separate tsserver, it currently queries the VSCode language server to get information about tokens in an open file, and uses the timings of the responses as a proxy for the complexity of the types, following the pattern of [`@definitelytyped/perf`](https://github.com/microsoft/DefinitelyTyped-tools/blob/41ba894ba571e55fa91ef0bb0d44d6eb6d201943/packages/perf).
12+
13+
## Trace file view and metrics
14+
15+
The `Tracer: tsc trace` command can be run to gather accurate timings. As with real-time metrics, these create diagnostics in the editor open files. It also opens an interface to browse trace files. Editor and UI commands enable navigating between locations in the editor and the trace.
16+
17+
If the trace is run with a version of `tsc` that includes timestamps in `types.json`, type count metrics are also displayed. A PR to include these timestamps or tooling to automatically patch them in are works in progress. See https://github.com/typeholes/TypeScript/tree/trace-data-5-4 for a version you can build yourself.
1218

1319
## Help wanted
1420

15-
- Improve UX/API of the plugin - for example, add settings to disable/customise how data is displayed to the user
16-
- Investigate the possibility of running a TypeScript trace and consuming this data (which would be much more reliable but might take longer)
21+
- Improve UX/API of the plugin - for example, more settings to customise how data is displayed to the user and better display of the traces
1722
- Investigate persistent worker threads that watch changes in a project and update asynchronously (and do not need to reinitialise TypeScript)
1823
- See if it is possible to get extended diagnostics or other diagnostic data from the compiler or tsserver APIs
1924

2025
## License
2126

22-
[MIT](./LICENSE) License © 2024 [Aleksandra Sikora](https://github.com/beerose) and [Daniel Roe](https://github.com/danielroe)
27+
Published under the [MIT License](./LICENCE).

0 commit comments

Comments
 (0)