Commit graph

32240 commits

Author SHA1 Message Date
TypeScript Bot 353f431abf Update LKG 2021-06-25 23:29:16 +00:00
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00
Andrew Branch 328e888a9d
Resolve module specifiers for auto imports in completion list (in incomplete chunks) (#44713)
* Enable module specifiers for all auto imports

* Use isIncomplete

* isIncomplete continuation

* Lots of fixes

* Merged/transient symbol fixes, resolve all ambient module specifiers up front, pull as many as we want from cache

* Fix existing tests

* Start testing

* Add more tests

* Set cache attempt limit, update API baseline

* Fix a few tests

* Fix contextToken

* Split getModuleSpecifiers

* Unexport function

* Clean up importFixes

* Clean up completions

* Delete transient symbol assertion - fixing later
2021-06-25 17:26:53 -05:00
Oleksandr T 7c47be76b0
fix(44738): fix eslint rules (#44739) 2021-06-25 14:50:19 -07:00
Orta Therox 9ebe11c2d3
Migrate latest dom types into libdom.d.ts (#44684)
* Add the types_web dom dts

* Update

* Adds new DTS

* Update baselines
2021-06-25 14:25:30 -07:00
Anders Hejlsberg 8058619aed
Control flow analysis of aliased conditional expressions and discriminants (#44730)
* CFA inlining of conditional expressions referenced by const variables

* Accept new baselines

* Add tests

* Accept new baselines

* Increase inlining limit to 5 levels per design meeting discussion
2021-06-25 13:59:58 -07:00
Wenlu Wang 906cbd2715
Proposal class static block support (#43370)
* Class static block (#9)

* Add types factory and parser

* Add some case

* Make class static block as a container

* Update cases

* Add visitor

* Add emitter and more compile target

* Check boundary of break and continue

* Add basic transformer

* Fix emit behavior

* Add more tests

* Add friend tests

* Update baseline

* Fix cr issues

* Accept baseline

* Add decorator and modifier check

* Add functional boundary check

* Fix conflict

* Fix computed prop name within context

* Add more tests

* Update baseline

* Avoid invalid test baseline

* Support use before initialize check

* wip

* Fix class static block context

* Fix checks

* Fix missing case

* Improve assert message

* Accept baseline

* Avoid new context

* Update diagnostic message

* Fix name collision

* Fix targets

* Avoid unnecessary files

* Add more case

* Add more test cases

* Fix strict mode function declaration

* Avoid private fields initializer if no private identifier references

* Avoid private fields and add more test case

* Add more case

* Add tests and support for related services functionality

* Fix this reference in static block

* Split parser diagnostic and binder diagnostic

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 09:24:05 -07:00
csigs 1694c77060
LEGO: Merge pull request 44741
LEGO: Merge pull request 44741
2021-06-25 04:18:35 -07:00
Wenlu Wang 66b4ba4b35
Add inlay hints support (#42089)
* Add signature arguments label support

* Support rest parameters and destruction

* make lint

* Fix tuple rest parameters

* Adjust name styles

* Rename to inline hints

* Partition inline hints

* Adjust range pred

* Add function expression like hints

* Support configure inline hints

* Display hints in single line

* Add test suits and tests

* Add range tests

* Support more hints

* Add more options

* Fix logical

* Add more cases

* Support call chains

* Rename options

* Match lastest protocol

* Update protocol changes

* Support context value and hover message

* Revert "Support context value and hover message"

This reverts commit 37a7089633.

* Revert "Update protocol changes"

This reverts commit e5ca31bc30.

* Add hover message

* Accept baseline

* Update src/services/inlineHints.ts

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

* Update src/services/inlineHints.ts

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

* Cache across the program

* Fix possible undefined

* Update protocol changes

* Fix missing property

* Make lint happy

* Avoid call chain hints

* I'm bad

* Add whitespace before type

* Add more tests

* Should care about jsdoc

* Support complex rest parameter

* Avoid module symbol  hints

* Care about leading comments

* Fix CR issues

* Avoid changes

* Simplify comments contains

* Fix CR issues

* Accept baseline

* Check parameter name before create regex

* Rename option

* Avoid makers

* Skip parens for argument

* Fix CR issues

* Fix enums

* Accept baseline

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-24 23:06:34 -07:00
TypeScript Bot 2767ab3e3e Update package-lock.json 2021-06-25 06:06:02 +00:00
csigs c83a430a5f
LEGO: Merge pull request 44737
LEGO: Merge pull request 44737
2021-06-24 16:13:19 -07:00
Andrew Branch 2b421bfc5d
Fix auto imports in opening JSX tag (#44724) 2021-06-24 17:14:54 -05:00
csigs baff2f8f97
LEGO: Merge pull request 44728
LEGO: Merge pull request 44728
2021-06-24 10:13:16 -07:00
csigs b43bc957bf
LEGO: Merge pull request 44717
LEGO: Merge pull request 44717
2021-06-24 04:15:51 -07:00
TypeScript Bot 6459ee4e4a Update package-lock.json 2021-06-24 06:05:48 +00:00
csigs b9bf1a5938
LEGO: Merge pull request 44716
LEGO: Merge pull request 44716
2021-06-23 22:13:11 -07:00
Nathan Shively-Sanders aee779ac7d
Skip typedef in services getJSDocTags (#43677)
* Symbols in services skip @typedef/@callback in jsdoc

Fixes #43534

* comment text skips jsdocs that are typedef-only

* Skip comment text from typedef-only jsdocs

* Skip whole comments instead of individual tags

* add semicolons

* retain comments from @callback + better comments
2021-06-23 16:19:14 -07:00
csigs ece76e8a63
LEGO: Merge pull request 44714
LEGO: Merge pull request 44714
2021-06-23 16:13:19 -07:00
Zzzen ce8e873bf8
regard TemplateLiteral as discriminant property (#44569) 2021-06-23 15:48:39 -07:00
csigs 6452cfbad0
LEGO: Merge pull request 44707
LEGO: Merge pull request 44707
2021-06-23 10:13:36 -07:00
Tobias Koppers fd49b26025
json modules should not treated as affecting global scope (#44690) 2021-06-23 10:04:25 -07:00
csigs c29811ea26
LEGO: Merge pull request 44705
LEGO: Merge pull request 44705
2021-06-23 04:13:17 -07:00
csigs 36bc24219d
LEGO: Merge pull request 44704
LEGO: Merge pull request 44704
2021-06-22 22:12:52 -07:00
csigs 15b4b32b39
LEGO: Merge pull request 44703
LEGO: Merge pull request 44703
2021-06-22 16:18:32 -07:00
Anders Hejlsberg 61ccc49a7b
Fix check for overwritten properties in object spreads (#44696)
* Fix check for overwritten properties in object spreads

* Accept new baselines

* Add tests

* Accept new baselines
2021-06-22 14:39:33 -07:00
Tobias Koppers 22637a232b
avoid computing a full shape for indirectly invalidated files (#44090)
* add shape updates to baselines

* avoid computing a full shape for indirectly invalidated files

using file version as shape is enough to keep build info valid
and it's much cheaper
2021-06-22 10:33:54 -07:00
csigs e9a51b4010
LEGO: Merge pull request 44699
LEGO: Merge pull request 44699
2021-06-22 10:18:04 -07:00
Ron Buckton 711b4e778b
Indirect calls for imported functions (#44624)
* Indirect calls for imported functions

* Fix unit tests
2021-06-21 19:51:13 -07:00
Wenlu Wang fafe3ff0b4
Improve parsing in await and yield context (#44680)
* Improve parsing in await and yield context

* Avoid yield and await check in identifier

* Revert "Avoid yield and awaitt check in identifier"

This reverts commit 9644859f29.

* Add some comments
2021-06-21 17:30:55 -07:00
exoticknight 9708022537
Fix 'arguments' check in class field initializer or static initialization block (#44393)
* Fix 'arguments' check in class field initializer or static initialization block

* return errorType

* Merge branch 'master' of https://github.com/exoticknight/TypeScript

* use isInPropertyInitializer

fix Diagnostics message
2021-06-21 16:57:48 -07:00
csigs 15c9cc8a32
LEGO: Merge pull request 44687
LEGO: Merge pull request 44687
2021-06-21 15:49:15 -07:00
Jesse Trinity 753feb8707
importModuleSpecifierEnding changes .ts string completions to .js (#44602)
* don't add .ts extensions to imports

* Update src/services/stringCompletions.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* add other supported extension types

* add final newlines

* adress PR comment

* add unsupported extension test

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-06-21 14:43:33 -07:00
Josh Goldberg 0a9b218b11
Report exact position of invalid characters in scanner (#44671) 2021-06-21 14:23:14 -07:00
Anders Hejlsberg 0e905be42b
Index signatures for symbols and template literal strings (#44512)
* Switch index signature storage to 'indexInfos: IndexInfo[]' property

* Accept new baselines

* Remove another usage of IndexKind enum

* Update getIndexedAccessType and resolveMappedTypeMembers

* Accept new baselines

* Update grammar checking for index signatures

* Accept new baselines

* Consider all index signatures in mapped types and union types

* Accept new baselines

* Update getIndexType

* Accept new baselines

* Intersect multiple applicable index signatures

* Use getApplicableIndexInfo instead of hardwired string/number handling

* Update index signature relationship checking

* Report type for which index signature is missing

* Report type for which index signature is missing

* Accept new baselines

* Make 'number' index signatures consistently apply to numeric strings

* Accept new baselines

* Update fourslash test

* Revise index constraint checking

* Accept new baselines

* Update error messages

* Accept new baselines

* Update type inference from index signatures

* Update isKnownProperty

* Update contextual typing based on index signatures

* Accept new baselines

* Support union types in index signature declarations

* Accept new baselines

* Check duplicate index signatures / remove redundant template literals from unions with string

* Accept new baselines

* Include key type in diagnostic / check symbol-named properties

* Accept new baselines

* Minor fix

* Add tests

* Accept new baselines

* Add optimized findApplicableIndexInfoForName

* Accept new baselines

* Another place we don't need to obtain literal type for property name

* Accept new baselines

* Don't create literal types that are going to be discarded

* Individual maps for string, number, bigint, and enum literal types

* Remove ineffective optimizations

* Accept new baselines

* Permit intersections as key types in index signatures

* Index expression in element access is template literal context

* Add tests

* Accept new baselines

* Symbol index signatures from object literals with computed symbol properties

* Accept new baselines

* Add more tests

* Accept new baselines

* Implement Go To Definition for all applicable index signatures

* Add fourslash test

* Accept new API baselines
2021-06-21 11:25:42 -07:00
Oleksandr T b72f67f45c
fix(44676): fix constToLetQuickFix selection range (#44677) 2021-06-21 11:22:24 -07:00
Eli Barzilay 9e2845227c getEditsForFileRename: fix updateTsconfigFiles w/ empty include
Avoid the assumption that there are always include patterns: when there
are none (and therefore the renamed file didn't match anyway), just skip
the test for added include.

Also change the code to use `return` to make it flatter.

(Also get rid of a redundant type.)

Fixes #40386.
2021-06-21 13:38:54 -04:00
TypeScript Bot c786ad4071 Update package-lock.json 2021-06-20 06:06:13 +00:00
TypeScript Bot 9251304ba7 Update package-lock.json 2021-06-19 06:06:03 +00:00
Oleksandr T 0858933dce
fix(44637): add spaces between exports assignment equal token (#44655) 2021-06-18 16:37:41 -07:00
Oleksandr T 6e4b7308a3
fix(44465): remove only unused declarations instead of the entire line (#44490) 2021-06-18 16:20:34 -07:00
Oleksandr T f850470d18
fix(44377): omit type alias declarations from JavaScript (#44378) 2021-06-18 14:59:31 -07:00
Wenlu Wang 8d3125b78a
Allows plugin to register commands (#44291)
* Pass session into plugin

* Use unknown message type

* Add missing unknown

* use editor services insted of every project

* Fix baseline

* Add plugin test

* Avoid type parameter

* Accept baseline
2021-06-18 14:46:09 -07:00
Nathan Shively-Sanders 0f216f36ec
Forbid duplicates in baselines (#44652)
* Forbid duplicates in baselines

The check is case insensitive.

* Update baselines and add semi-colons

Gotta have those semicolons.
2021-06-18 11:40:25 -07:00
Nathan Shively-Sanders 580bb066c1
Make files safe for Windows (#44651)
* make typeofthis tests case-insensitive-safe

* shorten test case names

* correct way to change test directories

* update baselines
2021-06-18 09:06:51 -07:00
Ryan Cavanaugh 5afe42e14e
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family (#44626) 2021-06-17 15:12:19 -07:00
Eli Barzilay fad9122872 services/utilities/getMeaningFromLocation(): fix w/ export specifiers
Fixes 44167, but also two other things:

* On an import/export, climb upto the declaration, and use
  `SemanticMeaning.Type` if it's a `type` only import/export.

* Add a `test.rangesInFile()` to fourslash, so it is easy to do multiple
  files in one test without an awkward filter (which was done in one
  more test).
2021-06-17 14:19:03 -04:00
Oleksandr T eee34d539c
feat(28491): add QF to declare missing properties (#44576) 2021-06-17 11:12:29 -07:00
Andrew Casey 9549928ce9
Make export-module and reference maps invertible (#44402)
* Make export-module and reference maps invertible

Right now, we're enumerating all the entries to find out which keys map
to a corresponding value.  By maintaining a two-way map, we can convert
this linear search into a map lookup and skip allocation of many, many
iterator results.

* Fix lint error

* Add some explanatory comments

* Rename, drop type parameters, and add readonly variant

* Simplify member list

* Fold non-exporting behavior into custom map type
2021-06-17 11:06:42 -07:00
Zzzen 8dbb2cd5fb
allow this in typeQuery (#43898)
* allow `this` in typeQuery

* add tests

* get this type as expression

* handle nested nodes

* update baselines
2021-06-17 07:52:20 -07:00
Anders Hejlsberg d46d82c9bd
Slightly more conservative check in isConstraintPosition function (#44621)
* Slightly more conservative check in isConstraintPosition function

* Update comment

* Add tests
2021-06-16 17:16:32 -07:00