Commit Graph

34031 Commits

Author SHA1 Message Date
Andrew Casey 9097a07758 Improve insertion positions of extracted constants
...mostly by putting them closer to the extraction site.

They now also follow all leading comments in a file (unfortunately,
including the doc comment on the first declaration).

Bonus: Special case declaration lists - declare the new variable as part
of the list, rather than before it, in case it depends on an earlier
entry.
2017-09-29 15:52:56 -07:00
Andrew Casey 7aee3a102c Merge pull request #18831 from amcasey/AdditionSpecialCase
Eliminate special case for extracting from a binary operator chain
2017-09-29 13:10:28 -07:00
Andy f71930c473 Print list of available refactors when we can't find one (#18843) 2017-09-29 11:08:45 -07:00
Sheetal Nandi 9e08caebf5 Merge branch 'master' into watchImprovements 2017-09-29 10:43:05 -07:00
Andy 683d6c7ddd Add helper functions for using unescapeLeadingUnderscores (#18793)
* Add helper functions for using `unescapeLeadingUnderscores`

* More cleanup
2017-09-29 09:57:31 -07:00
Anders Hejlsberg c626d9d47c Accept new baselines 2017-09-28 15:44:17 -07:00
Anders Hejlsberg 0756aa1753 Merge branch 'master' into strictFunctionTypes 2017-09-28 15:39:57 -07:00
Andrew Casey 8e4c559f2c Merge pull request #18829 from amcasey/JsExtractTests
Improve Extract* unit test coverage and correctness
2017-09-28 14:59:18 -07:00
Andrew Casey 41676248e5 Eliminate special case for extracting from a binary operator chain
1) It assumed left-associativity and was, therefore, wrong for (e.g.)
exponentiation.
2) Arguably, if a user selects `a + |b + c|`, they want to extract `b +
c`, not `a + b + c`.  Not being able to do so is surprising (and we may
eventually want to allow it), but so is having the rest of the
least-common subtree extracted.

