30860 Commits

Author SHA1 Message Date
Brandon Cheng
930b81cc45
Set stackTraceLimit to 0 in fileSystemEntryExists
The exception thrown by Node.js's fs.statSync function contains a stack
trace that can be expensive to compute. Since this exception isn't used
by fileSystemEntryExists, we can safely set Error.stackTraceLimit to 0
without a change in behavior.

---

A significant performance improvement was noticed with this change while
profiling tsserver on packages within a proprietary monorepo.
Specifically, my team saw high self time percentages for Node.js's
uvException and handleErrorFromBinding internal functions. These
functions are executed within fs.statSync when it fails to find the
given path.

https://user-images.githubusercontent.com/906558/90183227-220cb800-dd81-11ea-8d61-f41f89481f46.png

fs.statSync: https://github.com/nodejs/node/blob/v14.4.0/lib/fs.js#L1030-L1037
handleErrorFromBinding: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/fs/utils.js#L254-L269
uvException: https://github.com/nodejs/node/blob/v14.4.0/lib/internal/errors.js#L390-L443

 ## Measurements

After adding Error.stackTraceLimit = 0, we saw:

- For a large configured project with 12,565 files, tsserver reached the
  projectLoadingFinish event 48.78% faster. (~46.786s vs ~31.447s)
- For a medium project with 7,064 files, tsserver was 25.75% faster.
  (~20.897s vs ~16.618s)
- For a small project with 796 files, tsserver was only a negligible
  3.00% faster. (~3.545s vs ~3.442)

Measurements were taken on macOS 10.15.6, Node.js 14.4.0, and a recent
master commit of TypeScript (610fa28d). The average of 3 runs before and
after this change were taken.

I would normally include .cpuprofile and isolate-*-*-*.log files, but
can't post them publicly in this case. If there's any other summaries
the TypeScript team would be curious about I can report them.

 ## fs.statSync Misses

Within our monorepo, the fs.statSync misses were mostly searches for
alternative file extensions of module imports.

- For node_modules imports, a lot of .ts/.tsx lookups failed until the
  .d.ts file was found.
- Within projects with a lot of JSX files, .ts files were looked for
  before finding the .tsx version.
- In the medium scale project mentioned above, a total of 38,515
  non-existent files were queried during createProgram.
