Commit graph

91 commits

Author SHA1 Message Date
Ron Buckton eb3645f16b
Refactor node factory API, use node factory in parser (#35282)
* Refactor node factory API, use node factory in parser

* Move UnparsedSource nodes to factory

* Make most Node properties read-only

* Make pos/end/parent and JSDoc 'comment' read-only

* Update function/constructor-type factories

* Remove treeStateObserver

* Simplify Debug.deprecate

* Remove unused factory methods, simplify lazy factory methods

* Fix base factory used for source file updates

* Update test baseline due to merge from master

* Rename factory methods to be more consistent (#39058)
2020-06-16 16:55:03 -07:00
Sheetal Nandi 25f6232d45
Syntax only server creates inferred project with all the open files w… (#38561)
* Syntax only server creates inferred project with all the open files with noResolve and can handle semantic operations

* No Watching

* Disable tests

* Add and fix tests

* Only support selected commands

* Revert "Disable tests"

This reverts commit 90d8a966eb.

* Dont log request details for unsupported commands
2020-06-16 13:39:20 -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 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 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
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
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
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
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 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
Andrew Casey 8927aaabb5 Rewrite tests 2019-10-17 16:50:22 -07:00
Sheetal Nandi 25db0b0bf0 Merge baselining and tsc logic into one 2019-10-16 11:39:40 -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
Sheetal Nandi 827427f35b Add test for --tsbuildinfo not as absolute or relative path 2019-10-14 14:29:14 -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
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
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
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
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 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 54d9ce9247 Merge branch 'master' into referencesPrototypeSourceFile 2019-09-05 13:51:56 -07: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 4c4ddf833d Merge branch 'master' into referencesPrototypeSourceFile 2019-08-21 15:42:36 -07:00
Sheetal Nandi d9ad559042 Verify demo build 2019-08-09 13:38:24 -07:00
Ron Buckton d75740280f
Resolve module specifier relative to moduleFile.originalFileName (#32722)
* Resolve module specifier relative to moduleFile.originalFileName

* Use baseline testing for outputs

* Added skipLibCheck to test

* Switch to using vfs.formatPatch for output
2019-08-06 13:48:58 -07:00
Ron Buckton cc3db8f448 Merge branch 'Saulzi-master' 2019-08-06 10:48:47 -07:00
sisisin 33a6509751 Fixes export destructured variables reference (#32007)
* Add basic test for current behavior

* Fixes getting destructured variables references(#31922)

* Add test case that renames destructured property

* Fixes missing nested object destrucuturing variable references
2019-08-05 12:00:06 -07:00
Ron Buckton 5710f7d5ff Merge branch 'master' of https://github.com/Saulzi/TypeScript into Saulzi-master 2019-08-05 11:17:32 -07:00
Sheetal Nandi 2db8a13d81 Remove project status, watches etc when project is no longer part of build order 2019-07-29 15:33:34 -07:00
Sheetal Nandi 1ac980ec96 File move 2019-07-29 15:33:33 -07:00
Sheetal Nandi 666c4be844 Merge branch 'master' into referencesPrototypeSourceFile 2019-07-25 14:03:48 -07:00
Salisbury, Tom 395d1515ee #32458 stop ES5 __values with no Symbol.iterator getting stuck in loop 2019-07-25 12:17:22 +01:00
Ron Buckton d982014d73
Update __awaiter to be more spec compliant (#32462)
* Update __awaiter to be more spec compliant

* Add awaiter evaluation test
2019-07-22 17:23:35 -07:00
Ron Buckton 47e3fedb5d
Fix object spread runtime semantics (#32514) 2019-07-22 16:46:09 -07:00
Sheetal Nandi 824c22c460 Source of project reference behave as if those files cannot be emitted. 2019-07-09 14:52:27 -07:00
Sheetal Nandi 15b68a9396 Skip typechecking of source of project reference redirect 2019-07-03 15:39:29 -07:00
Sheetal Nandi 0e5d95feef Container only ref needs to be ignored from uptodate status
Fixes #31288
2019-06-20 16:09:35 -07:00
Andrew Branch 15daf42b2c
Merge pull request #31028 from andrewbranch/feature/smart-select
Smart Select language service API
2019-05-16 09:45:05 -07:00
Andrew Branch 12492a369e
Rename test to match 2019-04-18 16:28:12 -07:00
Andrew Branch af3d0f0248
Start smart select API 2019-04-18 16:05:05 -07:00
Sheetal Nandi d5100bb95e Merge branch 'master' into dtsSignatureChange 2019-04-17 16:36:09 -07:00
Sheetal Nandi 4a55025f20 Code review feedback 2019-04-17 16:32:33 -07:00
Sheetal Nandi 707cb93891 Write test case that baselines the incremental build result
Testcase for #30780
2019-04-16 12:50:37 -07:00
Sheetal Nandi 9f5090cec7 Test case for #30891 2019-04-16 12:33:21 -07:00