Commit graph

29955 commits

Author SHA1 Message Date
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 Sherret 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 Goldberg 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 Nandi 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 Hanson 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
Ron Buckton ec426eec8b
Add script to work around GH issue with suggested reviewers (#37422) 2020-03-17 12:10:55 -07:00
Anders Hejlsberg 9120497a33
Flatten immediately nested conditional types in the false position (#36583)
* Flatten immediately nested conditional types in the false position

* Add test

* Accept new baselines

* Handle nested distributive types with different checkType

* Allow deeply nested immediately resolving conditionals without any syntactic requirements or implementation contortions

Extract logic into function

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2020-03-16 16:40:04 -07:00
Sheetal Nandi 2458c8a016
When the imported module is through node_modules and symlink to folder that isnt node_modules (#37387)
* Add tests that fail because of symlink to non common directory node_modules

* When the imported module is through node_modules and symlink to folder that isnt node_modules
Most of the monorepo like scenarios are like this so looking at symlink to decide if file can be imported is essential
Fixes #28689
2020-03-16 11:15:39 -07:00
Anders Hejlsberg b8baf48043
Fix assignment of intersections to objects with optional properties (#37195)
* Treat intersections of only objects as a single object in relations

* Exclude intersections containing non-inferrable types

* Accept new baselines

* Update test

* Accept new baselines

* Add tests
2020-03-14 09:45:05 -07:00
csigs ad8d3d90a5
LEGO: Merge pull request 37390
LEGO: Merge pull request 37390
2020-03-13 15:11:19 -07:00
csigs fa8efcc11b LEGO: check in for master to temporary branch. 2020-03-13 22:10:43 +00:00
Klaus Meinhardt 8b6bd41ce7
getPropertiesOfUnionOrIntersectionType: handle types with index signature (#31979)
* getPropertiesOfUnionOrIntersectionType: handle types with index signature

Fixes: #31565

* fix test

* more testing

* fix typo in checker.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-13 14:30:53 -07:00
Cayman 4432178ded
Add valueOf declarations for TypedArrays (#36668) 2020-03-13 16:50:16 -04:00
Jesse Trinity 4c160683c3
Add trimTrailingWhitespace Editor Option (#36905)
* add trim trailing whitespace option

* set default trimTrailingWhiteSpace to true

* add fourslash tests

* accept new baselines

* only preserce whitespace when setting is explicitly false

* format whitespace
2020-03-13 13:42:49 -07:00
Alexander T fc30095e8b
feat(33792): add new quick fix service to handle missing call in condition (#37152) 2020-03-13 13:38:44 -07:00
Wesley Wigham 47b60ece0b
Make substitution types even if the substitution base isnt a type variable (#37348)
* Make substitution types even if the substitution base isnt a type variable

* Broaden usage of getConditionalFlowTypeOfType to _all_ type lookups

* Align comments
2020-03-13 11:02:11 -07:00
Andrew Branch db44231e38
Add outlining spans for case clauses (#37374)
* Add outlining spans for case clauses

* Update old test

* Update other test

* Update yet another of the same test
2020-03-13 10:52:27 -07:00
Sheetal Nandi ba39113ab9
Handle when default project for file is solution with file actually referenced by one of the project references (#37239)
* Add test where file from referenced project of solution belongs to inferred project instead of referenced project

* Try to find project from project references if the default config project is solution
Fixes #36708

* Add test to verify the correct collection of projects

* Handle when default config project is indirectly referenced in the solution

* Include public API tests in unittests

* Make sure default project for script info is calculated correctly

* Handle reload projects

* Ensure to load solution project tree when project is referenced by solution

* Find all refs when the file is referenced via d.ts

* Some comments per feedback

* Fix typo
2020-03-13 10:46:58 -07:00
Alexander T b41eb1bc61
feat(36249): add quick-fix action to declare a property as private which starts from underscore (#36632) 2020-03-13 10:33:56 -07:00
Orta f1cc8e4e4e
[minor] Adds some docs to the LSP interface (#36740)
* Adds some docs to the LSP dts

* Ensure that getProgramDiagnostic is included everywhere that getCompilerOptionsDiagnostic is

* Update baselines

* Apply suggestions from code review

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

* Remove the getCompilerOptionsDiagnostics -> getProgramDiagnostics change

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-03-13 13:26:39 -04:00
csigs eaeee9cc31
LEGO: Merge pull request 37377
LEGO: Merge pull request 37377
2020-03-12 21:11:07 -07:00
csigs 98e45b40d1 LEGO: check in for master to temporary branch. 2020-03-13 04:10:29 +00:00
Sheetal Nandi a7b1717dcb Fix test failure as part of #35922 2020-03-12 18:26:39 -07:00
Sheetal Nandi c1e578df7a Fix tests failure due to #36317 2020-03-12 18:23:43 -07:00
Wesley Wigham df523b30cf
Filter the type of a binding pattern to not include undefined is the pattern parent has an initializer (#37309) 2020-03-12 17:50:05 -07:00
Donald Pipowitch e0f6ecd957
improve error message TS2307 (#27054)
* improve error message TS2307

* add updates missed from merge

* update more missed baselines

* remove incorrectly re-added test files

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-12 15:55:54 -07:00
Sheon Han b014e2b568
Show token hints for missing closing braces (#36317)
* Add error for missing brace in object literal

* Add new baseline test

* Update all affected tests
2020-03-12 15:52:02 -07:00
Andrii Dieiev c6cfd66fa8
Support template literals in preProcess (fixes #33680) (#33688) 2020-03-12 15:50:23 -07:00
Ryan Cavanaugh 0426e48828
Fix crash when host.getSourceFile returns undefined (#37373)
Another day, another incorrect non-null assertion

Fixes #37368
2020-03-12 15:45:56 -07:00
M.Yoshimura f06f809c75
Treat write-only-access to a class member with setter as a reference. (#35922)
* Treat write-only-access to a class member with setter as a reference.

* Add test case for unused private members, special-casing the member with a setter.
2020-03-12 15:41:40 -07:00
Jack Williams dcc73944f4
Fix 33436 (#35225)
* Fix 33436

* Fix code

* Fix error message after bad merge

* Remove whitespace
2020-03-12 15:40:14 -07:00
Ryan Cavanaugh d727d5a5eb
Remove 'path' from assert call (#37372)
Fixes #37369
2020-03-12 15:11:05 -07:00
Joey Watts 31963d54b8
Add implementation for fixExpectedComma (#33879)
Signed-off-by: Andrew Deniszczyc <adeniszczyc@bloomberg.net>

Cleanup of implementation

Move check node container check

Add test cases for fixExpectedCommaError

Renaming and add test case

Co-authored-by: Andrew Deniszczyc <adeniszczyc@bloomberg.net>
2020-03-12 14:55:02 -07:00
Sachin Grover bff0ddc941
fix(36102): fix extra new line in Organize Imports (#36911)
Organize Imports was inserting extra newline.

Fixes #36102
2020-03-12 17:51:48 -04:00
Arman 3d76c37cbe
More clear comment for String.prototype.match() (#36301)
* More clear comment for String.prototype.match()

* Removed trailing spaces
2020-03-12 14:44:07 -07:00
Klaus Meinhardt 7bd6209fbc
Don't parse duplicate JSDoc for ExpressionStatement starting with ParenthesizedExpression (#36289)
* don't parse JSDoc on ExpressionStatement if it starts with ParenthesizedExpression

* update test
2020-03-12 14:42:49 -07:00