Commit graph

23884 commits

Author SHA1 Message Date
Kubilay Kahveci 9cc3070938
expose getImmediateAliasedSymbol() publicly (#44644)
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
2021-08-02 15:57:54 -07:00
Armando Aguirre 642060db6f
Replace non-null assertion with optional chain on assert nodes (#43788) 2021-08-02 15:26:48 -07:00
Oleksandr T c23abc8957
fix(45192): show implement interface QF for re-exported types (#45245) 2021-08-02 15:19:19 -07:00
Andrew Branch bfd5b2f7f0
Fix decorator metadata references to type-only-imported namespaces (#44915)
* Add test

* Fix metadata references to type-only-imported namespaces

* Use `!!` instead of `|| false`
2021-08-02 14:18:15 -07:00
Wesley Wigham 7669bfba15
Actually instantiate the type of the annotation used for contextual types (#45285) 2021-08-02 12:44:56 -07:00
Oleksandr T fcf7bafd57
fix(44812): add outlining spans for comments inside blocks (#44847) 2021-07-30 15:56:32 -07:00
Armando Aguirre 76d754329e
Fix bigInt completions (#45059)
* Fix bigInt completions

* Added regresion test
2021-07-30 14:40:50 -07:00
Andrew Casey bbd9c3a6e6
Use arrow functions to bind globals correctly in web scenarios (#45242)
* Use arrow functions to bind globals correctly in web scenarios

https://github.com/microsoft/vscode/issues/127700#issuecomment-889443607

* Add missing spread operators
2021-07-30 14:22:30 -07:00
Wenlu Wang 8cdcec4454
Avoid provide hints for binding patterns (#44961)
* Avoid provide hints for binding patterns

* Rename as 56
2021-07-30 09:43:20 -07:00
Andrew Casey 0f6e6efde0
Avoid no-op export map updates (#45238)
* Add id and version to ManyToManyPathMap

...so that unchanged maps can be recognized without having to examine
their contents.

* Track cache version on BuilderState

In practice, `updateExportedFilesMapFromCache` is called repeatedly
without the cache changing in between.  When this occurs, there's no
need to update the `BuilderState` (this was already the net effect, but
it took a long time to determine that no work was required).

* Fix typo in comment
2021-07-30 09:27:32 -07:00
tjjfvi 9d957c64c5
Fix getChildCount/At methods in EndOfFileTokens (#44991)
* Fix getChildCount/At methods in EndOfFileTokens

Before, they were hardcoded to return `0` and `undefined!`, respectively, but that is inaccurate for `EndOfFileToken`s with attached jsdoc.

* Add tests for getChild* methods on EndOfFileTokens
2021-07-30 09:03:19 -07:00
Gabriela Araujo Britto db0f7938dd
Allow narrowing for any left-hand in operand (#45152)
* allow narrowing for any left-hand in operand
2021-07-29 14:06:45 -07:00
Gabriela Araujo Britto 366e9de264
Fix compiler crash on property symbols without declarations (#45190)
* don't track computed name if symbol has no declaration

* add compiler test

* add non serializable property declaration emit error

* don't track computed name if symbol has no declaration

* fix small stuff

* rebase: add non serializable property declaration emit error

* use symbolToString instead of symbolName
2021-07-29 12:42:54 -07:00
Andrew Branch 62773051e7
Fix import statement completions for export= in JS files (#45128) 2021-07-29 10:28:47 -07:00
Oleksandr T c79ec7bfbb
fix(45225): do not show add missing member QF for libraries files (#45231) 2021-07-29 10:22:27 -07:00
Eli Barzilay 7e8bba6908 Fix template string refactoring and nodeFactory bug
Instead of letting `createTemplate*` generate a broken raw string from
the cooked one, grab the source code for it.

Also, add a missing bit to `\`-quote `$`s.  As the comment in the code
says, it could just `\`-quote `${` since other `$`s are valid, but I
think that it's less confusing to always quote $s (but the change is in
the comment if minimalism is preferred).

Also, a small-but-confusing bug in `getCookedText()`.

Many tests for all of this.

Fixes #40625
2021-07-29 04:23:06 -04:00
Oleksandr T 7c197becb6
feat(45210): add inlay hints for getters and setters (#45214) 2021-07-28 14:52:37 -07:00
Oleksandr T b81eb6cfe1
fix(45182): allow property access in arrow function (#45193) 2021-07-27 09:46:17 -07:00
Oleksandr T 85e0e5ad07
fix(44837): add graceful recovery for require completions (#45151) 2021-07-26 15:26:43 -07:00
Wenlu Wang 9665bc6199
Supress hints for access expr too (#45121) 2021-07-26 11:59:14 -07:00
Oleksandr T 11c7daef62
fix(45114): throw an error when using '#' as an identifier (#45124) 2021-07-26 11:39:17 -07:00
Oleksandr T ba226167bc
fix(45157): omit error after property declaration without semicolon (#45165) 2021-07-26 09:57:58 -07:00
Andrew Branch 48aecfa5a5
Consider module augmentations in files referenced by imports in watch/incremental (#45156)
* Consider module augmentations in files referenced by importsin watch/incremental

* Accept baselines

* Accept other baseline

* Hooray optional chaining

* Delete outdated and unuseful comment
2021-07-23 16:32:52 -07:00
Andrew Branch f029a8266c
Filter auto imports by symbol flags before resolving module specifiers (#45168)
* Filter auto imports by symbol flags before resolving module specifiers

* Don’t filter types out of import statement completions
2021-07-23 15:56:34 -07:00
Andrew Branch 9c8a90d685
Check cancellation token during exportInfoMap generation (#45138) 2021-07-21 14:17:34 -07:00
Oleksandr T e064817371
feat(42639): allow narrowing type in 'in' operator with the identifier on the left side (#44893) 2021-07-21 09:10:32 -07:00
Andrew Branch 31d98ec44a
Don’t try to create auto import provider when host program doesn’t exist (#45126)
* Guard against creating auto import provider without host program

* Also don’t pre-seed auto import provider if updateGraph didn’t produce a program

* Rename `isFirstLoad`
2021-07-20 11:16:58 -07:00
Ron Buckton 365b25693c
Fix and validate post-increment/decrement in module emit (#44968) 2021-07-19 13:34:42 -07:00
Andrew Branch 476054ea57
Fix auto import crashes caused by unrelocatable symbols (#45055)
* Add failing test

* Fix auto import crashes caused by unrelocatable symbols

* Use util for testing if symbol is an external module
2021-07-19 10:32:47 -07:00
Andrew Branch 36225c3260
Detect preference for Unode:-prefixed node core modules (#45080) 2021-07-19 09:56:24 -07:00
csigs ddbd829ea1
LEGO: Merge pull request 45092
LEGO: Merge pull request 45092
2021-07-18 16:17:56 -07:00
csigs a84ca309e0
LEGO: Merge pull request 45088
LEGO: Merge pull request 45088
2021-07-17 22:14:11 -07:00
csigs 64e19ffc3f
LEGO: Merge pull request 45087
LEGO: Merge pull request 45087
2021-07-17 16:17:42 -07:00
csigs 7ad76171f7
LEGO: Merge pull request 45085
LEGO: Merge pull request 45085
2021-07-17 10:13:32 -07:00
csigs 5e55501ac6
LEGO: Merge pull request 45083
LEGO: Merge pull request 45083
2021-07-16 22:14:50 -07:00
csigs cf8217fc29
LEGO: Merge pull request 45081
LEGO: Merge pull request 45081
2021-07-16 16:13:58 -07:00
Andrew Branch b300ef4bc7
Check for watched directories before clearing map (#44947) 2021-07-16 15:35:38 -07:00
Oleksandr T 1aac3555f7
fix(45049): fix diagnostic for missing property initializer (#45052) 2021-07-16 15:10:42 -07:00
Oleksandr T ba2e2600c8
fix(44701): allow renaming string literal in rhs/lhs of equality (#44708) 2021-07-16 14:45:06 -07:00
Anders Hejlsberg 193b7494d0
Properly propagate silentNeverType in intersections (#45073)
* Properly propagate silentNeverType in intersections

* Add regression test
2021-07-16 11:20:04 -07:00
Wesley Wigham d0efe9065e
Dont swallow declaration emit errors when issued on nodes without names (#44995) 2021-07-16 10:30:22 -07:00
csigs 7ef66f647b
LEGO: Merge pull request 45072
LEGO: Merge pull request 45072
2021-07-16 10:13:11 -07:00
Andrew Casey d8f2aaeebf
Shorten baseline names (#45054)
Fixes #45051
2021-07-16 10:01:36 -07:00
Oleksandr T 00596e19f5
fix(44168): exclude adding export to existing exported identifier (#44755) 2021-07-16 09:40:17 -07:00
Oleksandr T 23ebe04563
fix(44902): resolve members in Union or Intersection types (#44904) 2021-07-16 09:07:52 -07:00
csigs e4da7a97a0
LEGO: Merge pull request 45067
LEGO: Merge pull request 45067
2021-07-16 04:13:22 -07:00
Wesley Wigham 8268f2adec
Avoid bogus circularity error on context sensitive constructor property assignments (#44601)
* Avoid bogus circularity error on context sensitive constructor property assignments

* Add JS case and ensure its fixed
2021-07-15 17:06:56 -07:00
csigs 87cff4e3bb
LEGO: Merge pull request 45060
LEGO: Merge pull request 45060
2021-07-15 16:13:30 -07:00
Andrew Branch 6d3772f357
Fix auto import require of CJS module with module:es2015+ and allowSyntheticDefaultExports (#44955) 2021-07-15 16:08:05 -07:00
Josh Goldberg 541e553163
Specific diagnostic suggestions for unexpected keyword or identifier (#43005)
Error message improvement for unexpected tokens in the following situations:

* A word was parsed that seems to have a low edit distance from a known common keyword
* A word was parsed that seems to be a known common keyword and a name _without_ a space in-between
* Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected

___

* Specific diagnostic suggestions for unexpected keywords or identifier

* Don't reach into there, that's not allowed

* Improved error when there is already an initializer

* Specific module error message for invalid template literal strings

* Skip 'unexpected keyword or identifier' diagnostics for declare nodes

* Improve error for function calls in type positions

* Switch class properties to old diagnostic

* Corrected errors in class members and reused existing textToKeywordObj map

* Corrected more baselines from the merge

* Update src/compiler/parser.ts

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

* Mostly addressed feedback

* Clarified function call type message

* Split up and clarified parsing vs error functions

* Swap interface name complaints back, and skip new errors on unknown (invalid) tokens

* Used tokenToString, not a raw semicolon

* Inline getExpressionText helper

* Remove remarks in src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-07-14 13:50:55 -07:00
Gabriela Araujo Britto 3358f137c6
Fix namespace name conflict detection in "Convert named imports to namespace import" action (#45019)
* fix namespace conflict detection
2021-07-14 11:07:12 -07:00
jjangga0214 2b8296b7ad
chore(typo): fix comment (#45016) 2021-07-14 09:28:48 -07:00
Jean Pierre 40ec8392a1
Fixes JSDoc @type function with variable args is interpreted incorrectly (#44864)
* Fixes #44386

* Add test

* Move test from fourslash to conformance
2021-07-13 17:17:24 -07:00
Daniel Rosenwasser 0996bff509
Support syntactic diagnostics in partial mode (#44859)
* Initial work to support syntactic diagnostics in partial mode.

* Test out 'syntacticDiagnosticsSync' requests.

* Added a 'geterr' test.

* Accepted baselines.

* Remove/clean up comments.
2021-07-13 11:22:34 -07:00
caojoshua acdf62fa1e
Fix "Union types are not being narrowed down correctly in 4.3 #44401" (#44771)
* Fix "Union types are not being narrowed down correctly in 4.3 #44401"

* On undefined constraint, add the original type to constraints.
2021-07-13 11:02:18 -07:00
csigs f453a28ed0
LEGO: Merge pull request 45000
LEGO: Merge pull request 45000
2021-07-12 22:13:14 -07:00
Wesley Wigham 8e855d140b
Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
csigs 0746f70fe5
LEGO: Merge pull request 44989
LEGO: Merge pull request 44989
2021-07-12 10:14:10 -07:00
csigs 3c604f1c0a
LEGO: Merge pull request 44987
LEGO: Merge pull request 44987
2021-07-12 04:13:35 -07:00
csigs ed6007d316
LEGO: Merge pull request 44982
LEGO: Merge pull request 44982
2021-07-11 22:18:01 -07:00
csigs bcb1911abd
LEGO: Merge pull request 44979
LEGO: Merge pull request 44979
2021-07-11 16:18:31 -07:00
csigs db561931a7
LEGO: Merge pull request 44977
LEGO: Merge pull request 44977
2021-07-11 10:13:09 -07:00
Ron Buckton 66c3063b06
Add collision check for 'Reflect' when using super in static initializers (#44876)
* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
2021-07-10 12:48:54 -07:00
Oleksandr T a15030ff6f
fix(35050): Decorator emit incorrect within try block (#41951)
* fix(35050): fix decorated block-scoped class emit

* Only use internal name when targeting ES5/3

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-07-08 10:48:02 -07:00
Andrew Branch e881a69939
Detect circularities printing recursive conditional types (#43733) 2021-07-08 09:19:58 -07:00
Ron Buckton 8590f0db40
Fix decorator emit regression for static fields (#44933) 2021-07-07 16:58:36 -07:00
Oleksandr T c0821aeacd
fix(44926): change noImplicitOverride description (#44929) 2021-07-07 18:43:44 +01:00
Andrew Casey 4d5978d1db
Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject (#44836)
* Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject

* Reuse previously computed values and refine comments

* Add baselines for test matrix
2021-07-06 15:22:48 -07:00
Eli Barzilay bb7de99e5a Improve "Convert to template string" with template-strings
Fixes #44396
2021-07-06 18:14:58 -04:00
Anders Hejlsberg 8e01a86c01
Consistently ignore attributes with hyphenated names in JSX (#44873)
* Consistently skip attributes with hyphenated names in JSX

* Add regression test

* Accept new baselines

* Fix tests

* Accept new baselines
2021-07-06 10:29:51 -10:00
Andrew Branch 1da18c60d6
Refactor export map cache to not store transient symbols (#44816)
* Add some failing tests around transient symbols

* Working, but slower

* A class is much faster, apparently

* This is probably best?

* Back to multimap

* Go back to single symbol cache

* Revert now-unnecessary generics

* Rename and reorganize

* Fix weird compound condition

* Clean up
2021-07-06 11:04:59 -06:00
Oleksandr T fc5c765f81
fix(44868): handle import type in shorthand assignment (#44881) 2021-07-06 09:29:09 -06:00
Ron Buckton 069650f602
Change PerformanceObserver to be compatible with new Node types (#44884) 2021-07-03 21:26:56 -07:00
Ron Buckton 09406524b3
Add evaluation tests for class static initializers (#44878) 2021-07-03 18:30:42 -07:00
Ron Buckton 8b496ed34c
Fix class name reference in class expr (#44877) 2021-07-02 18:37:23 -07:00
Daniel Rosenwasser 248b2c3fc1
Further optional delete corrections (#44862)
* Add more tests.

* Accepted baselines.

* Switch to testing the symbol's flags.

* Accepted baselines.
2021-07-01 18:44:22 -07:00
Daniel Rosenwasser e3d6189e3a
Correctly check for 'delete' on optional properties in 'exactOptionalPropertyTypes'. (#44854)
* Check for optionality in 'delete'.

* Accepted baselines.
2021-07-01 15:19:11 -07:00
Daniel Rosenwasser 9d443b76aa
Update LKG to enable improved narrowing in 4.4. (#44842)
* Update LKG.

* Remove unnecessary assertions.
2021-07-01 12:21:27 -07:00
Oleksandr T e402c1d464
feat(44799): allow auto import codefix for shorthand property assignment (#44827) 2021-06-30 16:09:42 -05:00
Zzzen 813ddf7909
ensure export modifier is used before default modifier (#44570)
* ensure export modifier is used before default modifier

* gracefully handle `default function`

* Revert "gracefully handle `default function`"

This reverts commit 1d8e288754.

* give better error message on default without leading export
2021-06-30 09:43:14 -07:00
Oleksandr T 5c8d76347c
fix(44448): disallow 'delete' operator for optional properties (#44612) 2021-06-29 16:56:45 -07:00
Anders Hejlsberg 4c19873b64
Validate symbol-named properties against symbol index signatures (#44815)
* Validate symbols against both symbol and string index signatures

* Add tests

* Accept new baselines
2021-06-29 11:53:07 -10:00
Oleksandr T 114f68cd3d
fix(44725): handle this parameter in tagged template call (#44734) 2021-06-29 14:11:35 -07:00
Eli Barzilay f47ddbc3b0 Fix bad line number assertion in ScriptInfo.positionToLineOffset
This is the line number side of ecddf8468f (from #21924, fixing #21818).
But the code is slightly improved for both cases: instead of testing
that `leaf` is defined, check whether `lineCount` is zero, and if it is,
return `〈1,0〉` for the one-based line and zero-based column numbers.
(The requirement of `lineCount > 0` is also seen in the fact
that `lineNumberToInfo` expects a "*One*BasedLine" argument.)

I've stared at this code way too much, since I think that there is
something more fundamentally wrong here.  E.g., `EditWalker` only
`push`es to `startPath` but never pops even a `children`-less node that
is left after deleting the whole contents.  But I can't figure out the
overall structure, which is also why the test that I added is not
great (see the comment there; also, #21924 is dealing with the same
problem and didn't add a test).

Fixes #44518.
2021-06-29 14:13:44 -04:00
Anders Hejlsberg 5f8a9e5181
Fix constant reference check in CFA (#44762)
* Check entire access path is constant when narrowing by inlining

* Add tests

* Accept new baselines

* Added test cases for parameter properties.

* Accepted baselines.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-28 16:41:17 -07:00
Andrew Casey c0d5c29080
Reduce exceptions (#44710)
* Don't visit non-existent basePaths

* Stop trying to add file watchers after hitting the system limit

* Update tests
2021-06-28 15:45:35 -07:00
Oleksandr T 066796be54
feat(44736): add go-to-definition on overridden members (#44740) 2021-06-28 14:58:06 -07:00
Andrew Branch 54b913cf31
Issue unawaited promise error on symbol-less expressions (#44491)
* Issue unawaited promise error on symbol-less expressions

* Use same behavior for call expressions

* Revert "Use same behavior for call expressions"

This reverts commit 60d58132e4.
2021-06-28 12:35:58 -05:00
csigs 4890312ad8
LEGO: Merge pull request 44791
LEGO: Merge pull request 44791
2021-06-28 10:13:00 -07:00
csigs a6c914e55d
LEGO: Merge pull request 44780
LEGO: Merge pull request 44780
2021-06-27 22:13:03 -07:00
csigs 67357cdb4f
LEGO: Merge pull request 44776
LEGO: Merge pull request 44776
2021-06-27 16:13:07 -07:00
csigs 3b2bc85594
LEGO: Merge pull request 44770
LEGO: Merge pull request 44770
2021-06-27 10:13:36 -07:00
csigs 5dbb7d313c
LEGO: Merge pull request 44766
LEGO: Merge pull request 44766
2021-06-26 22:12:53 -07:00
csigs 0b3a15414b
LEGO: Merge pull request 44763
LEGO: Merge pull request 44763
2021-06-26 16:14:05 -07:00
csigs 8c8d22db0f
LEGO: Merge pull request 44757
LEGO: Merge pull request 44757
2021-06-26 10:13:11 -07:00
Nathan Shively-Sanders 1ae6b8bfb5
Forbid duplicate tests only in compiler+fourslash runner (#44752)
* Forbid duplicate tests only in compiler runner

Not in fourslash, user, docker, etc.

* Include fourslash, but exempt shims and server
2021-06-25 17:33:31 -07: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
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
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
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
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
Anders Hejlsberg 97b4063d73
Don't attach declarations to symbols in mapped types with 'as XXX' clauses (#44609)
* Don't attach declarations to symbols in mapped types with 'as XXX' clauses

* Add test (and tweak comment)

Co-authored-by: Eli Barzilay <eli@barzilay.org>
2021-06-16 16:07:33 -07:00
Zzzen 4af8333a4e
support JSDoc comments inherited for parameter properties (#44329)
* support JSDoc comments inherited for parameter properties

* Update formats

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

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-06-16 14:46:49 -07:00
Anders Hejlsberg a3eadfe905
Skip base type checks that can cause circularities (#44615)
* Don't do base type checks that can cause circularities

* Add regression tests
2021-06-16 13:36:43 -07:00
Armando Aguirre d0159a8891
Fix late bound method name assignment, added tests (#43344)
* Fix late bound method name assignment, added tests

* Refactor bindDynamicallyNamedthisPropertyAssignment

* PR comments

* Rollback allowJscheck fix
2021-06-16 12:46:00 -07:00
Song Gao 971133d5d0
New command line help developer experience. (#44157)
* refactor help CLI output.

* fix typo and omit false condition boolean output.

* fix typo

* add line break

* add --plugins option to basic option category.

* add ts icon and remove old print help function.

* better command description for --jsx.

* Fix test

* fix lint

* Improvements to the UX

* Fix tests

* fix test.

* add missing help out.

* use environemnt variable to control test case.

* fix merge issues.

* No `No Category`

* make getWidthOfTerminal optional.

* fix test

* fix review.

* fix review.

* Update baselines

Co-authored-by: Orta <git@orta.io>
2021-06-16 14:18:00 +01:00
Anders Hejlsberg 6bb1f0792b
Fixes to inference and mapped types in --strictOptionalProperties mode (#44595)
* Fix Required<T> and inference to index signatures in --strictOptionalProperties mode

* Add tests

* Accept new baselines
2021-06-15 14:16:38 -07:00
Orta Therox b74b8977d5
Update descriptions for all compiler options (#44409)
* Add new descriptions to compiler options

* Update baselines
2021-06-15 21:20:14 +01:00
Nathan Shively-Sanders e53f19f8f2
Issue "Cannot find name did-you-mean" errors as suggestions in plain JS (#44271)
* Always issue cannot find name did-you-mean error

This PR issues "cannot find ${name}, did you mean ${name}" errors for
identifiers and propery access expressions in JS files *without*
`// @ts-check` and without `// @ts-nocheck`. This brings some benefits of
Typescript's binder to all Javascript users, even those who haven't
opted into Typescript checking.

```js
export var inModule = 1
inmodule.toFixed() // errors on exports

function f() {
    var locals = 2
    locale.toFixed() // errors on locals
}
var object = {
    spaaace: 3
}
object.spaaaace // error on read
object.spaace = 2 // error on write
object.fresh = 12 // OK, no spelling correction to offer
```

To disable the errors, add `// @ts-nocheck` to the file. To get the
normal checkJs experience, add `// @ts-check`.

== Why This Works ==

In a word: precision. This change has low recall &mdash; it misses lots
of correct errors that would be nice to show &mdash; but it has high
precision: almost all the errors it shows are correct. And they come
with a suggested correction.

Here are the ingredients:

1. For unchecked JS files, the compiler suppresses all errors except
two did-you-mean name resolution errors.
2. Did-you-mean spelling correction is already tuned for high
precision/low recall, and doesn't show many bogus errors even in JS.
3. For identifiers, the error is suppressed for suggestions from global files.
These are often DOM feature detection, for example.
4. For property accesses, the error is suppressed for suggestions from
other files, for the same reason.
5. For property accesses, the error is suppressed for `this` property
accesses because the compiler doesn't understand JS constructor
functions well enough.
In particular, it doesn't understand any inheritance patterns.

== Work Remaining ==

1. Code cleanup.
2. Fix a couple of failures in existing tests.
3. Suppress errors on property access suggestions from large objects.
4. Combine (3) and (4) above to suppress errors on suggestions from other, global files.
5. A little more testing on random files to make sure that precision
is good there too.
6. Have people from the regular Code editor meeting test the code and
suggest ideas.

* all (most?) tests pass

* NOW they all pass

* add tonnes of semi-colons

* restore this.x check+add a test case

* make ts-ignore/no-check codefix work in unchecked js

* Issues errors only in the language service

* add a few more tests

* fix incorrect parentheses

* More cleanup in program.ts

* Improve readability of isExcludedJSError

* make diff in program.ts smaller via closure

* Switch unchecked JS did-you-mean to suggestion

Instead of selectively letting errors through.

* undo more missed changes

* disallow ignoring suggestions

* Issue different messages for plain JS than others

Straw text for the messages, I just changed the modals to avoid name
collisions.
2021-06-15 08:54:08 -07:00
Eli Barzilay 5be0d7156d Fix bug due to sharing of .type.members
Function extraction failed when using two identical `TypeLiteral`s ---
the problem is that the parameters' `.type.members` are shared in their
two occurences in the resulting code, and when the formatter bangs
position properties on the second, it's actually changing the first too.

* `typeToAutoImportableTypeNode`: wrap in `getSynthesizedDeepClone` to
  avoid the offeding sharing.

* `getSynthesizedDeepCloneWorker`: add optional nodes/token visitors so
  it doesn't skip cloning the above.

* A few very minor tweaks which I saw when tracing this (comment update,
  two `!`s).

Fixes #44301
2021-06-14 10:46:07 -04:00
Anders Hejlsberg 5540364c12
Correct tuple relations in --strictOptionalProperties mode (#44568)
* Fix relations for optional elements in tuples with --strictOptionalProperties

* Accept new baselines

* Add regression test

* Address CR feedback
2021-06-13 12:53:13 -07:00
Anders Hejlsberg 6a1623d413
Ensure singleton types always compare identical (#44565)
* Singleton types should compare identical + fix boolean types

* Add tests

* Accept new baselines
2021-06-13 12:51:36 -07:00
Ron Buckton a0c44b26b7
Improve __spreadArray perf, and other fixes related to SpreadElement (#44527)
* Improve __spreadArray perf, fix array packing and trailing omitted expressions

* Ensure __spreadArray is backwards-compatible

* Add signature restriction for __spreadArray

* Added reusable true/false literals
2021-06-11 16:21:55 -07:00
Andrew Casey cdd7ffdc56
Make handleDtsMayChangeOf void-returning (#44322)
* Make handleDtsMayChangeOf void-returning

Right now, it always returns false.  This seems important, since
otherwise it would stop graph traversals prematurely.  It took me a
while to figure that out though and I thought it might be clearer if it
were simply void-returning.

I've kept the behavior the same, except in
`forEachReferencingModulesOfExportOfAffectedFile`, where it seemed like
never enqueueing new references was a mistake.

* Make forEachFileAndExportsOfFile void-returning

As far as I can tell, it could only return `false`.
2021-06-11 14:52:52 -07:00
Oliver Joseph Ash 69cc9ba5e4
Init (#44206) 2021-06-10 14:12:33 -07:00
Andrew Branch 7c293c8d46
Include actual generated module specifiers in module specifier cache (#44176)
* Add cache invalidation for node_modules, config, and preferences changes

* Share watches with closed script info

* Update API baseline

* Small adjustments for fewer object allocations

* Document overloaded return value

* Update baselines

* Store isAutoImportable separately from modulePaths

* Add back missing return

* Return wrapped watcher instead of underlying one

* Make user preferences part of the cache key instead of implicitly clearing in editor services

* Fix missed merge conflict
2021-06-10 12:26:32 -05:00
Wesley Wigham 130e16d73b
Add missing JSXSpreadAttribute case to JSX completion logic (#44514) 2021-06-10 10:01:25 -07:00
Orta Therox 481c2037cc
Re-name really long file (#44413) 2021-06-10 14:18:56 +01:00
Oleksandr T 147d721136
fix(43298): copy comments on converting from arrow function to anonymous function (#44236) 2021-06-08 15:22:23 -07:00
Oleksandr T 591be7bece
feat(44263): add quick fix for misspelled override error (#44266) 2021-06-08 15:17:56 -07:00
Andrew Branch 703c1bc69d
Include type reference directives in symlink cache, wait until program is present to create it (#44259)
* Fix discovery of more pnpm symlinks

* Add some tests

* Never show pnpm paths in auto imports, even if there’s no other path

* Import statement completions can return none

* Fix tests

* Add failing test showing poor symlink cache reuse

* Fix test, fails for right reasons now

* Preserve cache built up during program creation, then fill in with program resolutions

* Remove obsolete comment

* Remove obsolete type assertion

* Revert fully filtering out ignored paths
2021-06-08 12:06:55 -05:00
Sheetal Nandi dab2ffc45a
Add SolutionBuilderHostBase.getCustomTransformers to be used when emitting. (#44489)
This allows not having to specify the transformers during normal watch scneario
Builds on top of #43984
2021-06-07 15:32:39 -07:00
Sheetal Nandi 24da242b67
Update the version in baselines (#44447) 2021-06-04 15:08:23 -07:00
Nathan Shively-Sanders 8e1bf08fa9
Fix duplicate visit of param tag comments (#44443)
Fixes #44422
2021-06-04 12:54:36 -07:00
Paul Gschwendtner b26f77a703
Do not incorrectly add line separators for non-synthetic nodes when emitting node list (#44070)
As of 3c32f6e154, a line separator is
added between nodes if the nodes are not synthetic and on separate
lines. This it push s wrong and previously only happened if the non-synthetic
nodes were on different lines but had the same parent.

Fixes #44068.
2021-06-04 09:46:23 -05:00
Kitson Kelly 4b235eca17
fix: check if sysFormatDiagnosticsHost is defined (#44344)
* fix: check if sysFormatDiagnosticsHost is defined

* improve types
2021-06-03 17:05:48 -07:00
Sheetal Nandi 9df7ecb38b
Handle strict flag when writing tsbuildinfo (#44394)
* Add test showing how setting strict is not preserved in tsbuildinfo
Test for #44305

* Handle strict flag when writing tsbuildinfo
Fixes #44305

* Apply suggestions from code review

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

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-03 16:14:58 -07:00
Oleksandr T 31f03f46f2
fix(44273): preserves 'override' modifier in JavaScript output (#44290) 2021-06-03 15:42:19 -07:00
Daniel Rosenwasser 9906092db2
Add flag to change catch variables' default types to unknown (#41013)
* Add test case for 'useUnknownInCatchVariables'.

* Add new 'useUnknownInCatchVariables' flag.

* Accepted baselines.

* Add test for catch variable explicitly typed as 'any'.

* Accepted baselines.

* Move option under 'strict'.

* Accepted baselines.

* 'useUnknownInCatchVariables' is strict in command line help.
2021-06-03 13:12:56 -07:00
Orta Therox 6baa1bec64
Improve non-ambient class and function merge error (#44352)
* Improve non-ambient class and function merge error

* Update baselines

* Update tests

Co-authored-by: Austin Cummings <austin@austincummings.com>
2021-06-03 14:08:04 +01:00
Orta Therox 9d345e7734
Rename TSConfig option categories (#42514)
* Update the category descriptions for the tsconfig options

* Gets tests green

* Whitespace change

* Drop command line options from --init

* Go back to the old re-build baseline

* Fix numbers

* Remove formatting options from --showconfig

* Dpon't show output formatting changes in showConfig

* Update baselines

* Update baselines
2021-06-03 12:21:04 +01:00
Sheetal Nandi d2516fa95b
Tsserver tests can be baselined (#44326)
* Tests to baseline tsserver instead of checking
Also ensures inferred and auto import projects have name per project service

* Log structureIsReused value

* more baselines
2021-06-02 11:22:01 -07:00
Isabel Duan 9c50cb925e
Fixes subset of bugs (three tests fixed) listed in issue #41974 (#44367)
* some fixes for 41974

* linted

* fixed todo messages for readability
2021-06-02 09:32:19 -07:00
Anders Hejlsberg 391f9ffb85
Strict optional properties (#43947)
* Introduce --strictOptionalProperties compiler switch

* Accept new baselines

* Removing missingType when printing back optional properties

* Accept new baselines

* Fix linting issue

* Use getNonMissingTypeOfSymbol in getTypeOfSymbolAtLocation

* Properly elaborate errors involving optional properties

* Accept new baselines

* Properly check optional properties in tuple types

* Accept new baselines

* Add missing tuple type check

* More permissive check of strict optional properties and index signatures

* Add tests

* Fix lint issues

* Accept new baselines
2021-06-01 14:52:16 -07:00
Wesley Wigham 09a21ce7c6
Consider inferences between mapped type templates lower priority (#44126) 2021-05-28 21:07:39 -07:00
Oleksandr T 1f4c8708c2
fix(44123): forbid convert to async for generator callbacks (#44147) 2021-05-28 14:42:09 -07:00
Anders Hejlsberg 9aa50d6475
Fix unintended 'as const' name lookup error (#44311)
* Fix logic for methods in isTypeParameterPossiblyReferenced

* Add regression tests
2021-05-27 17:23:28 -07:00
Sheetal Nandi 817e45d1c1
Dont update timestamps of output files if noEmit was specified (#44306)
* Add failing test for #44303

* Dont update timestamps of output files if noEmit was specified.
Fixes #44303
2021-05-27 17:09:30 -07:00
Wesley Wigham 7c31d97cbf
Move string trim methods from utilities to core (#44308) 2021-05-27 14:20:23 -07:00
Sheetal Nandi 8721dd06f1
Add type brands for fileId and fileIdListId (#44280) 2021-05-27 11:15:13 -07:00
Sheetal Nandi 6329a0df90
Add traces for module resolution reuse (#44282) 2021-05-27 11:14:12 -07:00
Sheetal Nandi 32323ce7fb
redirectsTarget is keyed with Path (#44278)
* redirectsTarget is keyed with Path

* sourceFileToPackageName to keyed with Path

* feedback
2021-05-26 16:50:14 -07:00
Andrew Branch b1eaf3e170
Ensure AutoImportProviderProject can share source files with main program (#44274)
* Ensure AutoImportProviderProject can share source files with main program

* Revert package-lock change

* Add back reclassified options
2021-05-26 16:47:40 -07:00
Sheetal Nandi 2ffd35de4d
More updates to program reuse with different option changes (#44276) 2021-05-26 15:57:43 -07:00
Sheetal Nandi 3442d311cf
Fix outFile check (#44277) 2021-05-26 15:57:30 -07:00
Sheetal Nandi 54fbeb511d
Use correct state when getting it from redirected program (#44275)
Eg. program can backup and restore state changing the state object and we want to release program on the correct one
This ensure program is released correctly when there are declaration emit errors during tsc --build
2021-05-26 15:31:26 -07:00
Oliver Joseph Ash 3e29397d74
fix(44249): JSX: "extract to constant" generates invalid code when using fragment syntax (#44252)
Fixes https://github.com/microsoft/TypeScript/issues/44249
2021-05-26 13:24:02 -07:00
Nathan Shively-Sanders 459bd19941
Add unqualified JSDoc member references (#44202)
* Add unqualified JSDoc member references

This allows unqualified references like:

```ts
class Zero {
 /** @param buddy Must be {@link D_HORSE} or {@link D_DOG}. */
 deploy(buddy: number) { }
 static D_HORSE = 1
 static D_DOG = 2
}
```

I surveyed @see and @link again to estimate how common this is. I found
a little over 200 uses, which is around 2%. Sorted by frequency, this
*is* the next feature on the list, along with the `module:` prefix.
So I think this is about the right point to stop adding code.

In this case, however, I liked most of the uses -- there were a lot
of deprecated functions that referenced a function just below, where it
would be wordy to qualify the name, but the reader would benefit from a
link.

Note that unqualified references do *not* work inside type or object
literals. The code I ended up with is quite complicated and I didn't
observe any uses in the wild.

Fixes #43595

* Remove type/object literal container check

Since they don't work anyway
2021-05-26 09:54:05 -07:00
Andrew Casey 3ffa245f07
Cache parsed path mapping patterns (#44078)
* Cache parsed path mapping patterns

If a project has many of them (e.g. 1800), parsing the patterns
repeatedly can take up a lot of time.

* Move cache to ConfigFileSpecs

* Inline constants

* Simplify cache access
2021-05-26 09:40:42 -07:00
Oleksandr T 4559855c64
feat(44190): check misspelled base members in override checks (#44213) 2021-05-25 21:24:28 -07:00
Sheetal Nandi b7b4856944
Refactor tsbuild watch tests (#44258) 2021-05-25 17:01:06 -07:00
Anders Hejlsberg 3938958d36
Properly remove generic types that are constrained to 'null | undefined' in getNonNullableType (#44219)
* Improve getNonNullableType function

* Add tests

* More closely match previous behavior

* Add non-strict mode test
2021-05-25 11:40:28 -07:00
Jujhar Singh 98f04e224f
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a94.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:05:27 -07:00
Zzzen 0e1df66a7c
don't duplicate function properties when emiting definitions of overload signatures (#44235) 2021-05-24 15:52:40 -07:00
Wesley Wigham fcabb5c0cc
Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -07:00
Wesley Wigham 2203228b62
Ensure static index signatures have an errorNode available (#44129)
* Ensure static index signatures have an errorNode available

* Lookup static index signature declarations in the right symbol table, stop checking prototype props
2021-05-24 14:30:59 -07:00
Nathan Shively-Sanders c4c6a83922
Add @linkcode and @linkplain tags (#44208)
* Add @linkcode and @linkplain tags

They are just like @link tags but request fixed-width and normal
presentation, respectively.

Fixes #43935

* revert JSDocComment -> JSDoc SyntaxKind rename

* update API baselines

* fix lint
2021-05-24 13:01:58 -07:00
Eli Barzilay fb5f855108 Avoid convertExport when there's a non-identifier or a bogus one
Fixes #44105
2021-05-24 14:24:36 -04:00
Andrew Casey 7954f0c947
Kick out of normalizePath if there's nothing to do (#44173)
* Kick out of normalizePath if there's nothing to do

...using `relativePathSegmentRegExp`.

Bonus: use a regex to handle "/./" to avoid splitting and joining in a
common case.

When building the compiler, for example, it looks like ~95% of arguments
to `normalizePath` do not require any normalization.

* Check normalization before and after . cleanup

* Also cleanup leading ./
2021-05-24 09:38:44 -07:00
ZYSzys eb7c1ada6f
fix: internal createSignature support undefined declaration (#44109) 2021-05-24 06:50:20 -07:00
Zzzen 756392c1f5
support QualifiedName when narrowing inside loops (#43592)
* support QualifiedName when narrowing inside loops

* add test

* narrow more qualified names

* handle `undefined` of `getFlowCacheKey `

* update comments in test
2021-05-21 10:36:54 -07:00