6338 Commits

Author SHA1 Message Date
Andy
5538770c77 Look at correct 'package.json' location for a scoped package (#18580) (#18651)
* Look at correct 'package.json' location for a scoped package

* Update baseline
2017-09-21 10:13:38 -07:00
Andrew Casey
9630c46ea7 JavaScript: handle lack of modifiers on extracted method
The emitter expects undefined, rather than empty.  This only affects JS,
because TS applies `private` to all extracted methods.
2017-09-20 14:48:11 -07:00
Andrew Casey
27bede8ef1 Stop requiring that the full range of a declaration fall within the
selection

Fixes #18546

(cherry picked from commit af49c60a2cb415e9481dec58285c497bd7f49fed)
2017-09-19 17:33:37 -07:00
Andrew Casey
f0b78437f8 Merge pull request #18508 from amcasey/ExtractSingleToken
Re-enable extraction of a single token

(cherry picked from commit 47b61ac18c304028036914bba1cc65220b4732f9)
2017-09-19 17:31:20 -07:00
Andrew Casey
334125ed23 Merge pull request #18343 from amcasey/InsertionPosition
Improve insertion position of extracted methods

(cherry picked from commit 40e459117aeb0b792a23d6805af884b594dd42c4)
2017-09-19 17:31:18 -07:00
Andy
387fc205d0 Ensure that emitter calls callbacks for empty blocks (#18547) (#18550)
* Ensure that emitter calls callbacks for empty blocks (#18547)

* Fix action description
2017-09-18 11:17:06 -07:00
Andy
9639b52fcd Fixes to emit / format for codeFix (#18486) 2017-09-14 14:57:03 -07:00
Nathan Shively-Sanders
86d5311feb Don't parse param init when = is required but missing
Makes another test case pass that was taking exponential time to parse,
because now it notices that the = is not present and doesn't even try to
parse the initialiser expression.
2017-09-14 13:05:03 -07:00
Nathan Shively-Sanders
3a25650f1d Fail spec parsing lambdas on parameter missing a =
Fail speculative parsing of arrow function expressions whenever it has a
parameter with an initialiser that is missing '='. Ordinarily this is
allowed for better error recovery in the language service, but for
speculative parsing, the errors can compound. When the initialiser is an
error, and when the '=>' is missing (which is also allowed), what is
putatively an arrow function may actually be something else.

For example, `(a / 8) + function ()
{ }` is currently parsed as if someone had intended to write

`(a = /8)+function()/) => { }` but they forgot the `=` of the
initialiser, the `=>` of the lambda, forgot to close the regular
expression, and mistakenly inserted a newline right after the regular
expression.
2017-09-14 13:04:57 -07:00
Andy
39ecfc0db2 When loading a module from node_modules, get packageId even in the loadModuleFromFile case (#18185) (#18326)
* When loading a module from node_modules, get packageId even in the `loadModuleFromFile` case

* Support packageId for <reference types> too
2017-09-14 11:51:32 -07:00
Andy
b1e9446ee0 extractMethod: Don't try to extract a single token (#18090)
* extractMethod: Don't try to extract a single token

* Update tests
2017-09-09 22:24:55 -07:00
Mohamed Hegazy
1c7a29eeb3 Port fixes from master into release-2.5 (#18361)
* Test: parsing of two-line @typedef jsdoc

* Fix forEachChild's visit of JSDocTypedefTag

Also remove JSDocTypeLiteral.jsdocTypeTag, which made no sense since it
was only useful when storing information for its parent `@typedef` tag.

* Update baselines

* Inline variable to aid control flow

* Improved caching scheme for anonymous types

* Fix signature help

* Optimize caching of type literals

* Accept new baselines

* Fix linting errors

* Use canonicalized forms when comparing signatures

* Minor changes

* Document ThrottledOperations.schedule

* Limit the number of unanswered typings installer requests

If we send them all at once, we (apparently) hit a buffer limit in the
node IPC channel and both TS Server and the typings installer become
unresponsive.

* Fix lint issues

* Add explanatory comment
2017-09-09 12:54:30 -07:00
Andy
9434a81b71 extractMethod: Support renameLocation (#18351) 2017-09-08 17:09:17 -07:00
Nathan Shively-Sanders
7f639cc34b Test:disable lookahead in isStartOfParameter 2017-09-08 09:00:41 -07:00
Andy
f5b9e30986 Ensure that emitter calls callbacks (#18284) (#18325)
* 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 16:21:51 -07:00
Wesley Wigham
16a4997565 Fix 18224 (#18259) (#18292)
* Probably fix 18224

* Corrected test
2017-09-06 22:09:38 -07:00
Nathan Shively-Sanders
f3700f645d Test performance improvement:nested reference skip 2017-08-31 13:51:35 -07:00
Andy
62678cd736 Don't try to extract import to a method: simpler fix (#18054) 2017-08-25 15:12:21 -07:00
Andy
3644771ab6 Test for action description of code actions, and simplify description for extracting method to file (#18030) (#18044)
* 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 14:11:52 -07:00
Wesley Wigham
a39ae1fab7 Fix crash when attempting to merge an import with a local declaration (#18032) (#18034)
* There should be no crash when attempting to merge an import with a local declaration

* Show symbol has actually merged within the module
2017-08-24 23:58:20 -07:00
Wesley Wigham
350c9f647b Call dynamic import transform on expression used by export equal statement (#18028) (#18033)
* Call dynamic import transform on expression used by export equal statement

* Use Debug.fail
2017-08-24 17:59:45 -07:00
Ron Buckton
0851f6909e Added additional test 2017-08-24 17:02:52 -07:00
Ron Buckton
ec8f5cfe3f Follow symbol through commonjs require for inferred class type 2017-08-24 17:01:21 -07:00
Jan Melcher
d48ac07e14 Add test case for nested object spread / methods
See #16765.
2017-08-24 11:25:48 -07:00
Ron Buckton
80601fccb5 Fix crash when exporting class without name 2017-08-24 11:07:30 -07:00
Ron Buckton
952e9cae70 Remove debug assertions due to invalid syntax in generators transform 2017-08-24 11:05:49 -07:00
Mohamed Hegazy
6da73b05f9 Port #17771 to release-2.5 (#18018)
* No contextual return type when type is circular

* Add regression test
2017-08-24 11:03:43 -07:00
Andy
a5c9f40344 In services, show the aliasSymbol for a type even if it's not accessible in the current scope (#17810) 2017-08-15 14:59:26 -07:00
Wesley Wigham
d03d1074ee Make compiler options which map to a flag case-insensitive again (#17755) 2017-08-11 19:59:43 -07:00
Ron Buckton
09487b8a1d Added tests, pr feedback 2017-08-11 15:31:09 -07:00
Ron Buckton
e3b6df64b3 Add support to infer the quote style for import quick fixes 2017-08-11 14:26:25 -07:00
Yui
d352e3b03f [Master] fix 16407 - LS in binding element of object binding pattern (#16534)
* wip-try get symbol of bindingelement in objectBindingPattern first

* Add fourslash tests

* Update .types baselines

* Update .symbols baselines

* Revert checker changes

* Actually lookup type for binding property name definition

* More succinct check, clarify yui's comment
2017-08-11 11:14:59 -07:00
Ryan Cavanaugh
c110ecb870 Merge pull request #17625 from RyanCavanaugh/extract-method-2
Extract Method
2017-08-11 10:54:48 -07:00
Andy
f64b8ad902 Add "preserveSymlinks" option (#16661)
* Add "preserveSymlinks" option

* Respond to PR comments
2017-08-11 10:03:21 -07:00
Ryan Cavanaugh
c27ee81341 Merge branch 'master' into extract-method-2 2017-08-10 17:02:14 -07:00
Ryan Cavanaugh
12403d9f70 Various fixes 2017-08-10 13:07:42 -07:00
Andy
fe3a05e89a A function should be context-sensitive if its return expression is (#17697)
* A function should be context-sensitive if its return expression is

* Remove outdated comment

* Fix typo
2017-08-10 07:08:24 -07:00
Wesley Wigham
8fde483393 Add test for #16144 (#17712) 2017-08-10 00:10:36 -07:00
Nathan Shively-Sanders
a59f77ffb4 Test:type predicate uses correct index to report errors 2017-08-09 15:45:28 -07:00
Andy
e1ba65ae64 Add simple version of chooseOverload for common case of single non-generic signature (#17589)
* Add simple version of `chooseOverload` for common case of single non-generic signature

* Use a single function
2017-08-09 14:41:38 -07:00
Andy
37b20ee670 For duplicate source files of the same package, make one redirect to the other (#16274)
* For duplicate source files of the same package, make one redirect to the other

* Add reuseProgramStructure tests

* Copy `sourceFileToPackageId` and `isSourceFileTargetOfRedirect` only if we completely reuse old structure

* Use fallthrough instead of early exit from loop

* Use a set to efficiently detect duplicate package names

* Move map setting outside of createRedirectSourceFile

* Correctly handle seenPackageNames set

* sourceFileToPackageId -> sourceFileToPackageName

* Renames

* Respond to PR comments

* Fix bug where `oldSourceFile !== newSourceFile` because oldSourceFile was a redirect

* Clean up redirectInfo

* Respond to PR comments
2017-08-09 14:39:06 -07:00
Wesley Wigham
6221d7089e Fix import addition location (#17327)
* Add test with bug

* Fix for import placement

* Consolidate comment recognition functions into utilities

* Add another test with all 3 kinds

* Recognize path directives as part of triple slash directives

* Also handle no-default-lib triple-slash comments

* Test for all the triple-slash kinds

* Keep import-placement logic in the quickfix, since its not really a node start; accept new baselines

* Work in not-ES6, use a real no-lib comment

* Remove no default lib triple slash comment, it disables checking and thereby quick fixes

* Copy regex rather than have a regex copy
2017-08-09 14:03:37 -07:00
Andy
e73d58e21c findAllReferences: Type parameter is not globally visible (#16419)
* findAllReferences: Type parameter is not globally visible

* Add test for merged interface

* Clean up comment
2017-08-09 13:53:54 -07:00
Yui
39e0cc61a7 Fix 16628: "undefined" exception when name of binding element in binding pattern is empty (#17132)
* Handle the case where binding pattern name element is empty

* Update tests and baselines

* Feedback from PR

* Handle empty binding patterns more generally in emitter

* Dont simply handling fo empty binding patterns and stay spec compliant

* PR feedback
2017-08-09 13:47:44 -07:00
Wesley Wigham
c399230767 Retain comments inside return statements (#17557)
* Retain comments inside return statements by including the return keyword in the parse tree

* Revert "Retain comments inside return statements by including the return keyword in the parse tree"

This reverts commit 5d2142edb1ffb9f6cb150b815aff6e627ae80449.

* Readd test

* Function for handling printing comments on a token
2017-08-08 19:53:53 -07:00
Wesley Wigham
43e758e1a9 Create synthetic default exports for dynamic imports (#17492)
* Create synthetic default exports for dynamic imports

* Slightly better solution

* Actually accept baselines

* Slightly adjust synthetic type

* Cache synthetic type

* Inline variables, remove non-required calls

* Rename function
2017-08-08 17:01:18 -07:00
Nathan Shively-Sanders
847d7fe3c8 Merge pull request #17404 from Microsoft/use-type-param-constraints-for-computed-prop-types
Use type parameter constraints for computed property types
2017-08-08 16:29:28 -07:00
Ron Buckton
75c8ecb2f1 Merge pull request #17517 from tinganho/IgnoredCatchParameter
Ignored catch parameter
2017-08-08 16:15:18 -07:00
Wesley Wigham
d2625678f9 Add test case from #14439 (#17627) 2017-08-08 14:44:41 -07:00
Nathan Shively-Sanders
e494d73b29 Merge branch 'master' into use-type-param-constraints-for-computed-prop-types 2017-08-08 13:26:24 -07:00