Commit Graph

3570 Commits

Author SHA1 Message Date
Andrew Casey
e77425f984 Delete staticAssertNever in favor of assertTypeIsNever 2017-09-08 14:36:21 -07:00
Andrew Casey
26903552fe Improve insertion position of extracted methods
Old: End of target scope
New: Before the first non-constructor function following the extracted
range in the target scope
2017-09-08 14:19:28 -07:00
Andrew Casey
baefdd2ccb Revert "Make permittedJumps a parameter to eliminate save-restore pattern"
This reverts commit 57906fe90e8efd2fb285fcb67f018c0438ba06dd.
2017-09-07 16:22:12 -07:00
Andrew Casey
e3808b65d4 Simplify and correct PermittedJumps computation
1. It was looking at the parent which wasn't guaranteed to be in the
extracted range.
2. It was checking direct, rather than indirect containment - apparently
to avoid applying the rules to certain expressions (which can't contain
jumps anyway, unless they're in anonymous functions, in which case
they're fine).

Fixes #18144
2017-09-07 16:21:20 -07:00
Andrew Casey
a81fa7a801 Make permittedJumps a parameter to eliminate save-restore pattern 2017-09-07 16:13:27 -07:00
Andrew Casey
9d11fbb9b9 Correct permitted jumps check 2017-09-07 16:13:26 -07:00
Andrew Casey
0e50da62c4 Handle the combination of a write and a void return
When the return type is void, there's no `returnValueProperty`, but that
doesn't mean we don't need a `return` at the call site.

Fixes #18140.
2017-09-07 14:43:02 -07:00
Andy
ed4e2e6e3b Ensure that emitter calls callbacks (#18284)
* Ensure that emitter calls calbacks

* Move new parameter to end of parameters

* Fix for ConditionalExpression

* Make suggested changes to emitter

* Fix parameter ordering

* Respond to minor comments

* Remove potentially expensive assertion

* More emitter cleanup
2017-09-07 14:30:19 -07:00
Stas Vilchik
727facb55c fix initialization of shouldCreateNewSourceFiles (#17686) 2017-09-07 12:15:28 -07:00
Wesley Wigham
c1f2afd645 Add typedef declaration space, unify typedef name gathering (#18172)
* Add typedef declaration space, unify typedef name gathering, strengthen errorUnusedLocal

* Bonus round: make jsdoc presence way mroe typesafe

* Be exhaustive in nameForNamelessJSDocTypedef

* Remove nonrequired casts

* Replace more casts with guards

* Cannot be internal

* Debug.fail returns never, assert never no longer needs unreachable throw to satisfy checker

* Rename type

* Add replacement message as in 18287
2017-09-07 10:28:58 -07:00
Andy
193f4be355 Enable interface-over-type-literal lint rule (#17733) 2017-09-07 09:14:59 -07:00
Andy
be0633825c Don't provide string literal completions for string enums (#18288)
* Don't provide string literal completions for string enums

* Rename test
2017-09-07 09:13:46 -07:00
Nathan Shively-Sanders
b84e6bc188 Merge pull request #18096 from Microsoft/fix-codefix-jsdoc-variablelike-decls
Fix the jsdoc codefix for VariableLike declarations
2017-09-07 08:11:19 -07:00
Andy
7541c705bf Support navTo for special assignment kinds (#18154)
* Support navTo for special assignment kinds

* Return ScriptElementKind.unknown
2017-09-07 07:45:11 -07:00
Andy
b533b24686 extractMethod: Don't try to extract a single token (#18090)
* extractMethod: Don't try to extract a single token

* Update tests
2017-09-07 07:28:12 -07:00
Andy
b3c87aa919 Support find-all-references for default keyword (#17992)
* Support find-all-references for anonymous default exports

* Also handle re-exported default exports

* Add test for using `export =` with `--allowSyntheticDefaultExports`
2017-09-07 07:26:22 -07:00
Andy
817c329667 getFormattingScanner: Ensure scanner is closed, and avoid global variables (#18293) 2017-09-07 07:23:53 -07:00
Andy
23f793fc3e findAllReferences: Handle root symbols of binding element property symbol (#17738) 2017-09-07 07:23:06 -07:00
Andy
0434fe797a Get quickInfo from a contextual type if possible (#18119) 2017-09-07 07:22:39 -07:00
Andy
8c714c3651 Support special JS property assignments in doc comment templates (#18193) 2017-09-07 07:21:47 -07:00
Andy
53b5abe5bb Update fromCodeFixContext (#18290) 2017-09-07 07:19:00 -07:00
Andy
697c4d3353 Add debugName property to Rule (#18289) 2017-09-06 14:46:47 -07:00
Andy
36607e1bde Allow quoted names in completions (#18162)
* Allow quoted names in completions

* Don't allow string literal completions if not in an object literal; and use string literals for number keys

* Add TODO
2017-09-06 14:39:53 -07:00
Anders Hejlsberg
601a21c77b Fix signature help 2017-09-02 15:39:14 -07:00
Anders Hejlsberg
b65ff647c1 Improved caching scheme for anonymous types 2017-09-02 10:27:48 -07:00
Matt Bierner
c7b4ed3a91 Fix extract method for anon class expressions (#18168)
Check `scope.name` when trying to extract from an anon class
2017-08-31 13:21:08 -07:00
Andy
601c113d93 Handle indexed access types in getSymbolAtLocation and findAllReferences (#18149)
* Handle indexed access types in getSymbolAtLocation and findAllReferences

* Update baselines, simplify `const objectType`
2017-08-30 14:19:49 -07:00
Andrew Casey
27e590dd5e Merge pull request #18121 from amcasey/WalkerCancel
Allow cancellation during extract method's symbol walking
2017-08-29 17:24:12 -07:00
Andrew Casey
19c3a150e7 Allow cancellation during extract method's symbol walking 2017-08-29 15:38:43 -07:00
Ryan Cavanaugh
fa77e141b0 Merge pull request #17811 from RyanCavanaugh/fix17544
Filter + log undefined elements from the codeActions array
2017-08-29 15:32:44 -07:00
Ryan Cavanaugh
d7b3b6c77d Merge pull request #18120 from RyanCavanaugh/fix457864
Don't crash when a JS file appears in an inferred context
2017-08-29 14:18:47 -07:00
Ryan Cavanaugh
0e2d399c49 Don't crash when a JS file appears in an inferred context 2017-08-29 13:29:56 -07:00
Andrew Casey
a816079dda Add perf comment 2017-08-29 11:24:07 -07:00
Andrew Casey
01d7f0b699 Test that the return type of the extracted method counts as usage 2017-08-29 11:24:05 -07:00
Andrew Casey
30802cda97 Handle loose type parameters in Extract Method
Known limitations:

1. If a type parameter on an inner symbol shadows a type parameter on an
outer symbol, the generated code will be incorrect.  We should either
rename one or more type parameters or forbid the extraction.

2. Type arguments are always passed explicitly, even if they would be
inferred correctly.
2017-08-29 11:10:16 -07:00
Nathan Shively-Sanders
63cb84f3d1 Codefix jsdoc types for anything with a .type
That means type parameters and type arguments are still not handled.
2017-08-29 10:38:16 -07:00
Andy
9daa70c47e Revert "Handle indexed access types in getSymbolAtLocation and findAllReferences (#17787)" (#18111)
This reverts commit 30b3cb0f68.
2017-08-29 09:37:27 -07:00
Andy
30b3cb0f68 Handle indexed access types in getSymbolAtLocation and findAllReferences (#17787) 2017-08-29 07:53:22 -07:00
Nathan Shively-Sanders
16ccb66377 Provide jsdoc type code fixes for all variable-like decls
This includes 3 SyntaxKinds I missed earlier: Parameter,
PropertyDeclaration and PropertyAssignment.
2017-08-28 16:09:09 -07:00
Andy
e73b10a304 Use isPartOfExpression in extractMethod, not isExpression (#18047)
* Use isPartOfExpression in extractMethod, not isExpression

* Add whitespace
2017-08-25 15:15:16 -07:00
Andy
fe1242c8a9 Don't try to extract import to a method (#18025) 2017-08-25 09:53:56 -07:00
Andy
3a0ab74ed6 Test for action description of code actions, and simplify description for extracting method to file (#18030)
* Test for action description of code actions, and simplify description for extracting method to file

* Add unit test file missing from tsconfig.json (only affects gulp) and update tests

* Use the actual number

* Use "module scope" or "global scope" instead of "this file"
2017-08-25 09:53:28 -07:00
Andy
e2141ad469 Mark some arrays as readonly (#17725)
* Mark some arrays as readonly

* Avoid unnecessary allocations and style changes

* Fix lint
2017-08-24 09:55:01 -07:00
Andrew Casey
49676c58f3 Merge pull request #17844 from amcasey/SymbolWalker
Resuscitate the SymbolWalker API
2017-08-23 13:32:21 -07:00
Ryan Cavanaugh
43b8ce664c Merge 2017-08-22 14:31:49 -07:00
Wesley Wigham
053b915061 Rebase SymbolWalker change onto master
From PR #9847.
2017-08-22 11:33:32 -07:00
Basarat Ali Syed
ac098535cb export UsageEntry used by already exported functions 🌹 (#17853) 2017-08-21 16:55:40 -07:00
Andy
5e8e735db5 quickInfo: Don't check for type === undefined, check for any (#17815)
* quickInfo: Don't check for `type === undefined`, check for `any`

* Fixes:
* We still want to do some work even if type is `any`
* Second test for `if (type)` is necessary because it might not have been assigned.
2017-08-18 17:21:25 -07:00
Benjamin Lichtman
45c62ac0a6 Merge pull request #17709 from uniqueiniquity/objectsInArray
Correct outlining spans for object and array literals in array
2017-08-18 16:25:08 -07:00
uniqueiniquity
e6c1afb4a0 Style changes and cleanup 2017-08-18 15:59:22 -07:00