Commit graph

1209 commits

Author SHA1 Message Date
Armando Aguirre 33333e86eb Added toggleLineComment, toggleMultilineComment with jsx and tests 2020-05-22 16:46:31 -07:00
Daniel 8cf2466110 Merge remote-tracking branch 'origin/master' into literal-to-primitive-relation-reporting 2020-05-22 00:09:52 +00:00
Wesley Wigham 59d0ceef5e
Fix recently added test so it is cross-plat 2020-05-21 11:45:23 -07:00
Dmitry Makhnev dbaeed5ad8
Add d.ts for Intl.RelativeTimeFormat (#36084)
* feat(lib/es2020.intl): Add `Intl.RelativeTimeFormat` (part of #29129);

* fix(lib/es2020.intl): fix for tests and linters `Intl.RelativeTimeFormat` (part of #29129);

* feat(lib/es2020.intl): Add TSDoc for `Intl.RelativeTimeFormat` by review request https://github.com/microsoft/TypeScript/pull/36084#issuecomment-584769420;

* fix(lib/es2020.intl): Fix for tests;

Co-authored-by: Dmitry Makhnev <dmitriy.makhnev@jugru.org>
2020-05-20 11:06:28 -04:00
kingwl b59e4c51ae Merge branch 'master' into logical_assignment 2020-05-20 10:18:20 +08:00
Wesley Wigham 5f597e69b2
Support naming tuple members (#38234)
* Initial draft of named tuple members

* Show tuple labels and documentation in completions

* Swap allowed syntax to parameter-like

* Add quickfix for labeled tuple syntax mistakes

* Add refactoring to convert list of signatures to single overload

* Fix small bug in visitor verification

* Signature help for rest parameters which are unions of tuples are displayed as seperate entries now

* Expand sanity check test cases in conformance suite

* Add tests and code for preserving tuple names through spreads where possible

* More refactoring tests, some comment preservation and some fixed formatting of multiline tuples

* Handle missing parameter named in isValidDeclarationForTupleLabel

* Minor text fixes
2020-05-19 15:54:02 -07:00
Daniel Rosenwasser 46f100f8ac
Merge pull request #38500 from a-tarasyuk/bug/38485
regression(38485): Unable to specify `rawText` when programmatically creating tagged template literals
2020-05-19 14:24:25 -07:00
Andrew Branch 707e977056
Ensure formatter can always get a newline character (#38579)
* Ensure formatter can always get a newline character

* Make FormatContext.host optional since it’s not necessary if format options are all applied

* Make FormattingHost required again
2020-05-19 13:14:32 -07:00
kingwl 1d93db81cc Add logical assignment operator 2020-05-16 08:09:32 +08:00
Jesse Trinity 1a15717bc4
Fix regression organize imports duplicates comments (#38599)
* delete import comments on organize imports

* add unit test

* accept new baseline

* respond to review comment
2020-05-15 14:25:11 -07:00
Sheetal Nandi 5d6a5d04ea
Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) (#38429)
Fixes #38366
2020-05-12 10:16:59 -07:00
Alexander T ee3f2ce362 regression(38485): allow using rawText property in processing a tagged template 2020-05-12 12:30:46 +03:00
Josh Goldberg be2eb8a2e1
Allowed comment directives to be multiline (#38228)
* Allowed comment directives to be multiline

* Added tests, and perhaps fixed a test runner bug?

* I think it's going to need a consistent variable to loop over

* Used dynamically computed indexes in verifies

* Added multiline tests

* Increased flexibility for multiline comment parsing

* Undid a couple of formatting changes; removed backslashes from multiline regexp

* Added baseline tests for multiline comment skipping

Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-05-06 13:09:29 -07:00
Andrew Branch 689822c183
convertToAsyncFunction: Disable for .then with both fulfillment and rejection handlers (#38152)
* Disable convert to async for `.then` with both fulfillment and rejection handlers

* Delete baselines

* Also disable refactor for 3+ arguments
2020-04-24 09:52:18 -07:00
Daniel Rosenwasser d7e437a409
Have the ChangeTracker filter out edits that are no-ops (#38123)
* Filter out edits that are no-ops in 'organize imports'.

* Updated tests for 'organize imports'.

* Always remove no-op changes from the change tracker.

* Add a new `stringContainsAt` helper function to avoid traversing the entire file contents.

* Combine `map`/`filter` sequence into `mapDefined`.

* Fix up documentation.
2020-04-23 12:54:49 -07:00
Nathan Shively-Sanders d571a09cf8
Navto covers all projects (#38027)
* Remove needless structure/destructuring

Just pass multiple arguments! Sheesh!

* Basic working prototype

* Cleaned up version

1. Add test
2. Change protocol. navto-all only happens when filename is undefined or
missing.
3. Change location to earlier code path. This change was largely
type-guided and resulted in some duplicated code, but I think it's less
fault-prone.

* remove temp notes

* Single-project hits if projectFileName is provided

and file is not

* use original code as fallback
2020-04-21 15:20:36 -07:00
Josh Goldberg 1b3c7a28c1 This had better be the last unit test fix... 2020-04-19 21:50:17 -04:00
Josh Goldberg cb19b3d251 Again fixed up manual unit tests 2020-04-19 21:34:05 -04:00
Josh Goldberg 769a2f2cfc Eased up on some of the more aggressive reporting changes 2020-04-19 20:25:24 -04:00
Josh Goldberg af4ea605f2 Fixed a couple of tsserver unit tests 2020-04-19 17:18:02 -04:00
Andrew Branch 2187ba1f84
Fix variable name collisions (#37761) 2020-04-02 15:12:19 -07:00
Sheetal Nandi 0b38a9a2b0
Add support for extraFileExtensions on WatchCompilerHost (#37726)
To support typescript-eslint/typescript-eslint#1813
2020-04-01 11:13:21 -07:00
Sheetal Nandi 7f5994958b
Handle comment directives in incremental parsing (#37632)
* Add test case that shows failure to handle commentDirectives in incremental parsing
Testcase for #37536

* Handle comment directives in incremental parsing
Fixes #37536
2020-03-27 12:00:34 -07:00
Sheetal Nandi 0ae938b718
Report error when cannot read file (#37611)
This also consolidates helper for readFile failure
2020-03-25 21:29:02 -07:00
Sheetal Nandi fd9e602fcf
When the global file is deleted mark all files as changed (#37538)
* Add test case when the errors are not refreshed if global file is deleted
Testcase for #36728

* When the global file is deleted mark all files as changed
Fixes #36728

* Update other baselines to fix file info
2020-03-25 16:26:10 -07:00
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
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
Sheetal Nandi b7b2c333a9
Handle if reading tsconfig file fails (#37563)
Fixes #36862
2020-03-25 10:14:31 -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
Sheetal Nandi 221a2aeb1b
Handle import type and export type in preprocess (#37508)
Fixes #37338
2020-03-23 10:11:01 -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
Sheetal Nandi 7e07a2b5d1
Allow rich response for compile on save (#37462)
Fixes #30739
2020-03-19 14:03:21 -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
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
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
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
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
Andrii Dieiev c6cfd66fa8
Support template literals in preProcess (fixes #33680) (#33688) 2020-03-12 15:50:23 -07:00
Sheetal Nandi a76a16696d
Move useSourceOfProjectReferenceRedirect to program so other hosts can use it too, enabling it for WatchHost (#37370) 2020-03-12 13:11:11 -07:00
Sheetal Nandi 1f710167de
Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state (#37302)
* Make the systems for baselining default to pretty

* Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state
This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes #37269
2020-03-12 10:54:30 -07:00
Sheetal Nandi 1a9c8197ff
Optimize module resolution cache for watch and editor (#37055)
* Refactor resolveName

* Have resolutions of failed lookups as array and resolved to fileName map
2020-03-11 14:35:26 -07:00
Wenlu Wang 20625a964b
add promise.any (#33844)
* add promise.prototype.any

* add AggregateError

* Update src/lib/esnext.promise.d.ts

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

* update baseline again

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-11 08:36:00 -07:00
Sheetal Nandi e68524a8d2
Handle WatchCompilerHost without timeout methods to retrieve correct Program (#37308) 2020-03-09 16:30:52 -07:00
Sheetal Nandi 8dede43365
Reset hasChangedAutomaticTypeDirectiveNames once new program is created (#37266)
* Allow passing watch to the change as parameter

* Reset hasChangedAutomaticTypeDirectiveNames once new program is created
Also dont invoke afterProgramCreate if the program is not new
2020-03-06 18:21:16 -08:00
Ben Lichtman 631def81d5
Merge pull request #37260 from uniqueiniquity/watchFileExistsFix
Fix fileExists check for a watch program
2020-03-06 13:01:03 -08:00
Ben Lichtman a4430f7baf Update tests to be more precise 2020-03-06 12:41:00 -08:00
Nathan Shively-Sanders 458977b94b
Reinstate incorrectly removed esnext.bigint (#37233)
* Reinstate incorrectly removed esnext.bigint

From a bad merge I made in #33845

* fix esnext.bigint alias
2020-03-05 10:11:48 -08:00
Nathan Shively-Sanders 0a1af90bb6
add string.prototype.replaceAll (#33845)
* add string.prototype.replaceAll

* accept baseline

* fix bad merge in tests

* update missed baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-04 13:25:17 -08:00
Alexander T ab8adc5f95
fix(37135): handle PrivateIdentifiers in isPropertyName (#37184) 2020-03-03 10:51:50 -08:00
Wesley Wigham c6c2c4c8d5
Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar (#37093)
* Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar

* Copy hoisted identifiers so they do not create sourcemaps

* Accept updated baselines
2020-02-28 13:25:28 -08:00
Sheetal Nandi d07761fe39
Allow --composite false or --composite null on the command line (#36997)
* Add tests for specifying composite as command line option

* Allow passing --composite false on commandline

* Add test to verify tsc --composite false from command line

* Handle "undefined" as option value to be set to undefined for that option

* Support "null" as option to be converted to undefined which is normally end result from our config file as well

* Support null as option for any tsconfig only option as well, and dont support undefined

* Fix public api test case

* Validates objects instead of stringify result

* Add composite true to base source
2020-02-26 15:26:26 -08:00
Sheetal Nandi 05c9ec3f12
Remove unnecessary assert (since we allow already open file to be opened again even through openFile command - partially) from updateOpen command (#37059)
Fixes #35034
2020-02-26 15:25:51 -08:00
Sheetal Nandi e89df5ce6f
Handle getScriptVersion correctly to ensure program structure is checked correctly (#36808)
* Fix tests when there are project references but has disableSourceOfProjectReferenceRedirect

* Handle getScriptVersion correctly to ensure program structure is checked correctly
Fixes #36748

* Harness's language service host doesnt have getProjectVersion.
This means earlier we were creating fresh program everytime we did LS operation
Now we reuse same program, so quick info depends on order of quickinfo demands

* Because same program is used, it unvails a bug that if `export=` is evaluated before finding references, it cant find all definitions from the merge

* Update src/server/project.ts

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

* Make clearSourceMapperCache required

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-25 16:11:21 -08:00
Ron Buckton 177713ef45
Switch Debug.assertX functions to use asserts conditions (#36995)
* Switch Debug.assertX functions to use asserts conditions

* Replace assert functions with ts.noop when assertion level too low
2020-02-24 18:20:58 -08:00
Wesley Wigham c6cdc63b9c
sanitize yarn-node path in output (#36953)
* sanitize yarn-node path in output

* Update user baselines (#58)

Co-authored-by: Wesley Wigham <wwigham@gmail.com>

Co-authored-by: TypeScript Bot <ts_bot@rcavanaugh.com>
2020-02-21 16:38:00 -08:00
Andrew Casey cf24c4fdc0
Fix copy-paste error in navigateToItemIsEqualTo (#36912)
* Fix copy-paste error in navigateToItemIsEqualTo

It was preventing de-duping of items found in multiple projects.

* Add de-duping test
2020-02-20 17:30:50 -08:00
Jack Bates e50f0aabd2
Include stdout in test worker error messages (#35921) 2020-02-19 06:50:31 -08:00
Andrew Branch a2fe661e19
Import style punditry (#36814) 2020-02-14 15:57:30 -08:00
Andrew Branch b82d3207e8
Fix organizeImports with type-only imports (#36807) 2020-02-14 15:24:39 -08:00
Jack Bates 98492d8daf
Add --git-dir and --work-tree to user tests (#35362) 2020-02-12 15:21:29 -08:00
Jack Bates bf370659b3
Don't npm install the parent project with no args (#35359) 2020-02-12 14:19:46 -08:00
Wesley Wigham 2b64731a97
Fix getTypeAtLocation for as const to not issue a diagnostic (#36741)
* Fix getTypeAtLocation for `as const` to not issue a diagnostic

* use existing helpers for checks

* Fix lint
2020-02-12 13:43:02 -08:00
Wesley Wigham 8481bc1d98
Do not report errors when we fail to find a module symbol at an import specifier when invoked via API (#36742) 2020-02-11 14:49:11 -08:00
Sheetal Nandi 70e6f5b8a0
Handle walkThroughSnippet:/ and untitled:/ as dynamic files (#36722)
Handle walkThroughSnippet:/ and untitled:/ as dynamic files
Fixes #36681
2020-02-10 13:55:43 -08:00
Jack Bates fa3173f8f6
Either clone or pull, don't do both (#35230)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-07 10:17:44 -08:00
Alexander T 8c31700735
Enable @typescript-eslint/space-before-function-paren, @typescript-eslint/no-unused-expressions (#36569)
* use @typescript-eslint/no-unused-expressions instead of no-unused-expressions

* enable @typescript-eslint/space-before-function-paren
2020-02-04 14:43:25 -08:00
Andrew Branch 86556d6c03
Fix export * that resolves to something type-only (#36558)
* Fix `export *` that resolves to something type-only

* Add same tests but non-tsserver
2020-01-31 15:09:27 -08:00
Sheetal Nandi 80ad0de87e
Fixes to handle file names in module resolution watching and createGetCanonicalFileName (#36106)
* Add test case to verify directory casing preservation when watching

* Fix unicode file name handling when watching failed lookup locations

* Add special file name lower conversion routine and use that instead of toLowerCase
Fixes #31819 and #35559

* Remove unicode from code

* Replace toLocaleLowerCase on filenames with ts.toFileNameLowerCase

* Make the intent of using toFileNameLowerCase more clear and why we make the restriction on turkish I with dot on top of it

* Update baselines for newly added tests in master
2020-01-31 10:40:57 -08:00
Ron Buckton f24f36350b
Fixes JSX attribute escaping when parent pointers are missing (#35743)
* Fixes JSX attribute escaping when parent pointers are missing

* Fix whitespace change
2020-01-30 16:52:31 -08:00
Hye Sung Jung 8ed129771f
fix spelling errors (#36523)
* fix spelling errors

* remove changes in lib/*
2020-01-30 13:39:54 -08:00
Sheetal Nandi 4c378c09dc
Report config file parsing diagnostics correctly with tsc --b (#36520)
* Refactor the test

* Add tests for syntax errors in tsconfig not being reported

* Report config file parsing diagnostics correctly
Fixes #36515

* Fix errors in existing tests for unintended tsconfig parse errors

* Fix lint
2020-01-30 11:18:06 -08:00
Andrew Branch 2fac535158
Fix type-only imports in interface 'extends' and import=/export= (#36496)
* Handle when files get checked in different orders

* Fix interface extends clause

* Fix import= something type only from a module

* Revert apparently unnecessary addition

* Revert "Revert apparently unnecessary addition"

This reverts commit 7444b0b72e.

* Disallow `import = a.b.c` on anything with type-only imports

* Safety first

* Add test for TS Server single-file open

* Add big comment

* Extract error reporting function for import aliases

* Delete blank line

* Un-export, comment, and colocate some utils

* Combine 3 type-only marking function calls into one

* Add more export default tests
2020-01-29 15:00:17 -08:00
Sheetal Nandi 502e711235
Dont use sourcemap if it contains inlined sources (#36384)
Fixes #35014
2020-01-29 11:21:42 -08:00
Nathan Shively-Sanders c42ef575be
createPrivateIdentifier: names must start with # (#36506) 2020-01-29 10:11:30 -08:00
Alexander T 39311da27b
fix(36385): return failed exit code if tsconfig doesn't exist and there are no input files. (#36474) 2020-01-28 16:11:19 -08:00
Ben Lichtman fdf29891e2
Merge pull request #36383 from uniqueiniquity/redirectInfo
Redirect info
2020-01-28 11:51:06 -08:00
Ben Lichtman 2dd89ca57b Use deepEqual in tests for clarity 2020-01-28 11:30:23 -08:00
Wesley Wigham 08e6bc20bb
Trampolines for large binary expressions (#36248)
* WIP

* Test no longer crashes, but emit trampoline is incomplete and skips pipeline phases

* Fix lints, use non-generator trampoline in emit (still skips pipeline)

* Final version with emitBinaryExprssion work stack that is only used if possible

* Fix lints

* retarget to es2015 for testing

* Use bespoke state machine trampolines in binder and checker

* Remove now extraneous code in parser

* Adjust fixupParentReferences to use a depth first preorder traversal rather than breadth first

* Reintroduce incremental fast bail in fixupParentReferences

* Revert target to es5

* PR feedback

* Small edit for devops rebuild with updated definition

* Fix comment nits, add internally extraneous check back into transformer
2020-01-24 16:29:55 -08:00
Sheetal Nandi 096e1b12e4
Handle error reporting of files when new file is created after its opened in editor (#36271)
* If script info is not attached to the project on which wild card is invoked, update it.

* Instead of getting default project before starting error list timer, get it at that time if no project is specified
Fixes #35794

* Fix the open File watch triggered setting
2020-01-24 16:07:48 -08:00
Ben Lichtman 8c18c7683a Add tests 2020-01-24 16:02:14 -08:00
Wesley Wigham 6b64c883f1
Fix crash on missing parent pointer in binder when transpiling export as ns (#36387) 2020-01-24 13:36:05 -08:00
Ben Lichtman 703685318c Merge branch 'master' into redirectInfo 2020-01-23 14:12:01 -08:00
Ben Lichtman 09528dd6d6 Add tests 2020-01-23 14:10:37 -08:00
Klaus Meinhardt 0276e7f910 noErrorTruncation affects semantic diagnostics (#36306) 2020-01-23 11:10:05 -08:00
Klaus Meinhardt 342f4c0b54 forceConsistentCasingInFileNames affects module resolution (#36334) 2020-01-21 12:45:13 -08:00
Klaus Meinhardt 1fbe20fe75 resolveJsonModule affectsModuleResolution (#36290)
* resolveJsonModule affectsModuleResolutionFixes: #36251

* fix lint
2020-01-21 11:49:38 -08:00
Klaus Meinhardt bc1e7728df experimentalDecorators and emitDecoratorMetadata affect builder state (#36297)
* experimentalDecorators and emitDecoratorMetadata affect builder state

* better test
2020-01-21 11:28:55 -08:00
Klaus Meinhardt 2dd21a08f5 useDefineForClassFields affects emit (#36308)
* useDefineForClassFields affects emit

* fix lint
2020-01-21 11:28:04 -08:00
Yacine Hmito 4445e1147c Fix isProgramUpToDate when changing rootFileNames (#36011) 2020-01-21 11:26:17 -08:00
Sheetal Nandi b2a7d42032
Handle untitled files from vscode which are of format: untitled:^Untitled-1 (#36240)
* Test for #36200

* Handle dynamic files by vscode
Fixes #36200
2020-01-16 15:38:55 -08:00
Andrew Branch 797c5362a2
Codefix: Don’t return a fixId if there’s definitely nothing else that can be fixed (#35765)
* Start fixing fixId

* Fix tests

* Add comment

* Fix unit tests, remove fixAllDescription when unavailable

* Add codeFixAllAvailable to fourslash harness
2020-01-16 10:07:37 -08:00
Andrew Casey f99072593d
Move individual duration properties into a performanceData object (#36210) 2020-01-15 16:48:00 -08:00
Klaus Meinhardt f220e62ce7 importsNotUsedAsValue affects semantic diagnostics (#36001)
* importsNotUsedAsValue affects semantic diagnostics

* add tests
2020-01-15 15:08:16 -08:00
Sheetal Nandi 76ee0214f9
Use watch invoked with node_modules/.staging as watch for refreshing complete node_modules, so that npm install is reflected correctly (#36039)
* Add test that demonstrates npm install watch behaviour some times

* Use watch invoked with `node_modules/.staging` as watch for refreshing complete node_modules, so that npm install is reflected correctly
Fixes #35966
2020-01-10 14:58:01 -08:00
Sheetal Nandi 00b21efcb0
Remove the check that if base file name starts with ^ is dynamic file name since those files can exist (#36109)
Fixes #35734
2020-01-10 10:57:44 -08:00
Andrew Casey 071819bb37
Report time spent in updateGraph (#35675)
Add a response property indicating how much of the elapsed time (from
`onMessage` to `doOutput`) was spent in `updateGraph` calls.  If there's
no `updateGraph` call, the property is undefined, to save space (with
the downside that it's harder to tell whether a given telemetry event
could have had the property).

Fixes #34774
2020-01-08 14:41:34 -08:00
Sheetal Nandi 5cc58deb57 Shorten test baseline names (#35993) 2020-01-03 16:37:04 -08:00
Andrew Branch 3b396e6124 Type-only imports and exports (#35200)
* Add type-only support for export declarations

* Use a synthetic type alias instead of binding type-only exports as a type alias

* Works for re-exports!

* isolatedModules works fine

* Diagnostic for type-only exporting a value

* Start isolated modules codefix

* Update for LKG control flow changes

* Type-only import clause parsing

* Type-only default import checking

* Type-only named imports

* Fix isolated modules error

* Filter namespaces down to type-only

* Fix class references

* Test nested namespaces

* Test circular type-only imports/exports

* Fix getTypeAtLocation for type-only import/export specifiers

* Fix type-only generic imports

* Update public APIs

* Remove unused WIP comment

* Type-only namespace imports

* Fix factory update calls

* Add grammar errors for JS usage and mixing default and named bindings

* Update updateExportDeclaration API baseline

* Fix grammar checking import clauses

* Enums, sort of

* Dedicated error for type-only enum

* Skip past type-only alias symbols in quick info

* Update error code in baseline

* WIP: convertToTypeOnlyExport

* isolatedModules codefix (single export declaration)

* isolatedModules code fix (all)

* Stop eliding non-type-only imports by default, add compiler flag

* Update to match updated diagnostic messages

* Update more baselines

* Update more tests

* Auto-import as type-only

* Add codefix for splitting type-only import with default and named bindings

* Add more services tests

* Add targeted error message for "export type T;" when T exists

* Add targeted error for "import type T = require(...)"

* Flip emit flag

* Add test for preserveUnusedImports option

* Fix flag flip on import =

* Make compiler option string-valued

* Fix merge conflicts

* Add --importsNotUsedAsValue=error

* Phrasing of messages.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2020-01-03 14:39:32 -08:00
Sheetal Nandi 18269c0fc8
Add assumeChangesOnlyAffectDirectDependencies as a option to skip checking and generating .d.ts files for files indirectly importing affected file (#35711)
* Baselining tsc --watch output

* Add noIndirectImports as a option to skip checking and generating .d.ts files for files indirectly importing affected file
Fixes #33329

* Rename option to assumeChangesOnlyAffectDirectDependencies

* Description change as per feedback
2020-01-03 13:02:45 -08:00
ExE Boss 5a342742d0 feat(lib/es2020): Add Promise.allSettled(…) (#34065)
* feat(lib/es2020): Add `Promise.allSettled(…)`

* test(lib): Update tests to account for `es2020.promise`

* fix(lib/es2020): `Promise.allSettled(…)` takes `Iterable` argument

* refactor(lib/es2020): Rename `Promise.allSettled(…)` return type

* feat(lib/es2020): Simplify `Promise.allSettled(…)` type declaration

* refactor(lib/es2020): Improve naming of `Promise.allSettled(…)` types
2020-01-03 12:58:02 -08:00
Kagami Sascha Rosylight 05a2f1b110 Support bigints in ES2020 (#33874) 2019-12-23 12:18:52 -08:00
Alexander T a4e794d872 fix file extension (#35825) 2019-12-23 11:39:50 -08:00
Ron Buckton 6c413e0bbb
Add support for Call Hierarchies in language server (#35176)
* Add support for Call Hierarchies in language server

* Use baselines for callHierarchy tests

* Clean up commented code

* Support multiple hierarchy items when an implementation can't be found

* Use optional chaining in a few places

* Use getFileAndProject
2019-12-22 13:25:09 -08:00
Kagami Sascha Rosylight deb5288e31 Add module: es2020 (#33893) 2019-12-20 16:29:49 -08:00
Sheetal Nandi 9445657184
Correctly set filesByName map when reusing program to ensure it is same as old (#35784)
It was previously not populated correctly if preserveSymlinks with useSourceOfProjectReference was true,
in that case if module was resolved to symlink and we deduced it refers to source of project reference we want to set "resolvedFileName" correctly
otherwise it results in incorrect module not found errors.
2019-12-20 07:44:35 -08:00
Sheetal Nandi ec84392f2e
Use resolvedPath consistently in the builder (#35757)
* Add baseline for #35468

* Use resolvedPath consistently in the builder
Fixes #35468
2019-12-19 10:10:17 -08:00
Sheetal Nandi 853507642a
Do not list output files that just change their modified time when using --listEmittedFiles (#35714)
* Baseline incremental scenarios for listEmittedFiles

* Do not list output file that just changes modified time stamp as emitted file
Fixes #35605
2019-12-18 10:24:59 -08:00
Sheetal Nandi 8c1900c74b
Baselining tsc --watch output just like tsc baselines for easier updates (#35710)
* Baselining tsc --watch output

* Fix lint errors
2019-12-18 10:23:58 -08:00
Sheetal Nandi f90cde4706
Fix completions when the ts installation and project are on two different windows drive (#35733)
* Fix completions when the ts installation and project are on two different windows drive
Fixes #35512

* Fix typo
2019-12-17 14:19:52 -08:00
Sheetal Nandi c3b2aea9f9
Do not write files directly from builder when noEmitOnError is true (#34832)
* Add tests for noEmitOnError

* Do not write files directly from builder when noEmitOnError is true
Fixes #34823

* make linter happy

* Instead of generating output in memory, check errors before doing the emit in case of noEmitOnError
2019-12-12 19:51:18 -08:00
Wesley Wigham fc0f67dcfd
Dedent external runner message text 2019-12-11 14:28:59 -08:00
Sheetal Nandi 236012e47b
Add watchOptions to tsconfig and allow supplying them on command line as well (#35615)
* Create different watch options in compiler options

* Thread through the new watch options

* Actually use the options passed through for watch strategy

* Support delay on updating child directory watches

* Make watchOptions separate from compilerOptions

* Support passing watch options from command line

* Handle displaying of watchOptions
2019-12-11 13:26:44 -08:00
Sheetal Nandi 4212484ae1
Open bigger set of configured projects when opening composite project for operations that operate over multiple projects like rename (#33287)
* Add isInferredProject, isConfiguredProject and isExternalProject

* Skip refreshing configured project on change of config file if its not loaded

* Open a tree of projects when doing findAllRefs or rename operations

* Fix addToSeen project key

* Refactor combineProjectsOutputWorker

* if the definition is local, no need to load and look in other projects

* Add disableSearchSolution as option to disable looking for solution

* Rename the option to disableSolutionSearching
2019-12-11 12:28:18 -08:00
Sheetal Nandi 07364595e4
Handle consistent file name during editor and tsc --watch scenarios (#34622)
* Add isInferredProject, isConfiguredProject and isExternalProject

* Add test for rename on file with case change that fails
Test for #25460

* Dont store fileName on text storage

* Store root file names in the root file map to reflect their name

* Delay open file triggering watches

* Correct the name of source file as we query it (eg. it could be same source file returned in old program with different casing on case insensitive file name)

* More tests

* Refactoring

* Cache bind And check diagnostics and always get program diagnostics from the program

* Another test

* Try to report conflicting file error on file instead of global diagnostics

* Create better tests for module resolution diagnostics check

* Fix lint errors
2019-12-10 18:25:10 -08:00
Wesley Wigham 6936ac24fd
Move executeCommandLine.ts into its own project (#35595)
* Move executeCommandLine.ts into its own project

* Remove incorrect prepend
2019-12-09 16:33:24 -08:00
Wesley Wigham a78342a160
Move most harness globals into namespaces (#35530)
* Move most harness globals into namespaces

* Remove forward declaration from `createMapShim` and move all `Map` declarations into one file

* A small pile of more changes to get the harness transforming
2019-12-06 15:20:49 -08:00
Wesley Wigham c84afa1b9e
Fix build from incomplete merge 2019-11-27 14:08:16 -08:00
Sheetal Nandi d02531f650
Fix compileOnSaveEmit when using source of project reference redirect with --out (#35335)
* Fix compileOnSaveEmit when using source of project reference redirect with --out
Fixes #35226

* Fix typo
2019-11-27 13:47:19 -08:00
Wesley Wigham c447ebc59c
Refactor: No more than 1 namespace declaration per file (#35373)
* Refactor: No more than 1 namespace declaration per file

* Simplify refs where possible
2019-11-27 13:44:31 -08:00
Sheetal Nandi 25ec62f892
Handle when output file would be in subFolder specified by outDir/declarationDir (#35366)
Fixes #35328
2019-11-27 09:36:52 -08:00
Wesley Wigham 3e329469c1
Actually use the moer complete update function in visitEachChild (#35301) 2019-11-22 14:36:22 -08:00
Wesley Wigham 614a07c7d5
Fix printing and emit for definite assignment assertions (#35095)
* Fix printing and emit for definite assignment assertions

* Make factories that handle definite assertions internal
2019-11-21 11:20:57 -08:00
Nathan Shively-Sanders 0bbeab6e61
Revert "Skip costly tests" (#35197)
* Revert "Skip costly tests"

* fix package.json format
2019-11-19 12:59:09 -08:00
Ron Buckton 6c59dc34ac
More tests for super.method call chain, improve vary-by (#35013) 2019-11-18 18:03:37 -08:00
Sheetal Nandi aa0cb889da
Support dynamic file names with project root path (#35111)
* Support dynamic file names with project root path
Fixes #35094

* Remove unexpected change
2019-11-14 15:37:00 -08:00
Orta ef0cca7d12
Adds 'did you mean' to the CLI args parser (#35063)
* Adds did you mean to the CLI args parser

* Adds test coverage for the did you mean on CLI args

* Adds did you mean to convertOptionsFromJson

* Ensure tsconfig compiler flags also get 'did you mean?'
2019-11-13 20:16:48 -05:00
Wesley Wigham 165b4bc100
More version sanitization 2019-11-07 17:14:16 -08:00
Wesley Wigham db43be130d
Fix missing semicolon 2019-11-07 14:53:12 -08:00
Wesley Wigham 07d80edb3f
Strip more timestamps and versions from docker logs to better handle the more verbose logging from office-ui-fabric 2019-11-07 14:11:33 -08:00
Sheetal Nandi 47ec514cf4
Use empty object for invalid package json contents instead of undefined (#34906)
* Use empty object for invalid package json contents instead of undefined
Fixes #34726

* Behave as if package json doesnt exist in case of invalid json in package json
2019-11-04 14:31:45 -08:00
Sheetal Nandi dbef230eb8
This handles when packages are symbol links in mono repo like scenarios to use source files instead of output d.ts from project reference (#34743)
* Fix incorrect outDir usage instead of out

* Handle symlinks of packages in mono repo like packages
Fixes #34723

* Added clarified comment
2019-10-29 10:49:14 -07:00
Martin Probst ff590b622e Fix a crash when transforming functions in modules. (#34513)
When transforming a module declaration and block, parse tree nodes
contained in the module block have their parent pointers reset due to
`shouldEmitModuleDeclaration` calling into `isInstantiatedModule`, which
needs to set parent pointers to operate.

That causes a crash when later transforming any nodes within the module,
as retrieving their source file in `getSourceFileOfNode` (via
`getOrCreateEmitNode`) fails, due to their new synthesized parent nodes
not being in a source file.

This change avoids the issue by using the parse tree node in `ts.ts` to
decide whether a module declaration should be emitted (i.e. whether the
module contains values).

This means transformers cannot add values to modules that previously did
not contain any.

Fixes #34644.
2019-10-29 08:40:49 -07:00
Sheetal Nandi f12eee2e4b
Include *.json in the root files if they are specified as root (#34676)
Fixes #33827
2019-10-25 13:48:38 -07:00
Sangmin Lee a01c8ef764 Fix typo in watchMode.ts (#34701) 2019-10-25 13:13:00 -07:00
Gorka Hernández Estomba 8e1d228a44 Update inconsistent use of the word multiline/multi-line in test cases (#34733)
The word multi-line and multiline are used interchangeably within the file. Multiline seems to be the most used spelling of the word across the TypeScript repository codebase so a few strings have been updated to keep consistency within a single file. Additionally, corrected a minor capitalization mistake.
2019-10-25 11:28:50 -07:00
Andrew Casey 7275e9ca93 Delete redundant test 2019-10-17 17:22:47 -07:00
Andrew Casey 8927aaabb5 Rewrite tests 2019-10-17 16:50:22 -07:00
Andrew Casey caf0041f8a Add listFilesOnly command-line option
Msbuild currently uses a combination of `--listFiles` and `--noEmit` to
obtain a list of files to be consumed by tsc.  However, these two flags
don't suppress type checking, the results of which msbuild will never
consume.  This new switch gives msbuild a faster way to obtain the file
list.

Note: like `--noEmit`, doesn't make sense in build mode.
2019-10-17 16:36:50 -07:00
Sheetal Nandi fde10a2494 Merge branch 'master' into rootDir 2019-10-17 12:54:26 -07:00
Sheetal Nandi 575339c2e1 Merge branch 'master' into testChanges 2019-10-17 12:26:16 -07:00
Sheetal Nandi 4055689579
Merge pull request #34487 from microsoft/skipTsBuildinfoEmit
Do not write build info if there are no files to emit
2019-10-17 12:22:25 -07:00
Sheetal Nandi 4530d3ed80 Fixed scenario names 2019-10-17 12:04:24 -07:00
Sheetal Nandi 6caa92800f Fix scenario name 2019-10-17 12:00:41 -07:00
Sheetal Nandi 5b5f88ead0 Add test with incremental program with only d.ts files 2019-10-17 11:52:22 -07:00
Sheetal Nandi f32c2eac65 Some changes to incremental tests 2019-10-17 11:46:54 -07:00
Sheetal Nandi 1531c9ec21 Fix lint rules 2019-10-16 15:42:53 -07:00
Sheetal Nandi a4044ca684 Add test for #34502 2019-10-16 14:32:18 -07:00
Sheetal Nandi 66ea16a23a Sample to baseline output 2019-10-16 14:05:07 -07:00
Sheetal Nandi e54d5cae60 outFile to baseline 2019-10-16 12:51:41 -07:00
Sheetal Nandi 5390c644c9 rootDir tests are baselined 2019-10-16 12:19:26 -07:00
Sheetal Nandi 928a4e799c resolveJsonModule as baseline test 2019-10-16 12:12:12 -07:00
Sheetal Nandi 4b13406baf transitiveReferences as baseline 2019-10-16 11:52:46 -07:00
Sheetal Nandi 25db0b0bf0 Merge baselining and tsc logic into one 2019-10-16 11:39:40 -07:00
Sheetal Nandi e3cc4f4730 missingExtendedConfig to baseline test 2019-10-16 11:39:04 -07:00
Sheetal Nandi 7c0cc4a3b9 empty files to baseline test 2019-10-16 11:37:43 -07:00
Sheetal Nandi c2eabddf5c Write ExitStatus as enumng-rootDir-is-in-the-tsconfig.js 2019-10-16 11:37:35 -07:00
Sheetal Nandi 348735a755 Demo as baseline test instead 2019-10-16 09:10:33 -07:00
Sheetal Nandi c8e6f1c2eb Convert some more tests into baselines 2019-10-16 09:10:30 -07:00
Sheetal Nandi 333436b9a8 Some changes to incremental tests 2019-10-16 09:10:22 -07:00
Sheetal Nandi aaadb17afe
Merge pull request #34495 from microsoft/forceDts
Add forceDtsEmit flag to getEmitOutput
2019-10-16 08:14:47 -07:00
Eli Barzilay 22c15a2e6e
Merge pull request #34365 from elibarzilay/fix-exit-code-on-bogus-build-file
Fix exit code on bogus build file
2019-10-15 15:09:45 -07:00
Eli Barzilay 730a52bf82 Better format for the exit code test 2019-10-15 15:35:08 -04:00
Eli Barzilay cd34808a14 Fixes missing error exit code when a bogus input file is specified
Fixes #33849.
2019-10-15 15:35:07 -04:00
Eli Barzilay f25575e5fe Typofix: ..._OutputsSkupped -> ..._OutputsSkipped 2019-10-15 15:13:11 -04:00
Sheetal Nandi 850d16e45f Add forceDtsEmit flag to getEmitOutput
Fixes #33936
2019-10-15 10:07:19 -07:00
Sheetal Nandi 758bd99879 Add test for #30457 2019-10-14 15:05:56 -07:00
Sheetal Nandi 4b10145340 Make sure commandline options are absolute paths so they dont conflict with tsbuildinfo paths
Fixes #33667
2019-10-14 14:44:47 -07:00
Sheetal Nandi 827427f35b Add test for --tsbuildinfo not as absolute or relative path 2019-10-14 14:29:14 -07:00
Sheetal Nandi 35a6426a79
Merge pull request #33647 from microsoft/defaultProject
Use correct default project for file if that project is opened at later time
2019-10-10 16:01:39 -07:00
Sheetal Nandi 144b81c67a Use correct default project for file if that project is opened at later time
Fixes #31926
2019-10-10 13:02:33 -07:00
Ron Buckton 01b3d41124
Add external mapShim/debug modules (#33712)
* Add external mapShim/debug modules

* rename test file
2019-10-07 13:31:07 -07:00
Alexander T a3da2e77f9 update eslint. fix eslint @typescript-eslint/no-unnecessary-type-assertion errors 2019-10-04 11:00:24 +03:00
Ron Buckton 526ed5284e
Ensure prepend texts are set when skipping internals (#33694) 2019-10-01 12:33:17 -07:00
Ryan Cavanaugh 6b63c1bc5c
Rename this function so it stops shadowing a local we use elsewhere (#33692) 2019-10-01 10:37:53 -07:00
Sheetal Nandi 2d96a163d1
Merge pull request #33681 from microsoft/autoTypeReference
Fix issue when types installed after watch/editor is opened for auto type reference that is for global types not being detected
2019-10-01 08:28:08 -07:00
Wenlu Wang 7c50bccec2 nullish coalescing commit (#32883)
* migrate nullish coalescing commit

* add more test case

* add branch type check test

* add more tests

* fix nullish precedence

* update public api

* add rescan question question token to fix regression

* update public api baseline

* Added tests that emit for nullish coalescing operator conforming with grammar restrictions when assertions are used.

* Fixed emit to hoist temporary variables (they previously went undeclared).
Added tests to ensure calls and property accesses are only called once.

* use not equal to null

* rename factory

* add grammar check

* fix more cases

* Fix handling of nullish coalescing oprator in expando objects.

* Fixed classifier to support ?? operator.

* update baseline

* accept baseline

* fix review

* update emitter and more testcase

* update control flow

* make linter happy

* update libs

* avoid unnecessary assert

* fix typooo

* Fixes for control-flow analysis
2019-09-30 15:33:50 -07:00
Ron Buckton fcd9334f57
Add support for Optional Chaining (#33294)
* Add support for Optional Chaining

* Add grammar error for invalid tagged template, more tests

* Prototype

* PR feedback

* Add errors for invalid assignments and a trailing '?.'

* Add additional signature help test, fix lint warnings

* Fix to insert text for completions

* Add initial control-flow analysis for optional chains

* PR Feedback and more tests

* Update to control flow

* Remove mangled smart quotes in comments

* Fix lint, PR feedback

* Updates to control flow

* Switch to FlowCondition for CFA of optional chains

* Fix ?. insertion for completions on type variables

* Accept API baseline change

* Clean up types

* improve control-flow debug output

* Revert Debug.formatControlFlowGraph helper
2019-09-30 12:33:28 -07:00
Sheetal Nandi 1a614a27d1 Fix issue when types installed after watch/editor is opened for auto type reference that is for global types not being detected
Fixes #32285
2019-09-30 09:58:33 -07:00
Sheetal Nandi b0ea83b719 Add test when file is part of non default configured project before the default one 2019-09-27 14:36:54 -07:00
Sheetal Nandi c1751dc168 More refactor 2019-09-27 14:36:54 -07:00
Sheetal Nandi f3a6ea6abe Refactor 2019-09-27 14:36:54 -07:00
Sheetal Nandi 49a52d02d3
Merge pull request #33636 from microsoft/rootReferenceRedirect
Fix the issue when file is attached to project because its a root file name but program contains instead its d.ts
2019-09-27 14:36:08 -07:00
Andrew Branch 304fcee09b
Updated: Only auto-import from package.json (#32517)
* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports

* Don’t fail when alias isn’t found

* Make some easy optimizations

* Clean up memoization when done

* Remove unnecessary semicolon

* Make getSymbolsFromOtherSourceFileExports pure

* Cache auto imports

* Revert "Cache auto imports"

This reverts commit 8ea4829587.

* Handle merged symbols through cache

* Be safer with symbol declarations, add logging

* Improve cache invalidation for imports and exports

* Check symbol presence first

* Only run cache invalidation logic if there’s something to clear

* Consolidate cache invalidation logic

* Fix reuseProgramStructure test

* Add more logging

* Only clear cache if symbols are different

* Refactor ambient module handling

* Start caching package.json stuff

* Support package.json searching in fourslash

* Move import suggestions cache to Project

* Start making more module specifier work available without having the importing file

* Going to backtrack some from here

* Get rid of dumb cache, fix node core modules stuff

* Start determining changes to a file have invalidated its own auto imports

* Move package.json related utils to utilities

* Add failing test

* Make first test pass

* Don’t filter when there’s no package.json, fix scoped package imports

* Use type acquisition as a heuristic for whether a JS project is using node core

* Make same fix in getCompletionDetails

* Fix re-exporting

* Change JS node core module heuristic to same-file utilization

* Remove unused method

* Remove other unused method

* Remove unused triple-slash ref

* Update comment

* Refactor findAlias to forEachAlias to reduce iterations

* Really fix re-exporting

* Use getModuleSpecifier instead of custom hack

* Fix offering auto imports to paths within node modules

* Rename things and make comments better

* Add another reexport test

* Inline `symbolHasBeenSeen`

* Simplify forEachAlias to findAlias

* Add note that symbols is mutated

* Symbol order doesn’t matter here

* Style nits

* Add test with nested package.jsons

* Fix and add tests for export * re-exports

* Don’t fail when alias isn’t found

* Make some easy optimizations

* Clean up memoization when done

* Remove unnecessary semicolon

* Make getSymbolsFromOtherSourceFileExports pure

* Cache auto imports

* Revert "Cache auto imports"

This reverts commit 8ea4829587.

* Handle merged symbols through cache

* Be safer with symbol declarations, add logging

* Improve cache invalidation for imports and exports

* Check symbol presence first

* Only run cache invalidation logic if there’s something to clear

* Consolidate cache invalidation logic

* Fix reuseProgramStructure test

* Add more logging

* Only clear cache if symbols are different

* Refactor ambient module handling

* Finish(?) sourceFileHasChangedOwnImportSuggestions

* Make package.json info model better

* Fix misplaced paren

* Use file structure cache for package.json detection when possible

* Revert unnecessary changes in moduleSpecifiers

* Revert more unnecessary changes

* Don’t watch package.jsons inside node_modules, fix tests

* Work around declaration emit bug

* Sync submodules?

* Delete unused type

* Add server cache tests

* Fix server fourslash editing

* Fix packageJsonInfo tests

* Add node core modules cache test and fix more fourslash

* Clean up symlink caching

* Improve logging

* Function name doesn’t make any sense anymore

* Move symlinks cache to host

* Fix markFileAsDirty from ScriptInfo

* Mark new Project members internal

* Use Path instead of fileName

* Rename AutoImportSuggestionsCache

* Improve WatchType description

* Remove entries() from packageJsonCache

* Fix path/fileName bug

* Also cache symlinks on Program for benefit of d.ts emit

* Let language service use Program’s symlink cache
2019-09-27 13:38:31 -07:00
Sheetal Nandi 1c24e27ce4 Add the test that fails with find all references 2019-09-27 09:00:29 -07:00
Wesley Wigham 61cb06ce40
Allow allowJs and declaration to be used together (#32372)
* Allow allowJs and declaration to be used together

This intorduces a new symbol-based declaration emitter - currently this
is only used for JSON and JavaScript, as the output is likely worse than
what the other declaration emitter is capable of. In addition, it is
still incomplete - it does not yet support serializaing namespaces.

* Add tests for various import/export forms, add notes on export as namespace and fix export * from

* Tests & fixes for computed names

* Add test with current @enum tag behavior

* fix declaration emit for jsdoc @enum tags

* Small adjustments to base class serialization to fix bugs in it

* Guard against type/type parameter confusion when using typeParameterToName a bit

* Integrate feedback from PR

* Fix issue with export= declarations visibility calculation and type declaration emit that impacted all forms of declaration emit

* Only make one merged getCommonJsExportEquals symbol for a symbol

* Support preserving type reference directives in js declarations

* Skip declare mdoifiers for namespace members in ambient contexts

* FAKE ALIASES AND NAMESPACES EVERYWHERE

* Dont do namespace sugar when type members contain keyword names

* Fix json source file export modifier under new output

* Such clean nested aliasing, very wow

* Fix lint

* Add visibility errors, reuse type nodes where possible

* Suppoer having correctly named import types in bundled js declaration emit & adjust binding to allow namespaces with aliases to merge when the aliases look to be type-only

* Better support for module.exports = class expression

* Fix discovered crash bug

* Allow export assigned class expressions to be reachable symbols from external declarations

* Add missing semicolon

* Support @enum tag post-merge

* preserve comments on signatures and declarations where possible

* Basic support for js classy functions

* Add example we should do better with

* Prototype assignments make things a bit wonky, but the example from the PR seems OK

* Make a ton of changes to support the new way js classes are bound

* Remove some old comments, fix import and export default names

* Fix bug in object define handling and add tests for object define property declaration emit

* Fix organization nits from PR comments

* Preserve comments from jsdoc declarations on properties and js declaration type aliases

* Merge export declarations with identical specifiers

* Remove completed TODO comment

* Split lint

* Remove now-unused function

* PR feedback

* Add some project references tests, remove some checks from project refs codepaths that are now invalid

* Update project references tests again

* Merge and update project references tests

* Rename case

* Update test to include declaration output

* Remove yet another project refernces redirect extension check

* Update comment

* Add additional import ref to test

* Add shorthand prop to test

* Fix comment text

* Extract var to temp

* Simplify function and add whitespace

* Update project refs test to use incremental edit entry

* Stylistic refactors in the symbol serializer

* Another round of PR feedback, mostly style, small bugfix with constructors, and test showing bug in export assigned class expression name shadowing

* Use x instead of index
2019-09-26 14:27:16 -07:00
Nathan Shively-Sanders 500a0df6f3
Add useDefineForClassFields flag for Set -> Define property declaration (#33509)
* Disallow property/accessor overrides

Unless the base property or accessor is abstract

* Disallow uninitialised property overrides

This causes quite a few test breaks. We'll probably want to revert many
of them by switching to the upcoming `declare x: number` syntax.

* Updates from design review + fix ancient bug

1. Don't error when overriding properties from interfaces.
2. Fix error when overriding methods with other things. This had no
tests so I assume that the code was always dead and never worked.

* Need to add a couple of errors and squash one

Will update after checking out other branch for a minute

* Everything works so far

Need to test properties initialised in constructor

* Check for constructor initialisation

* change error wording

* Improve error wording

* Add codefix to add missing 'declare'

* Always emit accessors in .d.ts files

* Allow 'declare' on any uninitialised property decl

* Undo code moves

* Let sleeping dogs lie

* Correctly set NodeFlags.Ambient

And simplify redundant parts of check.

* Remove more unneeded code

* Update baselines

* Update baselines

* Update baselines

* Ignore this-property assignments

* Fix base-in-interface check

* Do not error when base parent is interface

* Fix base interface check

* Add missed baselines

* Fix check

* Fix new errors in services

* Fix new errors in services

* Fix errors in testRunner

* Add flag and turn off errors when on

* Structure of new emit is correct, fake content

It is 'hi'.

* Basically right emit

* Fix one last unitialised property declaration

* Haha no I missed another one

* Fix whitespace back to CRLF

* Minor fix and code cleanup

* New test case

* Fix bug in isInitializedProperty

* Updates from design meeting.

1. Change flag name to useDefineForClassFields (and flip polarity).
2. Forbid ES3 + useDefineForClassFields (since there is no
defineProperty).
3. Forbid overriding an abstract property-with-initializer with an
accessor.

* Update baselines

* Object.defineProperty for methods too

Using code from Ron from his upcoming refactor of the factory functions.

* Update slow baselines

* Improve error message

* Update src/compiler/transformers/utilities.ts

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

* Add test of computed properties

* Remove done TODO
2019-09-26 13:25:05 -07:00
Sheetal Nandi 91c66a0963 Add tsc baselining test for scenario that changed. 2019-09-25 10:05:10 -07:00
Sheetal Nandi 2b7ab891ad Merge branch 'baselining' into resolution 2019-09-24 14:04:22 -07:00
Sheetal Nandi 585532d1c2 Merge branch 'master' into baselining 2019-09-24 13:26:05 -07:00
Sheetal Nandi 992c211c22
Merge pull request #32028 from microsoft/referencesPrototypeSourceFile
For editing experience, use source instead of .d.ts files from project references
2019-09-24 13:16:53 -07:00
Sheetal Nandi f24cad20e2 Update the error summary reporter to take sys as parameter 2019-09-24 12:15:37 -07:00
Sheetal Nandi bf0fc858c1 Fix after merging latest baselining branch 2019-09-24 09:55:50 -07:00
Sheetal Nandi bd7d370fc8 Merge branch 'baselining' into resolution 2019-09-24 09:53:13 -07:00
Sheetal Nandi 8c2cd888dd Make time and tick local to test case so it doesnt affect the baseline 2019-09-24 09:46:32 -07:00
Sheetal Nandi 2d62050b8f Show redirected files in --listFiles 2019-09-20 14:23:04 -07:00
Sheetal Nandi d6a3a944d7 Add test that fails to emit declarations correctly 2019-09-20 14:11:10 -07:00
Sheetal Nandi b76277092c Add test to verify tsc like command line input 2019-09-20 14:10:48 -07:00
Sheetal Nandi 4786279fb0 Expose method to baseline fs 2019-09-20 14:10:47 -07:00
Sheetal Nandi 7f004ad8df
Merge pull request #33380 from microsoft/isolatedModules
With --isolatedModules, --declaration emit is now allowed and builder handles it for incremental compilation
2019-09-19 16:20:21 -07:00
Martin Probst 6bb7e5c086 Handle parentless nodes in isParameterPropertyDeclaration
Fixes #33295.

This follows a similar pattern as in #20314 by requiring an explicit
`parent` parameter. Where possible, it uses the appopriate variable at
the call sites.

In several locations there is no context available though (e.g.
inspecting `valueDeclarations`) and we access `.parent` as the code
previously did. From a cursory inspection this seems correct, these
callpaths originate in phases where there must be a `parent` (i.e. in
checker, binder, etc).

Change-Id: I28e4726777b57237bec776e4001e9e69ac591b11
2019-09-17 13:22:30 -07:00
Andrew Casey f10e38fea7 Make extractSymbol explicitly drop JSDoc nodes
Fixes #33332
2019-09-17 10:35:11 -07:00
Wesley Wigham 038d95144d
Remove all submodules - just force clone and reset on run instead (#33425) 2019-09-13 16:14:33 -07:00
Arpad Borsos a8d04b2db9 Fix Identifiers: NaN diagnostic when having JSON SourceFiles
This makes sure that the `identifierCount` and `nodeCount` properties
are always initialized for `SourceFile` objects.
2019-09-12 21:10:38 +02:00
Sheetal Nandi 2692b2e214 Add failing test cases for isolatedModules after enabling declaration emit 2019-09-11 12:48:58 -07:00
Sheetal Nandi c0f0d9f798 Merge branch 'master' into dtsOnlyEmit 2019-09-11 12:42:48 -07:00
Sheetal Nandi b26ca160f4 Merge branch 'master' into referencesPrototypeSourceFile 2019-09-11 12:27:58 -07:00
Sheetal Nandi 8521002dff Baseline emitted files that are written even if same file contents 2019-09-09 15:44:43 -07:00
Sheetal Nandi e43d504422 Baseline tsbuild info section files from written files 2019-09-09 15:14:35 -07:00
Sheetal Nandi bfc4f7a12f Get the last output from the written files 2019-09-09 14:17:58 -07:00
Sheetal Nandi 1f149ccfd7 Use clean and written files to verify the tsbuild incremental compilation = clean build compilation 2019-09-09 14:09:54 -07:00
Sheetal Nandi 566d32b2e8 Refactor to write baseline of sourcemaps that are written 2019-09-09 13:54:59 -07:00
Sheetal Nandi 54d9ce9247 Merge branch 'master' into referencesPrototypeSourceFile 2019-09-05 13:51:56 -07:00
Alexander T f0e8518010 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-09-04 11:35:45 +03:00
Sheetal Nandi 5de0303728 Fix transpiling when options specify incremental or tsbuildinfofile
Fixes #33184
2019-09-03 13:14:50 -07:00
Alexander b1d748b644 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-31 22:12:41 +03:00
Sheetal Nandi 79bcb3d547
Handle seenEmittedFiles which was not being set when emit of a file was complete (#33145)
* Add test that fails because file is written multiple times
Reported from #33061

* Handle seenEmittedFiles which was not being set when emit of a file was complete.
It was issue only when errors are reported before emitting (which puts the files into pendingEmit that needs to check only in seenEmittedFiles)
If emit happens before semantic diagnostics query this issue is not repro, because the affected files come into play and those are being set correctly
Fixes #31398

* make baselining source map optional

* Handle emitDeclarationOnly in --build scenario

* Ensure we are using d.ts emit as signature even when --declarationMap is on (map files are emitted before d.ts)

* Move module specifiers to verifyTsBuildOutput

* implement create Hash to be default hashing plus data so we can verify it easily in baseline

* Remove failing baseline

* Accept correct baseline name
2019-08-30 16:33:44 -07:00
Sheetal Nandi 5ea4257e6e
Fix the semantic diagnostics caching in builder to handle conversion from relative to buildInfo to absolute path (#33168)
Fixes #33161
2019-08-30 15:44:51 -07:00
Alexander T f8ab00b407 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-28 10:11:38 +03:00
Andre Sutherland 5d36aab06f Added errorCount to WatchStatusReporter to detect 2 or more errors (#33082)
* Added errorCount to WatchStatusReporter discern between 0 and 2 or more errors

* Added test for ensuring WatchStatusReporter receives errorCount
2019-08-27 16:40:21 -07:00
Sheetal Nandi a469fd82b9 Should not report that files are not part of config for files that are not going to be emitted 2019-08-22 13:37:36 -07:00
Sheetal Nandi 076dde4820 Test with --out as well 2019-08-22 13:00:37 -07:00
Sheetal Nandi c6e502be7d Verify config file errors 2019-08-22 11:26:26 -07:00
Sheetal Nandi 4c4ddf833d Merge branch 'master' into referencesPrototypeSourceFile 2019-08-21 15:42:36 -07:00
Alexander T 0d941d6943 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-21 10:02:57 +03:00
Wesley Wigham 219a570a75
Fix discovery and execution of root-level tests in the parallel runner (#32980) 2019-08-20 17:18:31 -07:00
Sheetal Nandi 5ac450510a
Handle network style paths for watching (#32888)
* Refactoring

* take windows style root as test server host parameter

* Handle network style paths for watching
Fixes #32796
2019-08-20 10:52:56 -07:00
Alexander T fea9e11174 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-20 11:07:18 +03:00
Ron Buckton 1bf218291f
Fix default behavior for transpileModule when fileName not provided (#32982) 2019-08-19 18:13:39 -07:00
Alexander a7f41621fb Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-17 16:37:39 +03:00
Wesley Wigham d304049e0c
Run user test submodule update in the correct directory (#32921) 2019-08-16 14:22:21 -07:00
Alexander T b6d981aec8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-16 12:13:57 +03:00
Andrew Branch 2dd10bdfa1
Reuse unchanged ambient declarations in incremental parsing (#32849)
* Incrementally parse unchanged ambient declarations

* Re-parse modifiers and decorators so as not to skip errors

* Revert unnecessary change

* Undo the test change that was changed 2 years ago
2019-08-15 10:05:21 -07:00
Alexander T f20a2828f2 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-15 10:32:45 +03:00
Sheetal Nandi 31a26120f9
Merge pull request #32788 from microsoft/tsbuildFixes
Fixes for tsbuild scenarios
2019-08-14 09:07:24 -07:00
Alexander T b728bf4bfa Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-14 13:42:02 +03:00
Ron Buckton a74f109f95 Do not escape actual template literals on emit (#32844) 2019-08-13 15:54:35 -07:00
Sheetal Nandi 1a9198a53a PR feedback 2019-08-12 16:06:09 -07:00
Alexander b33b90b559 change const to let 2019-08-10 10:10:04 +03:00
Alexander 371c3c630e remove TODO comments 2019-08-10 10:05:13 +03:00
Alexander 23a3b340b0 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-10 09:58:25 +03:00
Andrew Casey 816e7b0567
Merge pull request #32789 from amcasey/FileNotFoundError
Correct string template
2019-08-09 15:16:23 -07:00
Andrew Casey 8c6612b31e Tweak message text 2019-08-09 14:50:24 -07:00
Andrew Casey a02735e1fb
Merge pull request #32785 from amcasey/FileNotFoundError
Include fewer paths in exception
2019-08-09 14:28:32 -07:00
Sheetal Nandi 8ac45805c0 Add error related to file not in rootDir and file not part of included root files at the references 2019-08-09 14:19:40 -07:00
Andrew Casey 6c19c13094 Use an explicit type 2019-08-09 14:04:04 -07:00
Ron Buckton 9133e7ad0e
Use defaults for transpileModule (#31563) 2019-08-09 14:04:01 -07:00
Sheetal Nandi fd515b519e Handle status and error messages for better checking 2019-08-09 13:38:25 -07:00
Sheetal Nandi 9e8fbcd7f8 Transitively upstream blocked project should not build 2019-08-09 13:38:25 -07:00