2020-08-14 16:22:09 -04:00
Sheetal Nandi
c95cffe111
Ensure file, include and exclude specs used are strings (#40041)
* Test displaying failure when specs used are not strings

* Ensure specs used are strings
Fixes #38164, #39856

* Feedback
2020-08-13 17:08:20 -07:00
Zen
0ed523bb60
fix jsx completions after attributes (#39859)
closes #39530
2020-08-13 16:14:12 -07:00
Alexander T
edc88c51ca
fix(15230): change the diagnostic message about a non-module file in an --isolatedModules project (#40032) 2020-08-13 14:03:17 -07:00
Wesley Wigham
44d9ceaf14
Small branch sync script change 2020-08-13 13:17:05 -07:00
Alexander T
610fa28de5
feat(40004): make isNamedTupleMember public (#40005) 2020-08-12 20:46:40 -07:00
Sheetal Nandi
03d946d145
Revert to including only open files in partial semantic server mode (#40026) 2020-08-12 20:45:59 -07:00
Eli Barzilay
620e260576 Avoid the double-symbol trick for enums
Nameless jsdoc typedefs have their exportedness controlled by the
exportedness of the location they pull their name from.

Fixes #33575.
2020-08-12 18:40:57 -04:00
Alexander T
1f5caf554c
fix(13503): fix crash on calling getTypeAtLocation with the SourceFile nodes (#39994) 2020-08-12 00:11:25 -07:00
Nathan Shively-Sanders
d371ae770d
No this-property assignments in TS (#40009)
* No this-property assignments in TS

Even when `this` is aliased, which I mistakenly allowed in #39908.

* remove errant file
2020-08-11 15:46:49 -07:00
Wenlu Wang
57e2fe0462
Improve deprecated suggestion node position (#39702)
* Improve deprecated suggestion node position

* fix typo

* Simplify code

* merge helper function
2020-08-10 17:37:11 -07:00
Wenlu Wang
a80f60c6d6
fix export * as default syntax (#39803)
* fix export * as default syntax

* update comments
2020-08-10 16:56:45 -07:00
Nathan Shively-Sanders
1ec71f0e0c
Bind alias ThisProperty assignment declarations (#39908)
* Bind alias ThisProperty assignment declarations

This is a quick prototype that does the wrong thing at the wrong time
with the wrong technique.

* Preliminary checker handling for aliases

Duplicative and untested, but I think I updated all the places that need
updating.

* new is error; old one should not have been removed

* I don't even know what's happening with this test

* cleanup and testing in the checker

* binder: use lookupSymbolForNameWorker instead of mutable

This should have about the same behaviour and is much easier to
understand.

Also refactor common code a bit.

* Shorter name of lookupSymbolForName

Once upon a time there was a parent/worker function, but now it's just a
single function again. No need for the -Worker suffix.

* remove oodate comment

* fix switch-case-break lint

* Refactor and move functions

* Rename and improve type of getContextualTypeForAssignmentDeclaration
2020-08-10 16:45:55 -07:00
Josejulio Martínez
668bbc64ff
Export anonymous functions in 2 steps, declare as variable and then assign to exports. (#39820)
* Preserve the variable name when exporting an arrow or anonymous function
 This allows the browser or node to properly name the (arrow) function

* Updated tests to reflect previous change

* Remove duplicated comment

* Transforms variable.initializer using moduleExpressionElementVisitor

* PR feedback: rbuckton
 - Use isArrowFunction and isFunctionExpression

* PR feedback: rbuckton
- Consider ClassExpresion, they can also be named based on the
  variable.
2020-08-07 17:16:03 -07:00
Nathan Shively-Sanders
3328fdb2d8
Use isUncalledFunctionReference for aliases too (#39950)
* Use isUncalledFunctionReference for aliases too

Fixes bogus deprecated notices on imports of functions with deprecated
overloads, but with some non-deprecated overloads.

Fixes microsoft/vscode#104238

* Just check all declarations, don't call isUncalledFunction
2020-08-07 10:07:55 -07:00
Nathan Shively-Sanders
dd09e8799c
Update CI node versions (#39940)
Drop 8, add 14
2020-08-06 14:14:21 -07:00
Jesse Trinity
91a7c359b3
Insert auto imports after header comment (#39924)
* place first import after header

* don't insert before non-header
2020-08-06 13:33:29 -07:00
Ron Buckton
fca9f451d8
Add missing 'importName' for private field helpers (#39932) 2020-08-06 13:27:19 -07:00
Andrew Branch
87a3b42d72
Handle empty package.json files (#39937) 2020-08-06 11:04:21 -07:00
csigs
e9f82e4aa2
LEGO: Merge pull request 39927
LEGO: Merge pull request 39927
2020-08-05 15:12:12 -07:00
csigs
9ad3b47e60 LEGO: check in for master to temporary branch. 2020-08-05 22:11:17 +00:00
Sheetal Nandi
da5ff57608
Renames in servermode per feedback (#39883)
* Server mode renames as per feedback

* More renames
2020-08-05 12:19:15 -07:00
Andrew Branch
7f4e1b699a
Find tagless JSDoc as preceding token (#39912) 2020-08-05 10:09:45 -07:00
csigs
2ebdf9fdce
LEGO: Merge pull request 39921
LEGO: Merge pull request 39921
2020-08-05 09:11:30 -07:00
csigs
a548e4f363 LEGO: check in for master to temporary branch. 2020-08-05 16:10:40 +00:00
csigs
58438519f9
LEGO: Merge pull request 39917
LEGO: Merge pull request 39917
2020-08-05 03:11:38 -07:00
csigs
7d11da17c0 LEGO: check in for master to temporary branch. 2020-08-05 10:10:46 +00:00
Nathan Shively-Sanders
c9f05af2c8
Merge pull request #37891 from Neonit/jsDocIndentationPreservation
Fix indentation preservation in JSDoc (#37717)
2020-08-04 16:09:50 -07:00
csigs
4c7ea8ed4a
LEGO: Merge pull request 39913
LEGO: Merge pull request 39913
2020-08-04 15:12:00 -07:00
csigs
c96bad261a LEGO: check in for master to temporary branch. 2020-08-04 22:11:06 +00:00
Sheetal Nandi
bcccae2fd4
Handle the fact that noResolveResolution resolution is reused (#39889)
Fixes #39795
2020-08-04 13:33:27 -07:00
csigs
6247364181
LEGO: Merge pull request 39904
LEGO: Merge pull request 39904
2020-08-04 09:11:33 -07:00
csigs
3d9eb73db2 LEGO: check in for master to temporary branch. 2020-08-04 16:10:42 +00:00
Daniel Rosenwasser
2106b07f22
Rename and use the default ref instead of having a workflow_dispatch option 2020-08-04 00:14:24 -07:00
Daniel Rosenwasser
817dc52fd3
Add an 'Update LKG' action (#39897) 2020-08-04 00:05:24 -07:00
Daniel Rosenwasser
d985e68ffa
Bump version to 4.1. (#39894)
* Bump version to 4.1.

* Update baselines.
2020-08-03 23:38:55 -07:00
csigs
ed55e0c0d1
LEGO: Merge pull request 39896
LEGO: Merge pull request 39896
2020-08-03 21:11:30 -07:00
csigs
26d228cb18 LEGO: check in for master to temporary branch. 2020-08-04 04:10:42 +00:00
Nathan Shively-Sanders
773be796ba
Merge pull request #39892 from microsoft/make-uint8-constructor-backward-compatible
Make numeric Array constructors take ArrayLikeBuffer union
2020-08-03 16:55:17 -07:00
csigs
1ed00c86fa
LEGO: Merge pull request 39891
LEGO: Merge pull request 39891
2020-08-03 15:12:03 -07:00
csigs
dec871ba10 LEGO: check in for master to temporary branch. 2020-08-03 22:11:07 +00:00
Nathan Shively-Sanders
065b83b902 Make numeric Array constructors take ArrayLikeBuffer union
PR #38449 changed the second overload of the constructor for Int8,
Uint8, Int32, Uint32, Int16, Uint16, Float, Float64 -Array so that it no
longer includes `ArrayBufferLike`. It's just `ArrayLike<number>`.
This is fine except in the case that
the caller provides exactly `ArrayLike<number> | ArrayBufferLike`. This
PR adds ArrayBufferLike back so that the union is once again accepted.

This avoids a breaking change, in particular in one Microsoft-internal
codebase.
2020-08-03 14:56:55 -07:00
Nathan Shively-Sanders
ff2ff98ee4
Update user baselines (#39857)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2020-08-03 09:25:23 -07:00
csigs
b28a5042d0
LEGO: Merge pull request 39880
LEGO: Merge pull request 39880
2020-08-03 09:11:33 -07:00
csigs
d7fb2b608f LEGO: check in for master to temporary branch. 2020-08-03 16:10:45 +00:00
typescript-bot
c05078e52e Update user baselines 2020-08-03 04:44:41 +00:00
csigs
7e93035b66
LEGO: Merge pull request 39868
LEGO: Merge pull request 39868
2020-08-02 21:11:41 -07:00
csigs
b092fb37b1 LEGO: check in for master to temporary branch. 2020-08-03 04:10:44 +00:00
Sheetal Nandi
aee78acedb
Add separate flag serverMode for server mode (#39735)
* Add separate flag serverMode for server mode to allow back compatibility

* Addressed code review feedback.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-08-02 18:18:26 -07:00
Andrew Branch
86a87c493c
Limit auto import provider project size (#39855)
* Limit auto import provider project size

* Add test

* Make option configurable

* Fix test

* Only bail when setting is auto

* Fix other test

* Update API baseline
2020-08-02 17:47:49 -07:00