* Cache accessibe symbol chains, type parameter name generation
* Move signature declaration helper length approximation to start of function
* Add node result caching internal to `typeToTypeNodeHelper`
* Suggestion from PR
* Switches from never allowing semantic highlight on JS to only doing it if we have a valid source file
* Adds a way to test and validate that an arbitrary JS file gets semantic classification results
* Revert to just dropping the if statement
* Improve errors for incorrectly nested export default
The compiler and services don't handle incorrectly nested
`export default` well right now:
```ts
export = (x,y) => {
export default { }
}
```
Asking for document highlights, find all references or quick info on
'export' or 'default' cause a crash. After the crash is fixed, the error
message is confusing and wrong: "An export assignment cannot be used outside a module."
This PR:
1. Skips document highlights for incorrectly nested export default.
2. Skips find all refs for incorrectly nested export default.
3. Switches the fallback binding for incorrectly nested export default
from Alias to Property. Neither is correct, but Property doesn't cause a
crash in alias resolution.
4. Improves the error message to reflect a post-ES module world, which
has export default and 'module' means 'ES module', not 'namespace'.
Fixes#40082 and the related bugs mentioned above.
* address PR comments
Previously, the name resolution for link tags in displaypart generation
mistakenly required a valueDeclaration. Now it uses the first
declaration if there is no valueDeclaration, so that types and
namespaces will also resolve.
This is another instance of using valueDeclaration as "the default
declaration", which doesn't apply to types.
Fixes#43868
* Handle localness in special cases by checking exported variable assignment
Fixes#42976
* Fix existing tests where arrow now behaves similar to function expression
* Update src/services/goToDefinition.ts
* Complete `constructor` keyword after property declaration.
* Fix logical errors.
* Fix for more universal situations.
* Only provide completions if property declaration is terminated.
* Simplify many logical conditions.
* Make the fix more reliable.
* Narrowing the fix.
* Fix completions of exports elsewhere in same file
* Undo messing up JSDoc-annotated module.exports assignments
* Add other failing contextual type test
* Rearrange contextual type logic for special assignments
* Rename helper function
* Completion list for type literals in type arguments
* Add tests
* Refactor for better readability
* - Support non-identifier keys
- Move main logic onto tryGetGlobalSymbols function
* Stopped removing unused imports in files with syntactic errors
* Added allowDestructiveCodeActions arg
* Updated .d.ts baselines
* Stop factoring syntax errors. Weird that no tests break...
* Have args extend scope so it is not a breaking change
* Update src/harness/harnessLanguageService.ts
Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
* Fixed API breaking change, and renamed to skip
* Always with the baselines
* One more .d.ts baseline to fix
* Remove blank line in src/harness/harnessLanguageService.ts
Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
* Fix organize imports overlap
* Refactored multiline end position
* Added tests for single line trailing trivia
* Fix rearranging imports
* Fix lint error
* PR coments
* Test that fails because of change in scriptKind of untitled file
* buckets are keyed with DocumentRegistryBucketKey
* Use scriptKind in document Registry to distinguish between files
Fixes#42613
* WIP
* WIP
* Get completion details working
* Start unifying eager and lazy auto imports
* Fix export=
* Fix completion details for totally misspelled names
* Almost fixed duplication...
* Fix remaining completion tests
* Refactor to support multiple origins for same symbol
* Make import fixes make slightly more sense
* Add cache back in
* Set insertText based on import kind
* Update API baselines
* Add semicolons, snippet support, and sourceDisplay
* Add some tests
* Update baselines
* Fix pattern ambient modules appearing in auto imports
* Fix tests
* Remove commented code
* Switch to valueDeclaration for getting module source file
* Small optimizations
* Cache module specifiers / importableness and export map separately
* Fix and test cache invalidation logic
* Update API baselines
* Add separate user preference for snippet-formatted completions
* Require first character to match when resolving module specifiers
* Fix AutoImportProvider export map cache invalidation
* Really fix auto import provider export map invalidation
* Update test added in master
* Use logical or assignment
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Simply conditional by reversing
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* When file is deleted need to marked correctly in the project as removed file
* Simplify hasAddedOrRemovedSymlinks with cherry-picked fix
* Ensure replacement range is on one line
* Update baselines
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
* Test for not watchiong referenced projects fileNames and invalidating it
* Add watching wild card directories and caching parsed command line for projects so that its shared
* Handle config file watching and commandline cache together
* Watch extended files for commndline cache instead of project
* Use extended config cache now that we are watching extended config files
* Structure for getParsedCommandLine from the LS
* Adding some more skeleton with todos
* getParsedCommandLine on WatchCompilerHost
* Tests for Watch, LS scenarios
* Handle getParsedCommandLine so we are looking at all things for referenced
* Cleanup and commenting
* Test for transitive references with tsc-watch
* Cache parsed command line even if host implements getParsedCommandLine
* Cleanup
* Cleanup
* Some tests to verify exclude from referenced project doesnt trigger the update
* Baseline when program is same
* Test for incremental scenario
* Tests for output from referenced project
* Comments
...when missing `program.redirectTargetsMap` info. This assertion fails
in the added test case -- looks like there is no entry in
`program.redirectTargetsMap` when it comes from a file that is no in the
project. So in this case don't follow the (missing) info, and instead
drop the highlight.
Fixes#33722.
* Added support for private identifier methods.
* Added tests for private methods.
* Added check to only not allow private name method signatures in anything except classes.
Changes objects literal checking to not bail on first private name found in object literal.
* Added private accessors tests
* Transform private methods
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Rename shouldTransformPrivateFields
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Accept baseline
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Use a single WeakSet for brand-check
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Accept baseline
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Add a test for using private methods in static field initializers
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Add breaking checker test
Private methods inside class expressions should not error.
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Add to instances once per-instance
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Accept baseline
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: evaluate receiver and rhs expressions before throwing on readonly assignment
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Add a test for evaluating rhs before readonly assignment
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Transpile private accessors
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Accept baseline
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: handle readonly/writeonly accessors
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* accept baseline
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add a test for private setter without a getter
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: getAllUnscopedEmitHelpers
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: better handling of duplicate names
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Fixed wrong error message for private methods in class expressions.
* change error message
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add a test for async private methods with a higher target
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: setter assignment returns rhs value
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add a test for setter assignment return value
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: handle duplicate accessors
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add tests for duplicate accessors
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* docs: add missing parameter docs
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Fixed failing test.
* baseline-accept: ordering changes
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* fix: attach weakSetName to property declaration
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add a test for nested private methods
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* add a test with any
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
* Added support for static private fields accessors and methods.
* Added error message for private identifiers used with static decorators. There is no spec to go with this behavior as of yet.
* Fixed emit static bug that used private names outside of classes for initialization in esnext. Fixed issue where nested privates produce incorrect brand check.
* Added tests for private static fields methods and accessors.
* Fixed error messages and tests after merge.
* Accept new baseline.
* Improved duplicate identifier checks for static private class elements.
* Added error when using initializers with private static fields when useDefineForClassFields is not specified and target is esnext.
* Fixed code review issues.
* Removed semantically wrong emit on `useDefineForClassFields:true` with `target:esnext`
* Changed emit for uninitialized private static fields.
* Added runtime error in helper if a static private field is accessed before it was declared.
* Fixed code review comments for private identifier static class elements.
* add debug.assertNever for unknown node type (#53)
* Fixed code review issues.
* Fixed code review issues for private class elements.
* Fixes class shadowing when checking access to a private static class element.
* fix private methods/accessors in class expr inside a loop
* collapse switch case
* fix class name
* simplify getPrivateMethodsAndAccessors
* remove findPreviousAccessorInfo
* lazily create weakSetName identifier
* do not allocate a node if not needed in visitMehodDeclaration (#55)
* Removed all the emit helpers for private identifier methods accessors and modified the existing helpers for get and set fields to do the same job.
* Simplified emit for private identifier class elements.
* do not clone the receiver (#57)
* leave bad code in for #constructor and duplicate private names (#58)
* Added check for WeakSet collision.
* Added error for using a set only accessor.
* update keyof tests and ?? (#62)
* replace ?? with ||
* update keyof tests
* fix emit helpers comments
* produce an error if private field helpers are not up to date
* add tests
* fix setter-only compound assignment
* fix tests
* fix duplicated trailing comments (#64)
* clear receiver pos and setTextRange on helper calls
Co-authored-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
A misbehaved client can sometimes cause the server to reach
`deleteDeclaration` with the SourceFile, and it will crash due to no
`node.parent`. I couldn't find a good way to create a test for it, but
I could trigger it manually by having a file with just a `,`, and
sending an explicit `getCodeFixes` command to the server with
`errorCodes: [6133]`.
Do three things to improve this:
1. `textChanges.ts`: if we get here with the root node, delete it
instead of failing.
2. `fixUnusedIdentifier.ts`: check that we don't `delete` a node that is
the whole source file, so the error is more focused (should have more
similar failure stacks).
3. `session.ts`: when there was any failure in `getCodeFixes`, check if
the input had a diag code that does not appear in the requested text
range, and throw an error saying that the failure is probably a
result of a bad request.
Closes#33726 (probably not fixing it, but making it easier to find the
cause)
* Revert "Revert "Editor support for link tag (#41877)" (#43302)"
This reverts commit 451d4354b9.
* Fix parsing @link at end of comment
* Parse comments as string when no @link occurs
* fix lint
* Initial scribbles
* Compiles but provides spans instead of location pairs
Probably need to fork the services/server types and provide a conversion
with Session.toFileSpan. Not sure where to put the conversion.
* Switch to DocumentSpan
In theory this is already better supported, but not sure practise bears
that out.
* Builds w/protocol types + conversions
* cleanup:better names and scrub TODOs
* fix test harness too
* Misc
1. Simplify protocol after talking to @mjbvz.
2. Add more tests.
3. Initial notes about where to add parsing.
* Parse and store links in the compiler
The text of the link is still stored in the comment text, but that's now
kept in an object instead of just a string. Each link has the parse for
the entity reference, if there is one.
Needs lots more tests -- this just makes all the existing jsdoc tests
pass.
* more tests and some fixes
* Fix other failing tests
* fix bad merge
* polish parser
* improve names and array types
* slight tweaks
* remove some done TODOs
* more tests + resulting fixes
* add+fix cross-module tests
* Support `@see {@link`
Plus find-all-refs support equivalent to @see's.
* add server test
* Make comments actually part of the AST
* Add span for link.name in language service/protocol
* Make checker optional in getJSDocTags
Also change to JSDocCommentText from JSDocCommentComment
* Use getTokenValue instead of getTokenText
Measure twice, slice once
* Add missing support for top-level links
The language service and protocol were missing support for top-level
links. This commit adds that plumbing.
* add string back to comment type in node constructors
* Full parse of link tags and jsdoc comment text
- Doesn't pass fourslash yet, I'm going to switch to baselines for
failures there.
- Still needs some work on the protocol to convert file+offset to
file+line+offset.
* fix lint
* Fix missing newlines in inferFromUsage codefix
* Parse jsdoc comments as text node/link array
And switch to line+character offsets in the protocol
* Fix fourslash tests
Mostly ones that can't be baselined, but I switched a couple more over
to baselines
* Improve types and documentation
* Test+fix @link emit, scrub other TODOs
* update API baselines
* test that goto-def works with @link
* Split link displaypart into 3
One for link prefix and suffix, one for link name, and one for link
text.
* update baselines
* Provide JSDocTagInfo.text: string to full clients by default
Instead of upgrading them to displayparts.
* Real server tests
* Disambiguate {@link} and @param x {type}
They are ambiguous; previously the parser preferred the type
interpretation, but will now look ahead and parse links instead when the
prefix is `{@link`.
* Add explanatory comment in test
* fix location in richResponse in protocol
* update API baseline
* Address PR comments
1. Add a cross-file goto-def test.
2. Switch from per-message args to UserPreference.
* use arraysEqual from core
Fixes#38070
When the originating definition was of the form
```js
module.exports.foo = expr
```
we were incorrectly trying to call `resolveName` on just the `foo` portion to get the "local" symbol, which simply failed to resolve (or would have resolved to the wrong thing), but for this form, the local symbol is just the containing property access expression
Previously, when getting jsdoc for signatures, the services layer would
get the jsdoc tags for the base symbol of a signature if it was
present. This is fine except when the base was overloaded. In that case,
the multiple signatures of the overload would all contribute jsdoc,
which is not correct.
A more correct fix would be to resolve overloads to the base, but
the compiler doesn't have this capability and adding it or jury-rigging
it seems like it would be complex, inappropriate for a fix to ship in a
patch version.
Co-authored-by: Orta Therox <git@orta.io>
Co-authored-by: Orta Therox <git@orta.io>
* About halfway through the checker
I'm going to merge with master to avoid clashing with the declaration
fix.
* Add undefined to Symbol.valueDeclaration
Also add undefined to a number of utility functions that have always
accepted it, but never added it to their type.
* Fix lint from code review
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* remove obsoleted fix from inferFromUsage
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Support go-to-definition for imports of scripts and arbitrary files
* Support go-to-definition for non-existent files
* Add missing file property
* Use `isExternalModuleNameRelative` instead of `!pathIsBareSpecifier`
* Add partial semantic test
* Combine with symbol search for non-source-file file references
* Fix and accept API baselines
* Fix useless or
* A definition is unverified if the file path was a guess, even if a source file has that path
* Add undefined to Symbol.declarations' type
Symbol.declarations now has type `Declaration[] | undefined`.
I made a mistake somewhere in the checker related to JS checking, so
there are quite a few test failures right now.
* undo clever change to getDeclaringConstructor
* Address PR comments
1. More early-returns.
2. More line breaks.
* Add 'data' property to completion entry for better cooperation between completions and completion details
* Add doc comment
* Update API baselines
* Add server test
* Test session’s Full result
* Fix tests
* stableSort to fix server fourslash test
* Explicit verification of data parameter
* Refactor emit substitution into transform
* Add reusable state machine for binary expressions
* Allow emitBinary to use state machine for comments/sourcemaps
* Switch core trampoline state back to arrays
* Switch binder to parallel stacks, temporarily partially revert emitBinary
* Add link to benchmark when posting perf results
* Ensure work stacks are per-execution
* Reenable comments and sourcemaps
* Eliminate well-known symbols in the checker: 2021 edition
* Actually update the lib text to say unique symbol, too (this is unneeded with compat code in place, but this makes goto-def make more sense)
* Add test showing mismatched symbol constructor type interop
* Add more test cases for some other related issues this fixes
* Revert computed name change
* Style comments
Make `tracing` either `undefined` or the same namespace as before.
Switching all calls to `tracing?.___` means that there is no cost for
a call or the arguments when tracing is not used. Comparing two runs
without tracing (27 runs, drop 5+5, avg rest) I get:
master:
42.59s user 1.00s system 165% cpu 26.372 total
changed:
42.01s user 0.982 system 165% cpu 26.039 total
(Makes it all private, so no api changes.)
* Signature help: support non-trailing rest parameters
In signature help, the first rest parameter will always be the *last*
'current' parameter (disregarding types). Previously, the signature help
current-parameter highlight was only correct for trailing rest
parameters. However, with tuple types, you can now create non-trailing
rest parameters. This PR now correctly highlights non-trailing rest
parameters as the last 'current' parameter.
For example, `names` should be the current parameter in all the calls
below:
```ts
declare function loading(...args: [...names: string[], allCaps: boolean, extra: boolean]): void;
leading(/**/
leading('one', /**/
leading('one', 'two', /**/
```
And, because signature help doesn't do real overload resolution, `names`
is also the current parameter for other calls:
```ts
leading(1, 2, 3, 'ill-typed', /**/
leading('fine', true, /**/
```
* Change 'variadic' to 'rest'
* fix missed rename
* use single, original tuple instead
* Revert "use single, original tuple instead"
This reverts commit f0896f32ea.
* Improve sig help of trailing rest too
1. Trailing rest keeps highlight at end instead of going off the end.
2. Non-trailing rest disable highlight entirely (by putting the index
one past the end).
* update API baselines
* Make object literal properties new identifier locations when not contextually typed
* Fix completions after comma in object literal
* Update other test
* Support Top Level "for await of".
* Add test cases for top level "for await of".
* Apply suggestions from code review
* add test cases
* remove redundant variables
* fix test baselines
* Update diagnostic message and tests
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* Add AutoImportSuggestions for UMD module export declarations instead of global keywords
* Add test for scripts
* Add more comments
* Provide auto import suggestion only for modules and not scripts
* PR review #1
* PR review #1
* feat: exclude declared variable when Object literal completions
* feat: check undeclareVariable when completion
* feat: add completion test case
* feat: code optimization
* feat: support shorthand property assignment
* feat: add shorthand property assignment test case
* feat: update completionPropertyShorthandForObjectLiteral test cases
* feat: exclude completions of variable initializers
* feat: update test cases
* feat: add completionListWithoutVariableinitializer test case
* feat: perfect the completionListWithoutVariableinitializer test case
* feat: remove isIdentifier limit
* feat: update test cases
* feat: code optimization and filter out some binding cases
* feat: update test case
* feat: handle arrow function expressions without braces
* feat: add arrow function expressions without braces test case
* feat: check node.parent exist first
* feat: optimization name
* feat: optimize test cases
* chore: code formatting
* feat: perfect type
* feat(26217): Add missing function declaration QF
* use codeFixAvailable instead of codeFix
* add diagnostics messages 'Method not implemented.' and 'Function not implemented.'
* use codeFixAvailable instead of codeFix
* fix signature types
* Test case where the wrong path is emitted
* If import is used in the file, prefer that import specifier over calculating new one
Fixes#39117
* Update Baselines and/or Applied Lint Fixes
* When non-relative path is used as user preference, ignore relative paths even if they are from the existing file
* Fix test
* Add comment
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
* Add support for abstract constructor types
* Add backwards-compatible overloads for creating/updating constructor types
* Reverting use of 'abstract' in lib/es5.d.ts due to eslint issues
* Update baseline due to reverting lib
* Add error for failing to mark an mixin class as abstract
* Fix declaration/quick info for abstract construct signatures
* fix: #41259
* fix: #41259
* fix: fourslash
* fix: remove nested if
* fix: change tc result for #41259
* fix: less restrictive shorthand completion rules
* fix: use typeMembers to find out whether properties are empty
* fix: typo
* fix: lint
* fix: exclude Object in completion
* fix: test
* fix: testcase tidy up
* fix: apply completions for unclosed literal and missing comma
* fix: ignore auto-imports
* fix: use exact to ensure the order of completions
* fix: use exact to ensure the order of completions
* fix: add new lines so it can easy to be distinguished
Co-authored-by: Johanne Enama <jenama@users.noreply.github.com>
Co-authored-by: Kevin Wong <kwong0419@users.noreply.github.com>
Co-authored-by: Johanne Enama <jenama@users.noreply.github.com>
Co-authored-by: Kevin Wong <kwong0419@users.noreply.github.com>
* fix as suggestion.
* Update moduleSpecifiers.ts
* compare symbol rather than string
* fix typo.
* fix
* fix lint.
* better name and more clear code
* fix comment.
Co-authored-by: Orta Therox <git@orta.io>
* Add text-based fastpaths into LS token matching
* Update src/services/utilities.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Update src/services/utilities.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Update src/services/utilities.ts
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Limit search a bit
* Secretly, this was allowed to be `undefined` and was in fact used as such
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Support find-all-references on triple-slash references that resolve to scripts
* Rename terrible name
* Add test for <reference types="..." />
* Actually accept baselines
* Naive implementation enough to build and write a test
* Add simple test
* Add project references test
* Add deduplication test, accept baselines
* Add test for referencing a script (doesn’t do anything)
* Update API baselines
* Use refFileMap for non-module references
* Fix find-all-refs on module specifier
* Remove unused util
* Don’t store text range on ts.RefFile
* Ensure string literal could itself be a file reference
* Remove unused utilities
* Improve baseline format
* Preserve old behavior of falling back to string literal references
* Update baselines from master
* Fix old RefFileMap code after merge
* Add test for additional response info
* Undo test change
* Allow type-only ImportEqualsDeclarations
* Suppress CJS-in-ESM error when type-only
* Add grammar error on import type in import alias
* Update API baselines
* Fix importsNotUsedAsValues with ImportEqualsDeclarations
* Make bad error talk words more good for Daniel. Fixes#41603
* One more error message baseline update
* Update transformer and emitter
* 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 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
* add basicly support for rename string literal type
* fix merge conflict
* fix some behavior
* Update package-lock.json
* Update package-lock.json
* do not break old behavior if not type checked
* fix cr issue
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
* Modify test case to reproduce error
* Fix TypeOnlyExport codefix to work with 3 or more type exports in the same declaration
The check to ensure that a fixed export declaration wasn't fixed again
was reversed. This only surfaced when 3 or more type exports existed in
the same declaration.
* Add failing test cases for comments being duplicated
* Fix convertToTypeOnlyExport codefix from duplicating leading comments
* Simplify convertToTypeOnlyExport when change is just inserting `type` keyword
Co-authored-by: Andrew Branch <andrew@wheream.io>