* Use stricter types for tracing event arguments
In local development, I've routinely passed the wrong local and ended up
having JSON.stringify throw.
* Make the type recursive
Courtesy of @rbuckton
* Fix lint error
Future versions of node will be able to return undefined, rather than
allocating and throwing an exception, when a file is not found.
See https://github.com/nodejs/node/pull/33716
* Remove-all-unused-identifiers skips assigned identifiers
Previously, fixUnusedIdentifier worked the same in fix-all mode as for a
single fix: identifiers with assignments would be deleted:
```ts
function f(a) { }
f(1)
```
becomes
```ts
function f() { }
f()
```
But any kind of argument will be deleted, even one with side effects.
For a single codefix invocation, this is probably OK.
But for fix-all, this could lead to multiple changes
spread throughout a large file.
Now fix-all will only delete parameters and variable declarations with
no assignments:
```ts
function f(a) { }
function g(a) { }
f(1)
g
let x = 1
let y
```
becomes
```
function f(a) { }
function g() { }
f(1)
g
let x = 1
```
* Don't remove assigned parameters for single codefix either
* add optional parameter test case
* Skip initialised params and binding elements
Based on PR feedback from @amcasey
* fixAll removes unused binding patterns completely
* Fixes from comments
Thanks @amcasey for the thorough review
* fix trailing space lint
* correctly remove-all array binding
* Unuse Identifier codefix understands constructors
Previously, it did not look for `super()` and `new this()` calls when
determining whether a constructor parameter could be deleted.
* better names, fix off-by-1 bug
* Codefix understands super methods now too
This unifies the code, changing it considerably.
* Add actual baselines for a problem with global namespace being preferred over config & pragma implicit ones
* Fixed an issue with global React namespace being preferred over config & pragma implicit ones
* Do not try to mark JSX classic runtime symbols as used when automatic runtime is used
* Add tracing support to tsserver
Read the `TSS_TRACE` environment variable to determine which directory
trace files should be written to.
Notable changes from tsc tracing:
1) Drop all tracepoints that depend on type IDs
2) Write output to trace.PID.json
3) New, server-specific events (request/response, cancellation, etc)
* Drop try-finally blocks that aren't strictly necessary
* Fix lint error
* Trace background work (for diagnostics)
* Move try-finally blocks into session so tsc doesn't use them
* Add missing try-finally
* Use consistent capitalization
* Inline canPop call where underlying variable is available
* Clarify comments
* Include PID in build-mode file names
* Introduce more efficient popAll function
* Trace throwIfCancellationRequested rather than isCancellationRequested
* Remove unnecessary try-finally blocks
* Add a command-line argument for consistency with logging
* Fix rebase issues
* Address PR feedback
* Rename completionEvents to eventStack
* Drop assertStackEmpty as hard-to-maintain and marginally valuable
* Rename stepCancellation to stepCanceledEarly
* Rename stepEarlyCancellation to stepCanceled and use flag instead
* Check correct variable on exit
Storing the arguments on the stack will make it possible to forego
try-finally blocks when we start tracing in server scenarios, which have
to handle cancellation.
* dispose Mocha Runner after use to avoid MaxlistenersExceededWarning
- removed manual `unhandledRejection` listener as Mocha v8.2.0 now has one
* Remove ts-ignore comment and commented out line.
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>