4823 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
53906f222f
containsTopLevelCommonjs:handle uninitialised vars (#27642)
Previously it assumed that all variable declarations had an initialiser,
which is not correct.
2018-10-09 13:17:54 -07:00
Nathan Shively-Sanders
88d3c6fd5f
inferFromUsage codefix now emits JSDoc in JS files (#27610)
* Now adding @type to variable declarations, at least

Probably everything else, but not as well.

* Improve @param output and add test

It's still bad, but at least it's not wrong.

* Add some js/inferFromUsage tests and fixes

Also, remove redundant is(Set|Get)Accessor functions.

* Fix @typedef refactor

* Emit JSDoc optional parameters

By surrounding the parameter name with brackets. It is super, super ugly
right now.

* Get rest of existing tests working

* Correct location of comments

* Handle @param blocks

1. Format multiple params nicely in a single-multiline block.
2. Generate only params that haven't already been documented. Existing
documentation is not touched.

* Re-add isGet/SetAccessor -- it is part of the API

* Move isSet/GetAccessor back to the original location

* Oh no I missed a newline and a space

* Switch to an object type

* A lot of cleanup

More to come, though. annotate is only called in
annotateVariableDeclaration where we don't know whether we're in JS or
not.

* Move and delegate to annotateJSDocParameters

* Address PR comments

* Lint: newline problems!!!!

* Switch another call to getNonformattedText

* Update baseline missed after merge
2018-10-09 10:38:46 -07:00
Nathan Shively-Sanders
ca94d8efd9
Infer from usage better import types (#27626)
* Use host to improve SymbolTracker implementation

* inferFromUsage: Provide a better moduleResolverHost

This produces better paths on import types.
2018-10-09 07:12:09 -07:00
Benjamin Lichtman
6afa880aa3
Merge pull request #27573 from uniqueiniquity/alwaysAwait
Always await expression of promise type in return position
2018-10-08 08:47:44 -07:00
Daniel Rosenwasser
8474949336
Merge pull request #27203 from sbaidon/signatureHelpInAdjacentBlockBody
Fix signature help not showing in block body bug
2018-10-07 23:07:59 -07:00
Benjamin Lichtman
2ebd986d99 Always await expression of promise type in return position 2018-10-05 09:59:22 -07:00
Andy
16766b196c
textChanges: Reuse some methods (#27492) 2018-10-02 17:34:17 -07:00
Ryan Cavanaugh
c04faa1e5b
Merge pull request #27485 from IllusionMH/fix-completionInfo-exception-27338
Use safe some function to handle undefined declarations (fixes #27338)
2018-10-02 11:28:38 -07:00
Alessandro Vergani
bbf77538c4
Remove unneeded check from getTransformationBody
Remove unneeded `argName` check, because it always evaluates to `true` (the `false` case is handled just before the modified line)
2018-10-02 16:02:04 +02:00
Benjamin Lichtman
f356cd6c89 Insert async keyword as last modifier (#27491) 2018-10-01 17:43:17 -07:00
IllusionMH
d0abd399af Use safe some function to handle undefined declarations (fixes #27338) 2018-10-01 23:11:32 +03:00
Dhruv Rajvanshi
bde81deed2 Issue #27301: Fixed crash when converting function to async (#27396) 2018-09-27 18:56:37 -07:00
Andy
5f2741b2ba
Make RenameInfo a union (#27382) 2018-09-27 08:56:40 -07:00
Andy
0a97663843
Add 'prefixText' and 'suffixText' when renaming shorthand properties (#27356)
* Add 'prefixText' and 'suffixText' when renaming shorthand properties

* Make prefixText and suffixText missing instead of undefined

* Fix test
2018-09-26 16:58:01 -07:00
Andy
4855920314
navigationBar/Tree: Better description for anonymous function (#27063) 2018-09-26 11:22:44 -07:00
Andy
b3dd471584
Support completions after 'async' in object literal (#27250) 2018-09-26 11:22:27 -07:00
Andy
d4d947e488
Fix bug: Allow completions after '@' with no contextToken (#27325) 2018-09-26 11:22:08 -07:00
Andy
5f563c99f6
convertToAsyncFunction: Use ReadonlyArray / ReadonlyMap where possible (#27190) 2018-09-20 16:45:28 -07:00
Sergio Baidon
bb58558e64 Fix signature help not showing in block body bug 2018-09-18 17:30:07 -05:00
Sheetal Nandi
865b3e7862
Merge pull request #27172 from Microsoft/moduleResolutionWithOutDir
Use originalFileName (fileName of input project reference file) to resolve module/typereferences/reference paths in it instead of output decl file path
2018-09-18 14:33:33 -07:00
Sheetal Nandi
4c047254e6 Ensure all the usages of compilerOptions.declaration take into account compilerOptions.composite if needed. 2018-09-18 13:53:16 -07:00
Andy
c57ff087d6
Add codefix to generate types for untyped module (#26588) 2018-09-18 11:47:29 -07:00
Benjamin Lichtman
cd28af0260
Merge pull request #27188 from uniqueiniquity/miscAsyncFixes
Miscellaneous async code fix fixes
2018-09-18 10:53:26 -07:00
Benjamin Lichtman
b484370dcc Clean up for type precision and clarity 2018-09-18 09:34:08 -07:00
Anders Hejlsberg
6adb9d194f
Merge pull request #27157 from Microsoft/fixEmptyObjectFalsiness
Fix empty object falsiness
2018-09-18 09:26:24 -07:00
Anders Hejlsberg
c0eb742cf3 Merge branch 'master' into fixEmptyObjectFalsiness 2018-09-18 06:28:27 -07:00
Sheetal Nandi
d51b8d940c Use originalFileName (fileName of input project reference file) to resolve module/typereferences/reference paths in it instead of output decl file path
This also ensures that originalFileName, resolvedPath are set correctly even when we are reusing program structure
Fixes #26036
2018-09-17 19:00:30 -07:00
Benjamin Lichtman
0cb9fd62ba
Merge branch 'master' into promisesAndUnderscores 2018-09-17 16:43:08 -07:00
Benjamin Lichtman
b2378ca40c Stop adding name of function being fixed and update baseline 2018-09-17 16:33:32 -07:00
Benjamin Lichtman
a73b561dd3 Ensure name for callback is generated even when it has no args 2018-09-17 16:23:47 -07:00
Ryan Cavanaugh
8ca01dfc9f
Merge pull request #26851 from ajafff/assert-compilerhost-readdirectory
Assert CompilerHost.readDiretory for projectReferences with include
2018-09-17 16:13:08 -07:00
Benjamin Lichtman
0995869377 Stop creating empty identifier name 2018-09-17 15:53:15 -07:00
Benjamin Lichtman
1a3ff452c1 Respond to CR 2018-09-17 15:44:08 -07:00
Andy
cfd0a62357
When renaming module, ensure rename span is just the last component of the path (#27151) 2018-09-17 15:26:41 -07:00
Andy
4e3e8f5ea7
convertToAsyncFunction: Reduce casts in getTransformationBody (#27158) 2018-09-17 15:23:44 -07:00
Benjamin Lichtman
830b387765 No longer specially recognize underscore and update baselines 2018-09-17 14:34:31 -07:00
Benjamin Lichtman
1b9507ad06 Wrap expressions returned from promises in awaits when appropriate 2018-09-17 11:33:28 -07:00
Andy
e710645bf9
Never escape string literals from textChanges (#26971)
* Never escape string literals from textChanges

* Use `boolean | undefined`
2018-09-17 11:06:39 -07:00
Andy
a57467a317
Fix bugs: Replace SourceFile if '--noUnusedLabels' changed (#27060)
* Fix bugs: Replace SourceFile if '--noUnusedLabels' changed

* Use properties on CommandLineOptionBase

* Handle "alwaysStrict" and better categorize options

* Properly handle "strict"

* Code review

* fix test
2018-09-17 10:53:48 -07:00
Benjamin Lichtman
f9072621a9 Run callback as expression statement when no arg to assign to exists 2018-09-17 09:48:19 -07:00
Anders Hejlsberg
46de5067b0 Fix resulting issue in compiler 2018-09-17 09:06:38 -07:00
Benjamin Lichtman
70ce7abe12
Merge pull request #27109 from uniqueiniquity/diagnosticLocation
Report async code fix diagnostic on name whenever it exists
2018-09-15 18:36:42 -07:00
Sheetal Nandi
e4718564e5
Merge pull request #27082 from Microsoft/watchAPIAndProjectReferences
Fix tsc watch and watch API for a project that has project references
2018-09-14 17:58:42 -07:00
Benjamin Lichtman
9e1a05c9ec Handle function assigned to binding pattern 2018-09-14 17:20:41 -07:00
Benjamin Lichtman
2c881fd90a Report diagnostic on expression name if it exists 2018-09-14 16:34:16 -07:00
Wesley Wigham
20eafb5b74
Introduce boolean literal freshness (#27042) 2018-09-14 15:00:09 -07:00
Sheetal Nandi
40d33c809a Merge branch 'master' into watchAPIAndProjectReferences 2018-09-14 10:54:07 -07:00
Benjamin Lichtman
0e985eb342
Merge branch 'master' into asyncCatchUniqueNames 2018-09-14 09:50:27 -07:00
Benjamin Lichtman
98055ad540 Use separate map with smaller scope to track renames 2018-09-14 09:46:58 -07:00
Benjamin Lichtman
13deedf841
Merge pull request #26930 from uniqueiniquity/onlyReportExpectedPromiseArgs
Only perform async code fix if it can successfully refactor all parts
2018-09-14 09:41:34 -07:00