Commit Graph

2679 Commits

Author SHA1 Message Date
Andy
d671c7ae96 getEditsForFileRename: Support directory rename (#24305)
* getEditsForFileRename: Support directory rename

* Code review

* Handle imports inside the new file/directory

* Document path updaters

* Shorten relative paths where possible

* Reduce duplicate code

* Rewrite, use moduleSpecifiers.ts to get module specifiers from scratch instead of updating relative paths

* Update additional tsconfig.json fields

* Add test with '.js' extension

* Handle case-insensitive paths

* Better tsconfig handling

* Handle properties inside compilerOptions

* Use getOptionFromName
2018-06-01 08:23:37 -07:00
Andy
e65444214c Remove deprecated internal method (#24540) 2018-06-01 08:14:07 -07:00
Sheetal Nandi
eab21e5b77 Merge branch 'master' into suggestionDiagnosticsToken 2018-05-31 12:46:33 -07:00
Sheetal Nandi
b0f039c9e2 Make suggestion diagnostics to wire cancellationToken
This especially needed if its a js file without the ts-check, the file wont be typechecked in getSemanticDiagnostics
Fixes part of #19458
2018-05-31 10:47:17 -07:00
王文璐
7910bbdccb add esnext symbol proposal 2018-05-31 13:30:31 +08:00
Andy
43bf039a94 Add refactor to convert namespace to named imports and back (#24469)
* Add refactor to convert namespace to named imports and back

* Add tests and comments

* Code review

* Handle shorthand property assignment and re-export

* Don't use forEachFreeIdentifier

* Fix rename after "."
2018-05-30 14:11:53 -07:00
Sheetal Nandi
2226cd6a99 Merge pull request #24471 from Microsoft/watchInSiblingOfRoot
Instead of creating filter for subDirectories to watch in the ancestor directory of root, watch those subDirectories for failed lookup locations
2018-05-30 11:12:23 -07:00
Ron Buckton
fc3e88e26f Merge pull request #24481 from Microsoft/fix24173
Fix async generator return as well
2018-05-30 09:43:00 -07:00
Ron Buckton
6f7715444f Fix async generator return as well 2018-05-29 17:54:59 -07:00
Ron Buckton
364fce393d Merge pull request #24474 from Microsoft/fix21115.2
Do not await iterated value in for-await-of
2018-05-29 17:54:10 -07:00
Ron Buckton
394862e829 Test for asyncIterator existance before defining 2018-05-29 17:12:50 -07:00
Andy
e99be8c47d Avoid duplicate import completions when a namespace is exported by two different modules (#24473) 2018-05-29 15:52:34 -07:00
Ron Buckton
c224a824f3 Do not await iterated value in for-await-of 2018-05-29 15:33:43 -07:00
Sheetal Nandi
939e3e4780 Instead of creating filter for subDirectories to watch in the ancestor directory of root, watch those subDirectories for failed lookup locations
Before this change, when failed lookup location didnt fall in root directory,
we tried to find the ancestor directory of the rootDirectory to watch.
We also created subDirectory map for the directories that are being watched so we dont go through invalidation if path is unwanted directory
With this change, we will watch those subdirectories instead of root. On windows node supports file system level recursive watching so the earlier approach was better because we reduced number of watches created
But on other os, since node doesnt support it, we create the watches for existing folders outselves, so earlier approach becomes expensive.
This should be better compromize to satisfy both types of OS.
Fixes #24434
2018-05-29 14:49:19 -07:00
Sheetal Nandi
c7091ab01b Add test that verifies watched directories and files when resolution of module references sibling folder to root with symlLink 2018-05-29 13:45:20 -07:00
Wesley Wigham
64642bb5c3 Dump fork output on unclean exit (#24394)
* Dump fork output on unclean exit

* Remember to clear timeout on process exit in case processes exit at very different times
2018-05-24 16:13:32 -07:00
Sheetal Nandi
51058b56e5 Do not trigger invalidation if emitted file is in declarationDir 2018-05-24 13:36:52 -07:00
Wesley Wigham
a0b57808d0 Dont count duplicated errors in case-insensitive duped files in rwc (#24383) 2018-05-24 12:23:43 -07:00
Andy
bc570cd85f moveToNewFile: Respect UserPreferences#quote (#24365) 2018-05-24 09:36:37 -07:00
Mohamed Hegazy
dd6dc5e27a Merge pull request #24328 from Microsoft/getEditsForFileRename_oldFileStillPresent
getEditsForFileRename: Handle old file still being present
2018-05-23 16:16:00 -07:00
Wenlu Wang
4606709672 add code fix convert to mapped object type (#24286)
* add code fix convert to mapped object type

* add support for type literal and improve test

* fix typo

* add support for heritageClauses

* only determine declaration is not class
2018-05-23 14:09:49 -07:00
Wesley Wigham
7e4b20e587 Use compare paths for comparing diagnostic paths, since the canonicalization of fileName and unitName differ (#24340) 2018-05-22 17:01:34 -07:00
Andy
aed0eb6693 Improve verify.codeFixAvailable (#24325)
* Improve verify.codeFixAvailable

* Revert change to `verify.not.codeFixAvailable()`, and use `assertObjectsEqual` for better errors
2018-05-22 16:04:39 -07:00
Andy
e53e56cf82 Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Andy
9cda2bdba0 Support recommended completion for union (#24326)
* Support recommended completion for union

* Fix for empty enum, which is not a union
2018-05-22 13:38:28 -07:00
Andy Hanson
46eaf62abb getEditsForFileRename: Handle old file still being present 2018-05-22 12:20:34 -07:00
Sheetal Nandi
f44dd6f53b Merge pull request #24206 from Microsoft/documentRegistery
Cache the latest source file from document registery in script info so that we do not have to reparse orphan script info
2018-05-22 12:11:16 -07:00
Sheetal Nandi
e8a0e56e3e Add a test when orphan file changes before it gets added back to project 2018-05-22 11:45:52 -07:00
Andrew Casey
bedc110c74 Merge pull request #24311 from amcasey/GH23287
Preserve jsx imports even when the compiler option is not set
2018-05-22 11:23:15 -07:00
Sheetal Nandi
66590a9391 Verify ref counts are set correctly when reusing the source file from script info cache 2018-05-22 11:18:40 -07:00
Andy
7106a587cc Add type for diagnostics where location is defined (#23686)
* Add type for diagnostics where location is defined

* getSemanticDiagnostics may return global diagnostics

* Reduce array creation
2018-05-22 11:01:18 -07:00
Mohamed Hegazy
7fb3123984 Merge pull request #24298 from Microsoft/noErrOnBackgroundUpdate
Add noGetErrOnBackgroundUpdate session option to not queue diagnostics check for open files
2018-05-22 10:56:18 -07:00
Andrew Casey
2e0cc63067 Check TransformFlags.ContainsJsx, rather than LanguageVariant.JSX 2018-05-22 10:51:19 -07:00
Andy
982c8d0af9 Add suggestion diagnostics for unused label and unreachable code (#24261)
* Add suggestion diagnostics for unused label and unreachable code

* Always error on unused left hand side of comma
2018-05-22 07:56:29 -07:00
Andrew Casey
edd31a1505 Preserver jsx imports even when the compiler option is not set
...based on feedback from VS Code users.

Fixes #23287
2018-05-21 16:57:18 -07:00
Sheetal Nandi
f1acbc93ef Add noGetErrOnBackgroundUpdate session option to not queue diagnostics check for open files
This will ensure that the getErr will be queued in by host and hence would make sure that it is cancellable.
Handles one of the scenario delaying completions in #19458
2018-05-21 12:53:31 -07:00
Sheetal Nandi
e4c380a698 Merge branch 'master' into documentRegistery 2018-05-21 12:27:12 -07:00
Andy
4c22bf786e getEditsForFileRename: Do fresh module resolution instead of relying on cache (#24211)
* getEditsForFileRename: Do fresh module resolution instead of relying on cache

* Add host.resolveModuleNameWithFailedLookupLocations method

* Make host.resolveModuleNameWithFailedLookupLocations mandatory, and implement for Project

* Add test, and no need to check host.fileExists

* Change method name and always use cache

* Update name in string
2018-05-18 16:42:42 -07:00
Andy
3eb66da155 Add code fix to remove unused label (#24037)
* Add code fix to remove unused label

* Test with trivia and fix indentation with dedented label
2018-05-18 15:25:24 -07:00
Andrew Casey
04a351224c Merge pull request #24237 from amcasey/GH23640
Sort exports when organizeImports is run
2018-05-18 13:39:24 -07:00
Andrew Casey
7fcf1fdeb6 Delete redundant tests 2018-05-18 10:49:10 -07:00
Wesley Wigham
89059f0b85 Some RWC tests had dupes in their input/outher files list because paths werent both resolved (#24235) 2018-05-18 08:46:50 -07:00
Andrew Casey
a327241655 Sort exports when organizeImports is run
Note that there's no attempt to remove unused exports.

Fixes #23640
2018-05-17 18:38:42 -07:00
Wesley Wigham
66d6e5e6e0 Remove leveldown, stip absolute paths from test mk 2, accept reordered and new user baselines (#24227) 2018-05-17 15:32:10 -07:00
Sheetal Nandi
81ca6502ea Cache the latest source file from document registry so we can keep it alive when script info is orphan 2018-05-17 09:54:07 -07:00
Sheetal Nandi
59d19251cf Add test to verify the document is released from source file when info is orphan 2018-05-17 09:54:07 -07:00
王文璐
5d233054c3 add quick fix for import type missing typeof 2018-05-17 16:35:20 +08:00
Wesley Wigham
159c808a0d Sort the whole diagnostic, plus giving up on isolating tests (#24186)
* Sort the whole diagnostic

* Also strip references to our repos node_modules, since removing it is hard
2018-05-16 18:17:59 -07:00
Wesley Wigham
a85f1d5c1e Fix lint 2018-05-16 13:11:25 -07:00
Wesley Wigham
8ce581149c Bump user test enumeration timeout 2018-05-16 12:42:46 -07:00