9337 Commits

Author SHA1 Message Date
Anders Hejlsberg
6b29060111 Merge branch 'master' into fix32434 2019-07-20 12:09:03 -07:00
Anders Hejlsberg
d96d16e10b Add additional test 2019-07-20 10:01:59 -07:00
Nathan Shively-Sanders
e543d8bc5a
Fix type keyword completions (#32474)
* Fix type keyword completions

1. In functions, type keywords were omitted.
2. In All context, no keywords were omitted.

(1) fixes #28737
(2) removes 17 keywords that should not be suggested, even at the
toplevel of a typescript file:

* private
* protected
* public
* static
* abstract
* as
* constructor
* get
* infer
* is
* namespace
* require
* set
* type
* from
* global
* of

I don't know whether we have a bug tracking this or not.

* Change keyword filter in filterGlobalCompletion

Instead of changing FunctionLikeBodyKeywords

* Add more tests cases

* Make type-only completions after < more common

Because isPossiblyTypeArgumentPosition doesn't give false positives now
that it uses type information.
2019-07-19 15:22:04 -07:00
Anders Hejlsberg
ae1add7210 Update tests 2019-07-17 15:02:20 -07:00
Anders Hejlsberg
7d4259ba9f Update tests 2019-07-17 14:57:26 -07:00
Andrew Branch
387c917765
Revert "Proposal: If there’s a package.json, only auto-import things in it, more or less (#31893)" (#32448)
This reverts commit 60a1b1dc1a93ca792cf12bb0432cf7bc134c3ad1.
2019-07-17 14:02:18 -07:00
Ron Buckton
049618f7da
Get contextual type of yield from contextual signature of containing function (#32433)
* Get contextual type of yield from contextual signature of containing function

* Add missing baseline
2019-07-16 17:16:21 -07:00
Sheetal Nandi
607c9c5e26 Fix missing tokenToString for the backtick
Fixes #32073
2019-07-16 13:30:38 -07:00
Sheetal Nandi
664671cf49
Merge pull request #32377 from minajevs/fix29666
Fix completion lists for 'readonly' and 'const' keywords
2019-07-16 10:17:52 -07:00
Nathan Shively-Sanders
1de76cd605
Control flow for element access expressions (#31478)
* Control flow for element access expressions

Draft version, just want to see how performance is

* Add baselines

* Fix cast lint

* Cleanup to share code path

* Fix errant diffs
2019-07-16 10:10:58 -07:00
Dmitrijs Minajevs
7608dc2306 Merge branch 'master' into fix29666 2019-07-16 10:52:26 +03:00
Dmitrijs Minajevs
9a37ef8667 typeAssertionKeywords tests 2019-07-16 10:04:14 +03:00
Daniel Rosenwasser
c7b8b2ae9b
Merge pull request #32382 from dragomirtitian/GH-29769-generic-auto-completion-missing-primitives
Fixed auto completion after a < token to return types not values.
2019-07-15 16:41:03 -07:00
Andrew Branch
7cdfbceb43
Improve accuracy of remove unnecessary await fix (#32384) 2019-07-15 15:17:32 -07:00
Ron Buckton
17762c480d
Fall back to (Async)IterableIterator if (Async)Generator not found (#32303) 2019-07-15 13:41:17 -07:00
Sheetal Nandi
0038b0baa3
Merge pull request #31815 from gb714us/bug/31631
create outlining span for JsxFragment
2019-07-15 11:19:24 -07:00
Orta
2c26ac2e43
Merge pull request #32243 from orta/fix-30536
Adds support for class completions after ASI inserted class property definition
2019-07-15 11:54:13 -04:00
Orta
4bb0aaea06
Merge pull request #32359 from orta/fix_14589
Don't add extra indentation for objects inside function parameters
2019-07-15 11:33:48 -04:00
Anders Hejlsberg
303297aa27
Merge pull request #32362 from microsoft/fix32230
Fix type parameter inference cache invalidation logic
2019-07-12 16:57:34 -07:00
Andrew Branch
4f3412153a
Parse quoted constructors as constructors, not methods (#31949)
* Parse quoted constructors as constructors, not methods

* Update baselines

* Fix disambiguation between quoted constructor and property named constructor

* Clean up parsing a bit

* Support escapes in constructor name

* Update baselines
2019-07-12 14:01:57 -07:00
Titian Cernicova-Dragomir
ba79b5ffac Fixed auto completion after a < token to return types not values. 2019-07-12 23:14:42 +03:00
Wesley Wigham
37f2e5972f
Cache & widen assigned js prototype type (#32381) 2019-07-12 12:49:34 -07:00
Orta Therox
59d5585814 Don't indent properties if an object literal follows directly from another object on the same line 2019-07-12 15:24:07 -04:00
Andrew Branch
89badcc9d5
Add 'Remove unnecessary await' suggestion and fix (#32363)
* Add remove unnecessary await fix

* Add test for removing unnecessary parens after await is gone

* Fix handling of numbers in property access expressions

* Don’t offer suggestion when awaited type is any/unknown

* Fix random other test

* Fix new expression edge cases

* Only remove parens for identifiers and call expressions
2019-07-12 11:03:20 -07:00
Andrew Branch
60a1b1dc1a
Proposal: If there’s a package.json, only auto-import things in it, more or less (#31893)
* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports
2019-07-12 10:08:55 -07:00
Andrew Branch
71bec5b698
Add quick fix to add missing 'await' (#32356)
* Start prototyping addMissingAwait codefix

* Filter by diagnostics that have missing-await related info

* Start writing tests and checking precedence

* Implement codeFixAll, add test for binary expressions

* Add test for iterables

* Add test for passing argument

* Add test for call/construct signatures

* Add test for awaiting initializer

* Improve assertion error

* Replace specific property access error with general one and add await related info

* Add test for property access

* Require code to be inside a function body to offer await

* Accept suggestion

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Add explicit test for code fix being not available unless something is a Promise

* Skip looking for function body if already in AwaitContext flags

* Inline getCodeActions function for symmetry
2019-07-12 10:07:55 -07:00
Andrew Branch
8516127a05
Fix regression of generic T assignability to Partial<T> (#32354) 2019-07-12 07:57:55 -07:00
Dmitrijs Minajevs
b2c555a57d Added new keword compeltion filter for assertions 2019-07-12 15:25:00 +03:00
Dmitrijs Minajevs
74805c2e23 Fixed failing test due to changed details 2019-07-12 14:11:23 +03:00
Anders Hejlsberg
c53246fa35 Add regression test 2019-07-11 10:47:27 -10:00
Orta Therox
dfc97db323 Don't add extra indentation for objects inside function parameters 2019-07-11 14:26:03 -04:00
Titian Cernicova-Dragomir
d2c9d6cc1b Improved parameter names for call signatures resulting from unions when only one parameter name is available. (#32056) 2019-07-11 10:06:49 -07:00
Andrew Branch
8eb3822ae0
Merge pull request #28290 from rflorian/add-codefix-cannot-find-name-in-for-loop
Add codefix for 'Cannot find name' diagnostic
2019-07-10 21:47:36 -07:00
Wesley Wigham
6839973bf7
Generate a unique type parameter name for each nested type parameter (#31544)
* Generate a unique type parameter name for each nested type parameter

* Add testcase from 31605

* Fix typo

* Liiiiiine eeeendingggggss
2019-07-10 17:12:20 -07:00
Wesley Wigham
daf0a73346
Fix lookup of optional methods in declaration emit (#32094) 2019-07-10 16:39:07 -07:00
Florian Regensburger
f273448925 Added addMissingConst codefix for comma separated initializers 2019-07-10 02:11:02 +02:00
Andrew Branch
a4cddd4647
Merge pull request #32239 from andrewbranch/enhancement/missing-await-errors
Improve error messages for potentially missing 'await'
2019-07-09 16:28:54 -07:00
Florian Regensburger
1de7881141 Add negative test case for addMissingConst codeFix with unexpected array elements 2019-07-09 02:07:54 +02:00
Florian Regensburger
384669a1ce Finish addMissingConst codefix for single variable and array literal assignments 2019-07-09 01:56:50 +02:00
Andrew Branch
094a001982
Did you forget to use await? on arguments of function calls 2019-07-08 14:33:25 -07:00
Andrew Branch
a3a076d79f
Did you forget to use await? for call and construct signatures 2019-07-08 14:01:25 -07:00
Andrew Branch
48fc6b8b17
Did you forget to use await? on iterables 2019-07-08 13:59:59 -07:00
Andrew Branch
c48e34ef91
Did you forget to use await? for operators 2019-07-08 13:50:56 -07:00
Florian Regensburger
7d08f172d8 Added fourslash tests for standalone and array initialization cases and started implementing them 2019-07-07 13:56:34 +02:00
Anders Hejlsberg
de2fb9584e Add regression test 2019-07-04 16:27:03 -10:00
Ron Buckton
e8bf9584aa
Improve type checking and inference for Generators and Async Generators (#30790)
* Improve typing for Generators and Async Generators

* Add TReturn and TNext to Iterator, IterableIterator, etc.

* Update ts internal Iterator to be assignable from global Iterator

* Make 'done' optional in IteratorYieldResult

* Revert Iterable and IterableIterator to simpler versions plus other fixes

* Add additional inference tests

* Added additional tests

* PR cleanup and minor async iteration type fix

* Updated diagnostics message and added non-strict tests

* Fix expected arity of Iterator/AsyncIterator
2019-07-03 21:55:59 -07:00
Wesley Wigham
0bea4bd3c9
Widen object literal this types (#32240) 2019-07-03 15:58:21 -07:00
Orta Therox
6e9d098d41 Adds support for completions after ASI inserted expressions
Signed-off-by: Andrew Branch <andrew.branch@microsoft.com>
2019-07-03 18:02:44 -04:00
Nathan Shively-Sanders
6f0baa3ae1
Merge pull request #29717 from petersandor/jsdoc-tag-author-email-support
Support email in author JSDoc tag
2019-07-03 10:42:02 -07:00
Andrew Branch
16bbb4d002
Merge pull request #32077 from andrewbranch/bug/31114
Fix incorrect noImplicitAny error on contextual union function signature
2019-07-03 10:10:10 -07:00