Fixes #18268
2017-09-28 14:54:52 -07:00
Anders Hejlsberg 1609196b22 Accept new baselines 2017-09-28 14:34:03 -07:00
Anders Hejlsberg 5613be4907 Only methods and constructors are bivariant in --strictFunctionTypes mode 2017-09-28 14:33:35 -07:00
Andrew Casey a73a553f58 Assert that Extract* baselines are syntactically valid 2017-09-28 14:31:35 -07:00
Andrew Casey 0d5d5cdf28 For any Extract* baseline that is valid JS, produce a JS baseline 2017-09-28 14:13:48 -07:00
Andy 7959bd0a3d Check JSDoc @param tag names (#18777) 2017-09-28 13:44:38 -07:00
Andy 4bba6ee02e Support accessing enum types from JSDoc (#18703) 2017-09-28 13:43:39 -07:00
Andy 0b7dd5a4a5 Rename test baseline to be compatibile with windows (#18827) 2017-09-28 13:32:38 -07:00
Daniel Rosenwasser 0ea7c61eb5 Merge pull request #18810 from Microsoft/unusedErrorArgs
Remove unused arguments for diagnostics
2017-09-28 12:51:57 -07:00
Armando Aguirre a39110add9 Merge pull request #18806 from armanio123/FixScriptBlockFormatting
Fixed formatting on script blocks
2017-09-28 12:35:32 -07:00
Andy 1a2de721b5 Fixes to @augments handling (#18775)
* Fixes to @augments handling

* Renames and diagnostic changes

* Add test for < > characters

* Use more specific return type
2017-09-28 12:34:54 -07:00
Nathan Shively-Sanders d797b4ab76 Correctly transform jsdoc parameter types
And give a better name for rest params
2017-09-28 11:40:56 -07:00
Andrew Casey 8e7a5bac92 Merge pull request #18824 from amcasey/ExtractFunctionRename
Rename extractMethod tests to extractFunction for consistency
2017-09-28 10:58:34 -07:00
Andrew Casey 49d24fd89e Rename extractMethod tests to extractFunction for consistency 2017-09-28 10:36:16 -07:00
Armando Aguirre 5225b40aab Addedn rangeContainsRange helper function 2017-09-28 10:23:30 -07:00
Andrew Casey 5f30106269 Merge pull request #18783 from amcasey/ExtractConstant
Initial implementation of Extract Constant
2017-09-28 10:09:44 -07:00
Andy a92d315eb6 Remove unnecessary cast (#18822) 2017-09-28 09:57:32 -07:00
Nathan Shively-Sanders 724a813105 Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-09-28 09:17:28 -07:00
Daniel Rosenwasser 76d92a5dd6 Remove unused arguments in program.ts. 2017-09-27 22:04:52 -07:00
Daniel Rosenwasser 9b77dd6a98 Merge pull request #16595 from alexeagle/pretty
--pretty diagnostics: move context after the file/error
2017-09-27 21:41:36 -07:00
Daniel Rosenwasser fbbf3d22e3 Accepted baselines. 2017-09-27 20:56:59 -07:00
Daniel Rosenwasser b029857528 Give a more helpful error message when users try decorating using expressions that take no arguments. 2017-09-27 20:46:42 -07:00
Daniel Rosenwasser b6629f4fac Remove unused arguments. 2017-09-27 20:39:14 -07:00
Daniel Rosenwasser 4ec1643ecc Fall back to old behavior for tagged template emit in global files. 2017-09-27 18:14:45 -07:00
Andrew Casey 386e76543a TODOs for repeated substitution 2017-09-27 18:08:35 -07:00
Daniel Rosenwasser b406d5453e git Merge branch 'master' into correctlyCacheTaggedTemplates 2017-09-27 17:32:38 -07:00
Daniel Rosenwasser 0b7538d04d Accepted baselines. 2017-09-27 17:32:14 -07:00
Daniel Rosenwasser 1841afeaa2 Ensure that the import helper is checked for tagged templates, and update its name. 2017-09-27 17:31:32 -07:00
Sheetal Nandi fad71d3dc6 Use project root as the current directory whenever possible to create the project 2017-09-27 17:19:54 -07:00
Daniel Rosenwasser 886a29b512 Added tests for import helpers with & without a declared template object creator. 2017-09-27 17:07:42 -07:00
Armando Aguirre 8683ac92c8 Fixed formatting on script blocks, added regrestion tests, fixed minor bugs 2017-09-27 15:18:25 -07:00
Alex Eagle 9753d3950b --pretty output: move context after the file/error
Fixes #16583
2017-09-27 13:55:30 -07:00
Wesley Wigham d407f14e86 Remove console logs in fourslash (#18803) 2017-09-27 11:49:14 -07:00
Andrew Casey e6bfce193c Add additional TODO about insertion positions 2017-09-27 10:40:12 -07:00
Andrew Casey 13e60bc497 Use resources, rather than string literals, in test baselines 2017-09-27 10:35:13 -07:00
Andrew Casey cb6037b563 Forbid extraction of constants to class scopes in JS 2017-09-27 10:30:02 -07:00
Andrew Casey 697bce74b8 Split range tests and helpers out of extractFunctions.ts 2017-09-26 17:29:36 -07:00
Andrew Casey 52ab05e99d Rename extractMethods.ts to extractFunctions.ts for consistency 2017-09-26 17:29:35 -07:00
Andrew Casey 2601bbcea7 Add simple tests for Extract Constant 2017-09-26 17:29:35 -07:00
Andrew Casey eb1fb5c164 Rename extractMethod.ts to extractSymbol.ts 2017-09-26 17:29:34 -07:00
Andrew Casey 3eea1a9e9a Generalize extract method to handle constants as well
Major changes:

1) Instead of skipping undesirable scopes, include them and mark them
with errors.  Constants can be extracted into more scopes.

2) Update the tests to call through the "public" API.  This caused some
baseline changes.

3) Rename refactoring to "Extract Symbol" for generality.

4) Return a second ApplicableRefactorInfo for constants.  Distinguish
the two by splitting the action name.
2017-09-26 17:29:34 -07:00
Sheetal Nandi ec95921315 Merge branch 'master' into projectRootAsCurrentDirectoryInEmit 2017-09-26 16:34:34 -07:00