Commit graph

31752 commits

Author SHA1 Message Date
Daniel Rosenwasser 4d1dfab9e0
Ignore .devcontainer for npm (#42826) 2021-02-16 15:56:29 -08:00
Matt Bierner 51c73a1cee
Add a basic dev container (#42041)
* Add a basic dev container

Adds a basic dev container. This basic development environment has tools like gulp installed

* Update CONTRIBUTING.md

* Move development container seciton to be first tip

* Spaces to tabs and remove comments

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-02-16 14:20:15 -08:00
Wenlu Wang d6a32e31ae
Fix import fix on react or react dev (#41950) 2021-02-16 10:28:48 -08:00
Jack Works bb8b9db9f7 Add error for missing await in conditionals 2021-02-16 12:00:41 -05:00
TypeScript Bot ba994f1381 Update package-lock.json 2021-02-16 06:24:18 +00:00
TypeScript Bot 847992b64b Update package-lock.json 2021-02-15 06:23:37 +00:00
TypeScript Bot 19e7a89bbb Update package-lock.json 2021-02-14 06:23:08 +00:00
TypeScript Bot 31f3742fc4 Update package-lock.json 2021-02-13 06:23:11 +00:00
Andrew Branch d3055f0f29
--inspect can no longer be used as a flag through gulp (#42701)
* --inspect can no longer be used as a flag through gulp

* Add --break alias

* Update scripts/build/options.js
2021-02-12 16:01:22 -08:00
Oleksandr T e5294b4d3c
fix(42519): fix infer function return type quick fix with arrow functions without parens (#42532) 2021-02-12 14:38:29 -08:00
Sheetal Nandi e98f6b07ab
Refactor project references and source map tsserver tests so they are inline for easy editing (#42782) 2021-02-12 14:32:23 -08:00
Nathan Shively-Sanders 5deb676b3a
No did-you-mean-to-call error on casts Part 2 (#42779)
* No did-you-mean-to-call error on casts

I chose to do the ad-hoc check rather than yet another tree walk.

1. It's faster to run and easier to read.
2. This error came from looking at real code. It happened twice, so I
think the best estimate for other uses that happened zero times is in
fact zero.
3. I couldn't think of other places to put the cast, given the
restrictions on `testedNode` just before the new code.

* Skip parentheses
2021-02-12 10:07:59 -08:00
Nathan Shively-Sanders f2bcb2101b
No did-you-mean-to-call error on casts (#42626)
I chose to do the ad-hoc check rather than yet another tree walk.

1. It's faster to run and easier to read.
2. This error came from looking at real code. It happened twice, so I
think the best estimate for other uses that happened zero times is in
fact zero.
3. I couldn't think of other places to put the cast, given the
restrictions on `testedNode` just before the new code.
2021-02-12 09:36:55 -08:00
TypeScript Bot e72c015bca Update package-lock.json 2021-02-12 06:23:08 +00:00
Oleksandr T ff5ae3561f
feat(42735): add single line comments to selection ranges (#42763) 2021-02-11 17:14:55 -08:00
Oleksandr T 475036950e
fix(42133): fix instantiated undefined type from JS initializer (#42662) 2021-02-11 17:07:14 -08:00
Eli Barzilay c7bac6f2e6 Avoid getting undefined callSignatures/constructSignatures in getPropertyOfType
e350c357 (#40228) introduced a subtle bug: it switched the flags to an
alias, dropping `SymbolFlags.Property` --- and that makes
`symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to
`getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures`
being `undefined`.  So initialize them in `setStructuredTypeMembers`
before calling `getNamedMembers()`.

Fixes #42350
2021-02-11 18:56:47 -05:00
Masato Urai a3ead92046 Improve error message for overload that takes spread arguments
The original error message on the last line I have added to in
functionParameterArityMismatch.ts was

    No overload expects 5 arguments, but overloads do exist that expect
    either 4 or Infinity arguments.

even if we do not define a function that takes Infinity arguments.

This PR changes it to this:

    Expected 0-6 arguments, but got 5 or more.

I feel it is still a bit strange but much more understandable.

Fixes #42418
2021-02-11 16:49:21 -05:00
Eli Barzilay 4fc9c8446d Refactor the tracing namespace organization
Also changes the `tracingEnabled.Mode.*` enum to a string union.
2021-02-11 16:08:35 -05:00
Oleksandr T b7922147d3
fix(42714): do not show inferFunctionReturnType QF on function body (#42737) 2021-02-11 10:46:48 -08:00
TypeScript Bot d18b728e0b Update package-lock.json 2021-02-11 06:23:23 +00:00
Daniel Rosenwasser 290b0ea94d
Pin Node version for Volta users. (#42746) 2021-02-10 12:56:22 -08:00
TypeScript Bot 55cd98eaa3 Update package-lock.json 2021-02-10 06:23:21 +00:00
Daniel Rosenwasser 94747aa4e1
Bump version to 4.3. (#42728) 2021-02-09 17:07:28 -08:00
Sheetal Nandi 5280ba400c
Handle if plugin doesnt specify name (#42717)
Fixes microsoft/vscode#116219
2021-02-09 15:23:29 -08:00
Orta Therox 8c5fa5cc91
Revert assignability cases in getNarrowedType (#42231)
* Revert subtype narrowing changes from readonly array PRs

* Adds a test for the change

* More baselines
2021-02-09 15:03:11 -08:00
Jesse Trinity 1b19af0f14
Refactor params for interface (#42652)
* apply refactor to interface methods

* handle calls

* no available refactors for union type

* add tests

* Update src/services/refactors/convertParamsToDestructuredObject.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* address comments

* Update src/services/refactors/convertParamsToDestructuredObject.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/services/refactors/convertParamsToDestructuredObject.ts

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

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-02-09 13:30:31 -08:00
Daniel Rosenwasser 664ed17ebd
Allow only package names as plugin names (#42713)
* Allow only package names as plugin names

* Remove extra argument following merge from master branch.

* kipped -> Skipped

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2021-02-09 11:30:09 -08:00
Eli Barzilay fe2899c2ac Use a 10ms sampling frequency to filter tracing dumps
Currently hard-wired to 10ms, can be made configurable if needed later.
2021-02-08 17:01:45 -05:00
Eli Barzilay f462576ac2 Re-do tracing initialization and tests around calls
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.)
2021-02-08 15:41:35 -05:00
TypeScript Bot 7de5d0b83a Update package-lock.json 2021-02-07 06:22:44 +00:00
Oleksandr T 60a6240210
feat(42637): add generateReturn option to UserPreferences (#42642) 2021-02-05 15:24:48 -08:00
Wesley Wigham 4c43e09c9e
Add fallback error locations for nameless declarations, better class error locations (#42585) 2021-02-05 12:07:14 -08:00
Nathan Shively-Sanders aba932aefa
Create synthetic exports symbol for commonjs module (#42655)
* Commonjs module:create synthetic exports symbol

Previously, the `module` identifier in commonjs modules got a synthetic
type with a single property `exports`. The exports property reused the
file's symbol, which, for a module file, gives the correct exported
properties.

However, the name of this symbol was still the filename of the file, not
`exports`. This PR creates a synthetic symbol for `exports` by copying
in a similar way to esModuleInterop's `default` symbol in
`resolveESModuleSymbol` (although the intent there is to strip off
signatures from the symbol).

* correct parent of synthetic symbol
2021-02-05 10:56:03 -08:00
Andrew Branch 79ed041b6a
Fix Format Selection on JSDoc comments (#42411) 2021-02-05 10:37:47 -08:00
Nathan Shively-Sanders f1583f08a0
Signature help turns off current-parameter display for non-trailing rest parameters (#42592)
* 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
2021-02-05 09:37:28 -08:00
TypeScript Bot 215ee40dc8 Update package-lock.json 2021-02-05 06:23:09 +00:00
Wesley Wigham 19db9ad675
Swapping the quote style of a string for completions should swap _all_ quotes in the string (#42650) 2021-02-04 13:56:34 -08:00
Wesley Wigham f569aa3832
Use a (hopefully) more efficient regex for matching jquery in the safelist (#42653) 2021-02-04 13:53:05 -08:00
Wesley Wigham 62bc8bec4e
Replace _all_ tabs in pretty output, not just the first on each line (#42649) 2021-02-04 13:25:53 -08:00
Wesley Wigham be18057792
Add check for no match into fs watch rename event handler (#42651) 2021-02-04 13:20:38 -08:00
Anders Hejlsberg ab2729a99b
Smarter subtype reduction in union types (#42353)
* Exclude primitive types from union subtype reduction in most cases

* Accept new baselines

* Minor fixes

* Less aggressive checking of assertion function calls that don't affect control flow

* Accept new baselines
2021-02-04 11:18:30 -10:00
Andrew Branch 258be217a6
Fix completions crash on transient exported property named 'default' (#42583)
* Fix completions crash on transient exported property named default

* Revert simplification, both conditions were needed
2021-02-04 10:22:15 -08:00
TypeScript Bot 05e2f74fbe Update package-lock.json 2021-02-04 06:22:59 +00:00
Oleksandr T 4c118ae67b
fix(39022): wrap export references UnaryExpression to ParenthesizedExpression (#41156) 2021-02-03 18:26:33 -08:00
Anders Hejlsberg e2318217fb
Strip nullable types from 'this' type in inference with optional chain calls (#42536)
* Properly strip nullable types from this type in optional chain calls

* Add regression test
2021-02-03 13:50:23 -10:00
Daniel Rosenwasser cce4bfbc7c
Revert changes for template literal types, keeping tests. (#42588)
* Revert changes for template literal types, keeping tests.

* Update Baselines and/or Applied Lint Fixes

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-02-03 14:49:03 -08:00
Daniel Rosenwasser 654975481f
Use spaces instead of non-breaking spaces, narrow non-breaking spaces. (#42500) 2021-02-03 14:29:42 -08:00
Sheetal Nandi c3e132da59
Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options (#42544)
* Test when config file extends is incorrectly computed
Test for #40720

* Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options
Fixes #40720
2021-02-03 11:09:06 -08:00
Andrew Branch 1c25b009f2
Sort import fixes by number of directory separators (#42614)
* Add failing test

* Sort all import fixes by number of directory separators
2021-02-03 10:42:13 -08:00