Commit Graph
29936 Commits
Author SHA1 Message Date
Sheetal Nandi 6bd68a83b4 Release the documents from language service using key instead of calculating it on the spot since we want to use correct paths for the files (#37596)
Fixes #37500
2020-03-25 15:51:07 -07:00
Ron Buckton b58a29b808 Fix emit for optional chain with non-null assertion (#36539)
* Fix emit for optional chain with non-null assertion

* Treat '!' differently inside chain vs end of chain

* remove dead code and fix comment
2020-03-25 15:28:13 -07:00
Andrew Branch a04225dbec Don’t suppress completions after yield (#37609) 2020-03-25 15:27:47 -07:00
Wesley Wigham 4567fc4f1a Ensure computed property names are always checked (#37307) 2020-03-25 15:16:54 -07:00
Sheetal Nandi 6c1e8aa0ad Sort the arrays of fileNames in the build info (#37541)
* Sort the arrays of fileNames in the build info
Earlier we did this in testing to ensure we could baseline now moved to actual build info writing
Fixes #37156

* Sort using compareStringsCaseSensitive
2020-03-25 14:57:46 -07:00
Andrew Casey e1772fa40e Add test for #35011 (#37312)
* Add test for #35011

When searching for a default configured project, stop at
`node_modules`.

* Be more explicit about inferred projects

* Move test into tsserver/projects.ts

* Use existing helpers to simplify tests
2020-03-25 14:48:54 -07:00
RustinandDaniel Rosenwasser 8615eecfc1 Enhancement new expression with type arguments without parenthesized argument list error message (#37576)
* Enhancement new expression with type arguments without parenthesized argument list error message

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* add baselines

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* use parseErrorAt

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* refine code

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

* Space before paren

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-03-25 12:37:46 -07:00
Sheetal Nandi b7b2c333a9 Handle if reading tsconfig file fails (#37563)
Fixes #36862
2020-03-25 10:14:31 -07:00
Nathan Shively-Sanders a1c8608f68 Revert cloneNode overrides in the DOM (#37568)
* Revert cloneNode overrides in the DOM

See microsoft/TSJS-lib-generator#842

* update baselines
2020-03-24 17:56:27 -07:00
Andrew Branch 37569d01f6 Convert to async function: handle type arguments to then/catch (#37463)
* Handle type arguments to then/catch

* Keep single-line types on a single line
2020-03-24 09:56:47 -07:00
Sheetal Nandi 9f296ce96d Do not include global errors in semantic errors from the file (#37545)
Fixes #37084
2020-03-24 09:53:27 -07:00
csigs 7ade67da09 LEGO: Merge pull request 37553
LEGO: Merge pull request 37553
2020-03-24 09:11:09 -07:00
csigs f55cb455ba LEGO: check in for master to temporary branch. 2020-03-24 16:10:28 +00:00
Sheetal Nandi 11043b0951 Check JSDocPropetyTag (#37544)
Fixes #37040
2020-03-23 17:20:35 -07:00
Jack WorksandOrta Therox 38e717a244 fix: hyphened name not auto-completed by the ls (#37455)
* fix: hyphened name not auto-completed by the ls

* fix: accept new baseline

* Adds a test to validate the hypened identifiers in JSX

Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-03-23 17:08:44 -04:00
Sheetal Nandi 221a2aeb1b Handle import type and export type in preprocess (#37508)
Fixes #37338
2020-03-23 10:11:01 -07:00
csigs 5fa066f6a6 LEGO: Merge pull request 37517
LEGO: Merge pull request 37517
2020-03-22 09:11:05 -07:00
csigs fa32f40a9d LEGO: check in for master to temporary branch. 2020-03-22 16:10:26 +00:00
Orta fbd83b848c Bring over last 3.9 dom changes (#37502)
* Bring over last 3.9 dom changes

* Addresses feedback
2020-03-20 17:17:27 -07:00
Anders Hejlsberg fde9c7f555 Narrowing from truthy unknown to object (#37507)
* For x && typeof x === 'object', narrow x to just type object

* Add tests

* Allow arbitrary nesting / add comments

* Add additional tests
2020-03-20 17:09:24 -07:00
Ron BucktonandExE Boss e3ec7b18b8 Add the 'awaited' type operator (#35998)
* Add the 'awaited' type operator

* Add script to manually add reviewers to a PR when GH 'Suggested Reviewers' breaks

* Fix lint error in review script

* Only defer generic awaited type for possible thenable

* Add variance-like behavior for awaited

* Switch awaited type params to 'unreliable' variance

* fix typo in inferTypes

* LKG without syntax in lib

* LKG with new syntax in lib

* Add 'strictAwaitedTypes' flag

* Treat strictAwaitedTypes as strict-mode flag

* Rename TAll, remove duplicate definition of 'race'

* Apply suggestions from code review

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Fix inference priority

* Update comment to isGenericAwaitableType

* Add overloads for then/catch to Promise

* Add inference heuristic for T | PromiseLike<T> (for any PromiseLike)

* Remove strictAwaitedTypes flag

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
2020-03-20 16:09:01 -07:00
TypeScript Botandtypescript-bot 114fe4deab Update user baselines (#37354)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2020-03-20 10:28:12 -07:00
Sheetal Nandi 8f64d667f2 If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape (#37483)
* Add test that calling getAffectedFiles on two different files (even if the second one is saved) returns all files

* If emitting declaration file, update the d.ts signature in state to not have to save all files when different file changes without changing its shape
Fixes #30508
2020-03-20 10:16:41 -07:00
Sheetal Nandi 5e9c43607f Handle auto import scenarios when using project references (#37482)
* Add test for project reference and auto import
Test for #34677

* Add project reference redirect to the possible file name to import if file is source of project reference redirect
Fixes the auto import suggestion when project is built

* Use fileExists that mimics presence of project reference redirect file when trying to get auto import file name
2020-03-19 16:53:44 -07:00
Eli Barzilay ec95c27b4d Fix getSignatureOfTypeTag (#37473)
Prevents infinite looping as in #37265.

Fixes #37265
2020-03-19 19:02:39 -04:00
Andrew Branch 292d01880f Add code fix for importsNotUsedAsValues error (#37468) 2020-03-19 13:13:15 -08:00
Anders Hejlsberg e15a9fb3a8 Track tuple type recursion in inferFromObjectTypes (#37479)
* Track recursive tuple types in inferFromObjectTypes

* Add regression test
2020-03-19 14:05:33 -07:00
Sheetal Nandi 7e07a2b5d1 Allow rich response for compile on save (#37462)
Fixes #30739
2020-03-19 14:03:21 -07:00
Wesley Wigham c513a4adea Allow nested conditionals to be related via constraints (#37208)
* Allow nested conditionals to be related via constraints

* Delete word in comment
2020-03-19 12:03:50 -07:00
Allan GuwatuddeandDaniel Rosenwasser a83ce339c9 Fix poor error span for unclosed JSX tags in the presence of whitespace/comments (#37419)
* Improve jsx tag error span

* Move solution to parseJsxChild func

* Add tests and update baselines

* Update comment in src/compiler/parser.ts

Co-Authored-By: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Use skipTrivia to check for whitespaces and other trivia

* Import React into  errorSpanForUnclosedJsxTag.tsx

* .

* .

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-03-19 11:40:43 -07:00
Wesley Wigham e2156a1535 Add huge maximal length for noTruncation mode (#37461) 2020-03-19 10:45:00 -07:00
Andrew Branch 237ea526f9 Preserve newlines from original source when printing nodes from TextChanges (#36688)
* Allow emitter to write multiple newlines in node lists

* Progress

* Progress

* Fix recomputeIndentation

* Add tests, fix leading line terminator count

* Do a bit less work when `preserveNewlines` is off

* Fix accidental find/replace rename

* Restore some monomorphism

* Fix single line writer

* Fix other writers

* Revert "Fix other writers"

This reverts commit 21b0cb8f3b.

* Revert "Fix single line writer"

This reverts commit e535e279f9.

* Revert "Restore some monomorphism"

This reverts commit e3ef42743a.

* Add equal position optimization to getLinesBetweenRangeEndAndRangeStart

* Add one more test

* Actually save the test file

* Rename preserveNewlines to preserveSourceNewlines

* Make ignoreSourceNewlines internal

* Optimize lines-between functions

* Add comment;

* Fix trailing line terminator count bug for function parameters

* Preserve newlines around parenthesized expressions

* Back to speculative microoptimizations, yay

* Don’t call getEffectiveLines during tsc emit at all
2020-03-19 09:46:00 -07:00
Wesley Wigham 667f3b411e Allow assertion signatures to narrow by discriminant (#37310) 2020-03-18 21:16:55 -07:00
Alexander T ac3dc0c4d4 fix(37287): check appropriate context with enabled useDefineForClassFields (#37323) 2020-03-18 17:03:07 -07:00
Nathan Shively-Sanders 933c294923 Dom update 2020-03-18 (#37464)
* Copy over DOM updates from TSJS-lib-generator

* update baselines
2020-03-18 16:08:19 -07:00
Nathan Shively-Sanders 062104d9d5 Simplify return type of Object.fromEntries (#37457)
PropertyKey is accurate but not usable.

Fixes #31393
2020-03-18 14:35:19 -07:00
Sheetal Nandi 2df421b067 Always generate configFileDiag if file is going to be added to configured project (#37443)
Fixes #30623
2020-03-18 10:39:25 -07:00
Alexander T 0aa2e2783c feat(37409): add fix all quick fix to fixInvalidJsxCharacters (#37436) 2020-03-18 09:54:17 -07:00
csigs f8083d2917 LEGO: Merge pull request 37446
LEGO: Merge pull request 37446
2020-03-17 21:11:08 -07:00
csigs 5fd5690e14 LEGO: check in for master to temporary branch. 2020-03-18 04:10:28 +00:00
Anders Hejlsberg 0222211acb Support for/of variables in assertion checking (#37432)
* Support for/of variables in assertion checking

* Integrate with "dotted name" logic

* Add tests
2020-03-17 19:20:56 -07:00
Alexander T c8e43d878f fix(37194): fix crash on go to the definition in variable assignment (#37253) 2020-03-17 16:16:28 -07:00
David SherretandNathan Shively-Sanders 48e1745d6d Fix Node#getStart(sourceFile, true) throwing when node has a js doc and no parent (#37439)
* Fix missing source file argument.

* Add test

* fix lint

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 16:08:57 -07:00
Jack Williams c600aa7411 Fix #33732 (#36077)
* Fix #33732

* Remove code change but keep test
2020-03-17 14:58:52 -07:00
Alexander T 66aa9e77bf fix(36247): disallow 'constructor' as a parameter property name (#37285) 2020-03-17 14:48:05 -07:00
Josh GoldbergandNathan Shively-Sanders 878f447798 Clarified file-not-found error for reference paths without extensions (#35956)
* Clarified file-not-found error for reference paths without extensions

* Updated error message to include extensions

* update baselines missed in merge

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 14:21:23 -07:00
Sheetal NandiandAndrew Branch e60bbac84f Fix declaration emit when the packages are included through symlinks (#37438)
* Convert symlink scenarios to virtual FS where its symlinks are correctly maintained
Adds test for #36866

* Fix the casing issue when redirects differ in casing of the file

* Make ModuleSpecifierResolutionHost internal

* Refactoring for ModuleSpecifierResolutionHost

* If any of the file path option is from node_modules folder, consider only paths in node_modules folder

* Update src/services/utilities.ts

Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-03-17 13:21:40 -07:00
Alexander T a510cad873 fix(36936): fix crash caused by resolving non existent export (#37077) 2020-03-17 13:21:20 -07:00
Alexander T f1eb9898fb feat(36908): add 'property overwritten by spread' error for jsx attributes. add related span for conflicting declaration in spread (#37329) 2020-03-17 13:13:38 -07:00
Andy HansonandNathan Shively-Sanders b0450aed56 Add codefix for --noImplicitThis (#27565)
* Add codefix for --noImplicitThis

* Code review

* Back to building post-merge

* Remove redundant functions + update tests

Infer-from-usage also inserts `this: any` parameters when needed, so I
removed that from fixImplicitThis.

Otherwise, fixImplicitThis has better suggestions than inferFromUsage,
so I moved inferFromUsage later in the suggestion order.

* More redundancy removal

Don't need to add `@this` anymore either since inferFromUsage will do
that.

* More baseline updates

From moving inferFromUsage down in priority I think?

* remove now-redundant ad-hoc jsdoc emit

* fix more bad merge

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 13:00:14 -07:00