Commit graph

31528 commits

Author SHA1 Message Date
csigs 2df960a9ba
LEGO: Merge pull request 41884
LEGO: Merge pull request 41884
2020-12-08 16:11:00 -08:00
csigs ef07a4c061 LEGO: check in for master to temporary branch. 2020-12-09 00:10:43 +00:00
Sheetal Nandi 2eca17d7c1
Keep track of why files are in the program (#40011)
* --explainFiles currently hardcoded

* Move configFileSpecs to configFile so it can be used in program later

* Explain root file inclusion reason and explain include files in the log

* Baseline explainFiles

* Fix incorrectly reporting of file list two times in --b mode

* Fix unnecessary new lines in output represented incorretly in the baseline

* More tests

* More cleaning up

* Keep listing files in same order as list files, just add explaination

* Fix double listing of file names when the program has errors

* Make diagnostic chains for file include reason

* Add explaination for the file include to diagnostics for program

* Harness ls incorrectly adding tsconfig as the root file

* Fix incorrect use of path for calculating absolute path

* Fix the root file in fourslash

* Test project service options merge

* Add config file name to matched by include explaination

* Add test for when the file changes and program is reused completely but related file information is reattached to correct location

* Handle file preprocessing diagnostics updates when program is reused and related information location changes

* Moved types to types.ts

* Refactoring and cleanup

* More cleanup

* More refatoring

* Handle synthetic imports

* Baselines after merge
2020-12-08 16:10:05 -08:00
Matt Bierner 49d7de17d6
Adds experimental support for running TS Server in a web worker (#39656)
* Adds experimental support for running TS Server in a web worker

This change makes it possible to run a syntax old TS server in a webworker. This is will let serverless versions of VS Code web run the TypeScript extension with minimal changes.

As the diff on `server.ts` is difficult to parse, here's an overview of the changes:

- Introduce the concept of a `Runtime`. Valid values are `Node` and `Web`.
- Move calls to `require` into the functions that use these modules
- Wrap existing server logic into `startNodeServer`
- Introduce web server with `startWebServer`. This uses a `WorkerSession`
- Add a custom version of `ts.sys` for web
- Have the worker server start when it is passed an array of arguments in a message

In order to make the server logic more clear, this change also tries to reduce the reliance on closures and better group function declarations vs the server spawning logic.

**Next Steps**
I'd like someone from the TS team to help get these changes into a shippable state. This will involve:

- Adddress todo comments
- Code cleanup
- Make sure these changes do not regress node servers
- Determine if we should add a new `tsserver.web.js` file instead of having the web worker logic all live in `tsserver.js`

* Shim out directoryExists

* Add some regions

* Remove some inlined note types

Use import types instead

* Use switch case for runtime

* Review and updates

* Enable loading std library d.ts files

This implements enough of `ServerHost` that we can load the standard d.ts files using synchronous XMLHttpRequests.

I also had to patch some code in `editorServices`. I don't know if these changes are correct and need someone on the TS team to review

* Update src/tsserver/webServer.ts

* Update src/tsserver/webServer.ts

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Addressing feedback

* Allow passing in explicit executingFilePath

This is required for cases where `self.location` does not point to the directory where all the typings are stored

* Adding logging support

* Do not create auto import provider in partial semantic mode

* Handle lib files by doing path mapping instead

* TODO

* Add log message

This replaces the console based logger with a logger that post log messages back to the host. VS Code will write these messages to its output window

* Move code around so that exported functions are set on namespace

* Log response

* Map the paths back to https:
// TODO: is this really needed or can vscode take care of this
How do we handle when opening lib.d.ts as response to goto def in open files

* If files are not open dont schedule open file project ensure

* Should also check if there are no external projects before skipping scheduling
Fixes failing tests

* Revert "Map the paths back to https:"

This reverts commit 0edf650622.

* Revert "TODO"

This reverts commit 04a4fe7556.

* Revert "Should also check if there are no external projects before skipping scheduling"

This reverts commit 7e4939014a.

* Refactoring so we can test the changes out

* Feedback

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-12-08 16:09:43 -08:00
Nathan Shively-Sanders d8c8e4ff06
Loosen author tag parsing (#41820)
* Loosen author tag parsing

Also make the code more efficient and easier to read.

1. Arbitrary text, except for newline and @, is allowed for the author name.
2. Arbirtrary text, except for newline, is allowed for the email
address.
3. Newline is treated as a match for an open <

I tried to allow newlines in the author and email, but it was ambiguous
with the end of the tag.

I also got rid of the two lookaheads and unified the trailing comment
handling.

Fixes #41804

* remove hardmode test since it did not reveal anything new
2020-12-08 13:25:03 -08:00
Wesley Wigham 69143ecc5b
Reuse input nodes where possible when serializing jsdoc implements clauses (#41783)
* Reuse input nodes where possible when serializing jsdoc implements clauses

* Whitespace changes, per PR feedback
2020-12-08 12:13:37 -08:00
csigs 33e7c729b9
LEGO: Merge pull request 41878
LEGO: Merge pull request 41878
2020-12-08 10:11:01 -08:00
csigs 7fafb31ea6 LEGO: check in for master to temporary branch. 2020-12-08 18:10:41 +00:00
Anders Hejlsberg 646f5b3c4e
Preserve substitution types in check position of conditional types (#41841)
* Preserve substitution types in check types of conditional types

* Undo changes from #32093

* Add regression tests

* Accept new baselines
2020-12-07 16:38:00 -10:00
Oleksandr T 0fa41db6c6
fix(41827): allow infer parameters from method signature usage (#41836) 2020-12-07 14:00:46 -08:00
Orta Therox 71e881a7ee
Undo #39258 (isArray changes) see overview at #41808 (#41851) 2020-12-07 21:59:26 +00:00
Sheetal Nandi bfb259128b
Handle output file names descripency between tsc --b and actual program emit file path calculation (#41811)
* Baseline showing #41801 and other issues with output path calculation

* Add a way to note descripencies between clean and incremental build

* Add descripency when no rootDir is specified but project is composite

* if rootDir is specified, irrespective of whether all files belong to rootDir, the paths should be calculated from rootDir

* Fix the output file names api to use the correct common source directory

* Tests for #41780

* Spelling
2020-12-07 11:53:22 -08:00
Song Gao 37e898cfd7
import statement from "node" in js source file could produce correct declaration path. (#41816)
* fix #41800

* add test

* fix test
2020-12-07 13:54:47 +00:00
TypeScript Bot bf977ed918 Update package-lock.json 2020-12-06 06:23:16 +00:00
TypeScript Bot 350e423c5a Update package-lock.json 2020-12-05 06:23:01 +00:00
Oleksandr T 2946318df0
fix(41526): add JSDoc type annotations before parameters (#41561) 2020-12-04 16:52:12 -08:00
Andrew Branch 9ae375fcd5
Update accept-baselines-fix-lints.yaml (#41826) 2020-12-04 16:48:09 -08:00
Oleksandr T f0340005a3
fix(41295): handle deprecated callbacks (#41310) 2020-12-04 16:37:25 -08:00
Oleksandr T a5c3cb4194
Improve uncalled function checks with parenthesized expressions in condition (#41748) 2020-12-04 16:20:14 -08:00
Wesley Wigham 360958e04c
JSDoc declaration emit should reuse input nodes where possible when serializing typedefs (#41760)
* JSDoc declaration emit should reuse input nodes where possible when serializing typedefs

* Style comments
2020-12-04 13:42:35 -08:00
Armando Aguirre 3c7ac73a74
Merge pull request #41793 from Kingwl/noPropertyAccessFromIndexSignature_fix
No property access from index signature fix
2020-12-04 13:37:16 -08:00
TypeScript Bot 387b6dc3e1 Update package-lock.json 2020-12-04 06:23:01 +00:00
kingwl 870f5b613a Merge branch 'master' into noPropertyAccessFromIndexSignature_fix 2020-12-04 12:47:38 +08:00
Wenlu Wang 4f8fde38ca
Rename codeFixNoPropertyAccessFromIndexSignature4.ts to codeFixNoPropertyAccessFromIndexSignature5.ts 2020-12-04 11:18:07 +08:00
Anders Hejlsberg cd37a327a7
Fix non-homomorphic mapped type constraint issues (#41807)
* Less aggressive wildcard check, 'keyof any' constraint for 'infer T' in mapped type constraint position

* Accept new baselines

* Add regression tests
2020-12-03 16:36:45 -10:00
Armando Aguirre 143d1104ab
Merge pull request #41703 from a-tarasyuk/fix/41653
fix(41653): Enum Keys in Destructure Prevents ES6 Function Convert with --target ES5
2020-12-03 16:10:51 -08:00
Ron Buckton 324f0469c0
Merge pull request #41791 from microsoft/fix40643
Reuse temp variable scope for converted loop body
2020-12-03 13:33:09 -08:00
Andrew Branch 69bc3f3b0c
Allow type-only imports on ImportEqualsDeclarations (#41573)
* Allow type-only ImportEqualsDeclarations

* Suppress CJS-in-ESM error when type-only

* Add grammar error on import type in import alias

* Update API baselines

* Fix importsNotUsedAsValues with ImportEqualsDeclarations

* Make bad error talk words more good for Daniel. Fixes #41603

* One more error message baseline update

* Update transformer and emitter
2020-12-03 13:27:15 -08:00
Nathan Shively-Sanders 8d952cb43e
Fix insufficiently merged baselines (#41803) 2020-12-03 08:59:14 -08:00
TypeScript Bot add10ec61f Update package-lock.json 2020-12-03 06:21:40 +00:00
kingwl 501b69c61f respect quote Preference 2020-12-03 12:00:30 +08:00
kingwl 31e686b996 Fix codefix for noPropertyAccessFromIndexSignature 2020-12-03 11:51:41 +08:00
Ron Buckton 27dc177f29 Reuse temp variable scope for converted loop body 2020-12-02 18:11:45 -08:00
Jack Works 0b6c9254a8
Fix import tracker for dynamic import (#41473)
* chore: migrate findAllRefs_importType_js to baseline

* fix: reference for dynamic import

* fix: find all reference for typeof import()

* fix: test

* refactor: addIndirectUser

* refactor: isExported

* refactor: isExported

* resolve review
2020-12-02 14:46:20 -08:00
Wesley Wigham 9f9eed400c
Read the base construct signature from the static base type, not the instance base (#41767) 2020-12-02 13:30:46 -08:00
Ryan Cavanaugh 9a957e7b9c
Remove incorrect assert that triggers crash on completions of globalThis (#40278)
Fixes #39338
2020-12-02 11:47:32 -08:00
TypeScript Bot 3b4cacc321 Update package-lock.json 2020-12-02 06:21:49 +00:00
Armando Aguirre fd50f1e3c9
Merge pull request #41543 from a-tarasyuk/fix/41534
fix(41534): Maximum call stack error while computing document symbol file
2020-12-01 18:03:11 -08:00
Ron Buckton e012417471
Merge pull request #37283 from JoshuaKGoldberg/extends-constructor-typeerror
Added runtime TypeError for non-function, non-null __extends
2020-12-01 17:43:25 -08:00
Josh Goldberg 943b350f8d Used String on base class per suggestion 2020-12-01 19:03:49 -05:00
Josh Goldberg 5bc0002450 ...except for the small master merge slipups 2020-12-01 18:53:54 -05:00
Josh Goldberg f55ba77297 Merge branch 'master' 2020-12-01 18:51:46 -05:00
Wenlu Wang 55810095f4
Allow qualified name for convert namespace import (#41592) 2020-12-01 15:23:57 -08:00
Wesley Wigham 0da5a7e4ba
Add missing BinaryExpression source side cases to isMatchingReference (#41765) 2020-12-01 14:47:14 -08:00
Anders Hejlsberg 4d6947ae14
Check nested conditional types for non-distributiveness in mapped types with 'as' clauses (#41713)
* Check nested conditional types for non-distributiveness

* Rename to maybeNonDistributiveNameType

* Add regression test
2020-12-01 12:07:47 -10:00
Anders Hejlsberg 4782c74b75
Propagate wildcard types in non-homomorphic mapped types (#41622)
* Propagate wildcard types in non-homomorphic mapped types

* Add regression test

* Accept new baselines

* Accept new baselines
2020-12-01 11:57:00 -10:00
inokawa d57954345b
Fix typos (#41723) 2020-12-01 13:46:41 -08:00
Wesley Wigham 2a3f5508ec
addImplementationSuccessElaboration admits declarations with no symbol (#41758) 2020-12-01 12:19:12 -08:00
TypeScript Bot d0c28ab0c2 Update package-lock.json 2020-12-01 06:22:02 +00:00
Keen Yee Liau cf4df4e472
fix(41736): tsserver should not crash if external file does not exist (#41737)
If a file does not exist, `projectService.getOrCreateScriptInfoNotOpenedByClient()`
will return `undefined`, but tsserver does not handle this case.

Fix https://github.com/microsoft/TypeScript/issues/41736
2020-11-30 16:37:40 -08:00