Commit graph

787 commits

Author SHA1 Message Date
Sheetal Nandi fdb104b242 Merge branch 'master' into watchImprovements 2017-09-11 13:49:36 -07:00
Sheetal Nandi de28d02626 Add test case to verify correct resolution file is picked when current resolution file is not removed but higher precedence file is created 2017-09-08 15:45:47 -07:00
Andy 2e02778960 When loading a module from node_modules, get packageId even in the loadModuleFromFile case (#18185)
* When loading a module from node_modules, get packageId even in the `loadModuleFromFile` case

* Support packageId for <reference types> too
2017-09-07 14:31:20 -07:00
Daniel Rosenwasser 448d75c08f Merge pull request #17675 from HerringtonDarkholme/master
fix #16567: better coloring on light theme terminal
2017-09-07 12:33:12 -07:00
Wesley Wigham 6695255d86 Allow trailing newline to have fake position (#18298)
* Actually support baselining pretty in the harness

* Test case from 18216

* Use host newline in formatDiagnosticsWithColorAndContext

* Merge statements
2017-09-07 12:26:23 -07:00
Sheetal Nandi 16cf7c40a8 Watch for the automatic types that included as part of type resolution 2017-08-31 09:13:59 -07:00
Sheetal Nandi 4c79033894 Refactoring to watches and caching of system such that we minimize function expressions
Also unified watcher info logging
2017-08-31 09:13:59 -07:00
Andy 4d05bfdf4a moduleAugmentations may contain an Identifier (#18009)
* `moduleAugmentations` may contain an `Identifier`

* Add comment

* Rename function
2017-08-25 15:14:51 -07:00
Andy e2141ad469 Mark some arrays as readonly (#17725)
* Mark some arrays as readonly

* Avoid unnecessary allocations and style changes

* Fix lint
2017-08-24 09:55:01 -07:00
Sheetal Nandi 8deef58fd6 Remove the unused function from the Project since builder has this logic now. 2017-08-18 12:15:03 -07:00
Sheetal Nandi 136b091a4a Update based on feedback 2017-08-14 16:34:30 -07:00
Sheetal Nandi 989508245b Updating according to feedback from PR 2017-08-14 12:52:29 -07:00
Sheetal Nandi 59d07dc488 Simplified mutate map options 2017-08-14 11:27:02 -07:00
Sheetal Nandi d0a23bb876 Merge branch 'watchImprovements' into builder 2017-08-12 15:35:30 -07:00
Andy 37b20ee670 For duplicate source files of the same package, make one redirect to the other (#16274)
* For duplicate source files of the same package, make one redirect to the other

* Add reuseProgramStructure tests

* Copy `sourceFileToPackageId` and `isSourceFileTargetOfRedirect` only if we completely reuse old structure

* Use fallthrough instead of early exit from loop

* Use a set to efficiently detect duplicate package names

* Move map setting outside of createRedirectSourceFile

* Correctly handle seenPackageNames set

* sourceFileToPackageId -> sourceFileToPackageName

* Renames

* Respond to PR comments

* Fix bug where `oldSourceFile !== newSourceFile` because oldSourceFile was a redirect

* Clean up redirectInfo

* Respond to PR comments
2017-08-09 14:39:06 -07:00
Herrington Darkholme 0255adc407 fix #16567: better coloring on light theme terminal 2017-08-08 10:12:11 +08:00
Sheetal Nandi 7474ba762c Implementation for invalidating source file containing possibly changed module resolution 2017-08-07 11:31:13 -07:00
Sheetal Nandi 46e3d1c1d9 Refactoring so that instead of just using from tsc --watch the new api is accessible all the time 2017-08-07 11:31:12 -07:00
Sheetal Nandi c814d8e847 Add tests for the tsc --watch 2017-08-07 11:24:07 -07:00
Sheetal Nandi 6237b221da Move the builder to compiler directory 2017-08-07 11:19:52 -07:00
Sheetal Nandi ef5935b52c Initial refactoring so that watch from tsc follows the tsserver projects 2017-08-07 11:19:52 -07:00
Sheetal Nandi 94a589b3bb Program cannot be reused if the missing file is now present
Also dont update filesByName array just to update missing file paths
2017-08-07 11:04:33 -07:00
Sheetal Nandi 273569f6fe Make the host cache store the fileName instead of undefined for the missing host files 2017-08-07 11:04:33 -07:00
Andy f945b26b54 Forbid type assertions in '.js' files (#17503) 2017-07-29 05:41:08 -07:00
Andy eadd084c82 Add 'name' property to Identifier (#17329)
* Add 'name' property to Identifier

* Rename to unescapedText

* Rename 'id.text' to 'id.escapedText'

* Rename 'id.unescapedText' to 'id.text'

* Make escapeIdentifier and unescapeIdentifier do nothing
2017-07-25 13:16:34 -07:00
Andy 53e4040ceb Remove duplicate emptyArrays (#17305) 2017-07-20 06:45:22 -07:00
Daniel Rosenwasser e8421827e0 Merge pull request #16600 from alexeagle/pretty2
Add missing newline in --pretty diagnostics formatter
2017-07-14 12:22:05 -07:00
Andy a0c672ac02 Add assertion that module / type reference names are defined (#17124) 2017-07-12 10:13:33 -07:00
Andy 8c3f5e2208 Remove createFileMap (#16810)
* Make `createFileMap` an internal detail of `program.ts`

* Remove createFileMap

* Clean up calls to `toPath`
2017-07-10 11:24:17 -07:00
Andy 17578e8a5d Use Map<true> for sets (#16972) 2017-07-07 10:34:36 -07:00
Wesley Wigham 4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Andrew Casey 569ecabb0a Address PR feedback
Make Program.getMissingFilePaths required

Assume getMissingFilePaths always returns a defined value

Make getMissingFilePaths internal

Replace nullable-bool with enum

Update type to reflect possibility of undefined

Use deepEqual to simplify tests

Make condition const

Don't bother cleaning up map before freeing it

Switch from foreach to for-of to simplify debugging

Use a Map, rather than a FileMap, to track open FileWatchers

Fix compilation errors

Introduce and consume arrayToSet

Fix lint warnings about misplaced braces

Delete incorrect comment

Delete from map during iteration

Eliminate unnecessary type annotations
2017-06-29 11:29:19 -07:00
Andrew Casey 4652fc491f Confirm method is defined before calling 2017-06-29 10:39:32 -07:00
Andrew Casey 4863ada22c Track missing files
1. Expose missing files from the `Program`.
2. In `tsc --watch` and `tsserver`, add file watchers to missing files.
3. When missing files are created, schedule compilation (tsc) or refresh
the containing projects (tsserver).
2017-06-29 10:39:31 -07:00
Andy 9013665e22 Replace FileMap with Map where there is no keyMapper (#16724)
* Replace FileMap with Map where there is no keyMapper

* Remove `toKey` and use `keyMapper` directly
2017-06-28 13:15:34 -07:00
Andy 9260a399a3 Remove duplicate switch cases (#16721) 2017-06-28 12:53:43 -07:00
Yui 47c1563649 Merge pull request #16544 from Microsoft/master-fixIncrementalParsingWithDynamicImport
[Master] wip - fix incremental parsing with dynamic import
2017-06-19 16:44:47 -07:00
Alex Eagle 0123bd0e20 Add missing newline in --pretty diagnostics formatter
It was compensated in tsc.ts, but then other compilers are missing a newline.
2017-06-17 09:20:55 -07:00
Sheetal Nandi 09f0b3471a Merge branch 'master' into ownJsonParsing 2017-06-15 09:59:37 -07:00
Yui T a92b549336 Set the structureReused to be safemoudles when dynamic import change 2017-06-14 21:50:12 -07:00
Yui T 1636fbc966 Wip-fix incremental parsing 2017-06-14 17:13:35 -07:00
Andy 09321b3834 Convert Extension to a string enum (#16425) 2017-06-09 19:32:44 -07:00
Daniel Rosenwasser 86e54ac787 Correct pluralization of 'Contain' to 'Contains', made the nodeflag internal. 2017-06-08 16:00:38 -07:00
Sheetal Nandi 48189c883f Merge branch 'master' into ownJsonParsing 2017-06-06 11:03:21 -07:00
Yui T b9017795a0 Revert "Revert "[Master] wip-dynamic import" (#16264)"
This reverts commit ccc60c8b3b.
2017-06-05 17:16:29 -07:00
Sheetal Nandi c4ad151a46 Merge branch 'master' into ownJsonParsing 2017-06-05 17:01:09 -07:00
Andy 8ace7b826f importFixes: Support missing "React" at a JSXOpeningElement (#16066)
* importFixes: Support missing "React" at a JSXOpeningElement

* Fix nextLineRule linting

* Rename to resolveJsxNamespaceAtLocation

* Expose getJsxNamespace and resolveNameAtLocation separately
2017-06-05 14:23:39 -07:00
Andy 70564110c0 Make use of array helper functions (#16226)
* Make use of array helper functions

* Remove unnecessary 'ts.'
2017-06-05 14:11:43 -07:00
Mohamed Hegazy ccc60c8b3b Revert "[Master] wip-dynamic import" (#16264) 2017-06-05 10:49:20 -07:00
Sheetal Nandi d680720f6d Merge branch 'master' into ownJsonParsing 2017-06-05 10:28:23 -07:00