3169 Commits

Author SHA1 Message Date
TypeScript Bot
3c936358b2
Cherry-pick PR #47411 into release (#47420)
Component commits:
394c8422c2 Add failing test case.

9906b43ffa Guard against undefined relative path.

Co-authored-by: Daniel Rosenwasser <drosen@microsoft.com>
2022-01-13 12:17:50 -08:00
Benjamin Lichtman
5fc8f1dd80
Add opt-in user preference for prefix and suffix text on renames (#29314)
* Add user preference to control renaming through exports

* Only impact renaming

* Update baselines

* Use flag to control all prefix and suffix text and imports

* [WIP] add tests

* Only skip export import specifier with flag

* [WIP] Update tests

* Update test

* Pick up preference from host and update test

* Shorten flag name

* Add missing utility function

* Update comment

* [WIP] rename flag and respond to cr

* [WIP] Add flag for forRelatedSymbol

* Use larger search symbol set for old-style rename

* Respond to CR

* Fix small error

* Fix type mismatch

* Update comment and remove unnecessary exprot

* Respond to CR
2019-01-16 10:58:07 -08:00
Daniel Rosenwasser
9cd5f2dd3c Add regression test. (#29433) 2019-01-15 17:39:02 -08:00
Benjamin Lichtman
c5948bf068
Merge pull request #29385 from uniqueiniquity/renameImportPref
Add user preference to opt-in to renaming import paths
2019-01-15 10:29:57 -08:00
Sheetal Nandi
d53619a30d
Merge pull request #29418 from Microsoft/exportEquals
Handle generating action for export equals with anonymous symbol
2019-01-14 16:12:32 -08:00
Sheetal Nandi
6e54cbdaff Handle generating action for export equals with anonymous symbol
Fixes #28845
2019-01-14 15:32:13 -08:00
Wesley Wigham
3d2bf6a75f
Fix implement interface quickfix import types (#29410)
* Pass module specifier resolution host thru types constructed by implements quickfixes

* Add regression test

* Fix scope node for generated methods, fix lints
2019-01-14 13:56:27 -08:00
Benjamin Lichtman
d029fae35c Add user preference to opt-in to renaming import paths 2019-01-11 14:45:08 -08:00
Josh Goldberg
8d28f9230c Added codefix to enable experimentalDecorators in the user's config file
Starts on #29035 by creating a codefix to enable the `experimentalDecorators` setting in a user's config file, if one exists. The issue's discussion also mentions giving a more precise error message if the user has a jsconfig or tsconfig or creating one if not; I'd rather tackle those in separate PRs to keep this one small.

Doesn't create the code action if no config file is present. Otherwise keeps to the precedent of returning without action when the config file contents aren't the expected JSON structure (looking at `fixCannotFindModule.ts`).  Moves a couple JSON helpers from that file into the sibling `helpers.ts` so both codefixes can use them.
2019-01-11 09:20:12 -05:00
Sheetal Nandi
3f5c0b81a3 Fix existing test 2019-01-09 10:28:53 -08:00
Sheetal Nandi
d8ee4116ef Fix function declaration without body to be checked as context sensitive
Fixes #29032
2019-01-03 12:46:39 -08:00
Benjamin Lichtman
11585d29bc
Merge pull request #29218 from uniqueiniquity/jsdocSpanForVarStatement
Jsdoc span for var statement
2018-12-31 16:27:34 -08:00
Benjamin Lichtman
aebcb6df36
Merge pull request #29216 from uniqueiniquity/multilineArgumentSpans
Give appropriate outlining span for array and object literals as args in call expression
2018-12-31 15:18:07 -08:00
Benjamin Lichtman
bb2f300191 Add test 2018-12-31 15:15:47 -08:00
Benjamin Lichtman
a266131928 Add test 2018-12-31 14:43:56 -08:00
Benjamin Lichtman
adcb278272 Add test 2018-12-31 14:11:08 -08:00
Daniel Rosenwasser
0dbb9760c0
Merge pull request #29147 from Kingwl/type_query_completions
fix typeof completions broken
2018-12-31 10:36:39 -08:00
Benjamin Lichtman
c46090b8dc Show template literal in navtree function call args 2018-12-27 17:43:56 -08:00
王文璐
7c93affd7d fix typeof completions broken 2018-12-25 17:30:04 +08:00
Wesley Wigham
08022d57c8
Allow calls on unions of dissimilar signatures (#29011)
* Add core of new union signature logic and test - needs intersection signature logic to fully work

* Add inversion of variance for class props lookup from union sig returns

* Fix lints

* Combine parameter names for nicer quick info

* PR feedback 1

* Fix miscopy

* PR feedback round 2

* Remove argument name combining because loc :(

* Nit cleanup round 3

* Reinline getTupleTypeForArgumentAtPos

* Remove a tad more

* No step on sneky off-by-one error
2018-12-19 16:35:01 -08:00
Kerem
de4803658e Disable truncation for codefixes in signatureToMethodDeclaration. (#28188) 2018-12-13 11:21:36 -08:00
Nathan Shively-Sanders
ee987a25e2
Revert over-eager bailout when trailing whitespace (#28848) 2018-12-04 12:45:00 -08:00
Sheetal Nandi
c85460bc44
Merge pull request #28818 from Cow258/master
Move await keyword to inside of function
2018-12-04 12:36:13 -08:00
Nathan Shively-Sanders
24b39f90c9
Skip implicit any suggestions with no codefix (#28822)
The only unsupported one is binding patterns, which aren't supported by the codefix.
The code was a lot faster to write without supporting them, but there's
no real barrier besides that.
2018-12-04 09:17:37 -08:00
Nathan Shively-Sanders
594430f113
Infer from arrows from usage. (#28832)
* Infer from arrows from usage.

Previously only function expressions were, and only those with an easily
accessible name. Now any arrow function or function expression will
infer from usage.

* remove isApplicableFunctionForInference

*all* functions are applicable for inference now.
2018-12-04 09:03:08 -08:00
dreamran43@gmail.com
a2851d2ddc Move await keyword to inside of function and test 2018-12-04 03:01:56 +08:00
dreamran43@gmail.com
8eefaf48f5 Move await keyword to inside of function (Recovery & try test) 2018-12-04 01:50:02 +08:00
dreamran43@gmail.com
47302147ab Move await keyword to inside of function and test 2018-12-04 01:19:51 +08:00
Sheetal Nandi
23abcc02a3 Use compilerOptionsIndicateEs6Modules over program contains es6 modules for determining auto import offering. Also dont depend on uncheck js file for this.
Fixes #28696
2018-11-29 11:58:32 -08:00
Wesley Wigham
96937fd592
Allow union signatures to merge when they have differing argument counts (#28604)
* Allow union signatures to merge when they have differing argument counts

* Accept updated baselines

* Adjust comments io changed tests
2018-11-19 17:05:28 -08:00
Sheetal Nandi
dc03115d14
Merge pull request #28585 from Microsoft/isTypeOnlyCompletion
Properly set symbolMeanings when calling getSymbolsInScope
2018-11-19 08:50:41 -08:00
Sheetal Nandi
eeaa8bb527
Merge pull request #28533 from Microsoft/generateGetAndSet_noFindAllRefs
generateGetAccessorAndSetAccessor: Don't use FindAllReferences
2018-11-19 08:47:12 -08:00
Andy Hanson
59c014ba32 Properly set symbolMeanings when calling getSymbolsInScope 2018-11-16 17:04:29 -08:00
Wesley Wigham
cd08a22ef5
Clamp calculated sourcemap positions rather than throwing (#28583)
* Clamp calculated sourcemap positions rather than throwing, to allow the underlying file to drift out of date with the sourcemap without a crash

* Clamp line as well
2018-11-16 16:05:07 -08:00
Sheetal Nandi
6bb1ff2214
Merge pull request #27376 from Microsoft/codeFixCannotFindModule_suggestion_falsePositive
Don't implicit-any diagnostic for json module
2018-11-16 15:48:37 -08:00
Nathan Shively-Sanders
ea8ccc2ce4
In JS, constructor functions infer from call+construct (#28353)
* constructor functions infer from call+construct

Also fix an incorrect combining of inferences for rest parameters: the
inferred types will be arrays in the body of the function and the
arguments from outside the function will be the element type.

* All functions infer from call+construct contexts
2018-11-16 09:51:07 -08:00
Andy
b059135c51
When adding relative completions with rootDirs, still add completions for regular relative imports (#28561) 2018-11-15 15:11:27 -08:00
Nathan Shively-Sanders
6cee7c3080
Better nameless parameter implicit any error (#28554)
* Initial version, doesn't work for primitives yet.

Need to find out why.

* Primitives now work, plus improve error message

null and void don't even parse without parameter names so they are not
tested.

* Codefix: Add names to nameless parameters

* Improve error wording

* Add detail to error message
2018-11-15 12:45:39 -08:00
Andy
079f0436f3
Remove unused function (#28531) 2018-11-15 09:34:07 -08:00
Nathan Shively-Sanders
7a7328a17f
string|number inferences are low priority (#28381)
* string|number inferences are low priority

Also, refactor unifyFromContext to explicitly handle priorities

* string/number/strnum are not mutually exclusive

* Assert that high/low can't apply to same element
2018-11-15 08:32:28 -08:00
Andy
2600250a24
Add 'bigint' to type keywords (#28537) 2018-11-14 22:18:05 -08:00
Daniel Rosenwasser
fe263708be
Merge pull request #27019 from iliashkolyar/codefix_add_missing_new_operator
Codefix: add quick fix for missing 'new' operator
2018-11-14 16:53:25 -08:00
Andy Hanson
643678bb54 generateGetAccessorAndSetAccessor: Don't use FindAllReferences 2018-11-14 15:05:46 -08:00
Andy
da37457c72
When renaming an imported symbol, rename only in current file (#28406)
* When renaming an imported symbol, rename only in current file

* Improve re-export references

* Remember to use 'range' in for loop

* Uncomment tests
2018-11-14 09:09:00 -08:00
Wesley Wigham
004dc89600
Use elipses for reverse mapped types in nested positions (#28494) 2018-11-12 18:50:08 -08:00
Wesley Wigham
d99de73e85
Handle type argument lists as jsx completion starts (#28493)
* Handle type argument lists as jsx completion starts

* preceeding -> preceding
2018-11-12 16:30:04 -08:00
Wesley Wigham
2b345cc8f8
Track type recusion and symbol instantiation depth seperately in createAnonymousTypeNode (#28490) 2018-11-12 15:45:36 -08:00
Andy
fe1ba9bee3
Improvements to generateTypes (#28458)
* Improvements to generateTypes

* createProperty only if necessary
2018-11-12 11:50:48 -08:00
Anders Hejlsberg
a2205ad53d
Merge pull request #28429 from Microsoft/fixEmptyObjectIntersection
Fix empty object intersections
2018-11-10 00:44:57 -08:00
Sheetal Nandi
d6df82a77c
Merge pull request #28454 from Microsoft/codeFixAfterPrologue
Include code fix after prologue
2018-11-09 16:56:43 -08:00