Commit Graph

1912 Commits

Author SHA1 Message Date
Andrew Casey
3b4cbebee0 Handle repeated substitution of the same symbol during extraction
Old: Insert the same Node for every occurrence.  The position was
repeatedly mutated during printing.
New: Thunk the Node so that a new one is constructed for every
occurrence.

Fixes #18857
2017-10-02 16:51:13 -07:00
Andrew Casey
2df7058af7 Merge pull request #18861 from amcasey/ConstantInsertionPosition
Improve insertion positions of extracted constants
2017-10-02 16:39:32 -07:00
Andy
eefe5c9706 Fix acquiring format options for getEditsForRefactor (#18848)
* Fix acquiring format options for getEditsForRefactor

* Add test

* Fix test description

* Use `executeCommandSeq`
2017-10-02 13:26:35 -07:00
Andy
b883fcbfdd Enable "space-within-parens" lint rule (#18856) 2017-10-02 08:36:26 -07:00
Andrew Casey
bcc93f2c08 Loosen restriction on usages in innermost scope
Now that we're smarter about where we declare the extracted local, we
can ignore usage problems in the innermost script - it'll always have
access to the same symbols as the extracted expression.
2017-09-29 18:00:27 -07:00
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
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
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
0b7dd5a4a5 Rename test baseline to be compatibile with windows (#18827) 2017-09-28 13:32:38 -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
Andrew Casey
49d24fd89e Rename extractMethod tests to extractFunction for consistency 2017-09-28 10:36:16 -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
Andrew Casey
386e76543a TODOs for repeated substitution 2017-09-27 18:08:35 -07:00
Armando Aguirre
8683ac92c8 Fixed formatting on script blocks, added regrestion tests, fixed minor bugs 2017-09-27 15:18:25 -07:00
Wesley Wigham
d407f14e86 Remove console logs in fourslash (#18803) 2017-09-27 11:49:14 -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
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
Wesley Wigham
6ffee104ca Split rwc input files (#18772)
* Handle translation between new and old log format styles

* Iteration

* Strip all backcompat

* Remove new parenthesis

* Handle directories in the test perf heuristic measurement

* Optional catch bindings!
2017-09-26 15:55:21 -07:00
Andy
ecef2dc970 Improve testing of code fixes, and improve diagnostic messages (#18742)
* Improve testing of code fixes, and improve diagnostic messages

* Disambiguate `newFileContent` from `newRangeContent`
2017-09-26 15:16:29 -07:00
Wesley Wigham
5a0c60a9a1 Include nearest test name in uncaught errors, catch suite errors (#18694) 2017-09-25 10:26:23 -07:00
Andy
024b1fd913 Make it a parse error for an @augments jsdoc tag to not include a type (#18745) 2017-09-25 09:26:59 -07:00
Andy
25ad0b5581 Apply "array-type" lint rule (#18699) 2017-09-22 16:14:41 -07:00
Wesley Wigham
5353475fce Always collect type and symbol baselines (#18621)
* Always generate type & symbol baselines

* Accept changed shadowed baselines

* Accept brand new type and symbol baselines

* Allow `getTypeAtLocation` to return undefined in the type writer

* Accept baselines which had missing type information

* Bind container for dynamically names enum members so they may be printed

* Accept type/symbol baselines for enums with computed members

* First pass at reducing typeWriter memory overhead

* Use generators to allow for type and symbol baselines with no cache

* Accept new baselines for tests whose output was fixed by better newline splitting

* Hard cap on number of declarations printed, cache declaration print text

* handle differing newlines better still to handle RWC newlines

* Lower abridging count, accept abridged baselines

* Limit max RWC error output size, limit RWC type and symbol baseline input size

* Move skip logic into type and symbol baseliner to streamline error handling

* Accept removal of empty baselines

* Canonicalize path earlier to handle odd paths in input files

* Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another

* No need to pathify again
2017-09-22 15:52:04 -07:00
Daniel Rosenwasser
92b7dcf20a Merge pull request #18660 from Microsoft/globalAugmentationPrinter
Correctly print global augmentations
2017-09-22 15:01:10 -07:00
Wesley Wigham
5f4436d433 Keep a small reserve of tasks to not-batch, so all threads can have always have an initial task (#18696)
* Keep a small reserve of tasks to not-batch, so all threads can have an initial task"

* Assign no weight to new tests, but still place them at the end of the list
2017-09-22 14:44:26 -07:00
Andy
2399bac377 Make it a parse error for an @type jsdoc tag to not include a type (#18664)
* Make it a parse error for an `@type` jsdoc tag to not include a type

* Rename parameter
2017-09-22 10:45:43 -07:00
Daniel Rosenwasser
764af0e781 Added tests and accepted baselines. 2017-09-21 11:22:30 -07:00
Wesley Wigham
b670b9763f Typo fix 2017-09-21 10:42:06 -07:00
Wesley Wigham
7dec4ae9d1 Remove batching on unittest thread, use historical data to inform batching (#18578)
* Remove batching on unittest thread

* Batch more things, improve output, use past test perf as a better heuristic for future test runs

* Fix merge sideeffect

* Fix typo
2017-09-20 13:22:12 -07:00
Wesley Wigham
136a3ea77d Handle unixy paths in RWC tests (#18585) 2017-09-20 09:18:39 -07:00
Wesley Wigham
ab6bb1618f Actually capture oldTranspile baselines (#18584) 2017-09-19 16:57:20 -07:00
Wesley Wigham
5f49357bf6 Fix unittest parallel reporting (#18583)
* Some tests depended on late execution

* Emulate mocha execution order

* Polyfill a synchronous done to handle that one unittest

* Accpept updates tsconfig baselines fixed by #18534
2017-09-19 16:52:56 -07:00
Andy
12649516cf navigation tree / bar: Set span of anonymous function to span of VariableDeclaration containing it (#18575)
* navigation tree / bar: Set span of anonymous function to span of VariableDeclaration containing it

* Add back `isFunctionOrClassExpression`
2017-09-19 14:39:29 -07:00
Andrew Casey
af49c60a2c Stop requiring that the full range of a declaration fall within the
selection

Fixes #18546
2017-09-18 19:17:47 -07:00
Wesley Wigham
21bbee4044 init progressbar dependencies within host start to avoid execution in a browser context (#18554) 2017-09-18 13:41:37 -07:00
Andrew Casey
7ba140445d Fix broken test 2017-09-15 13:58:49 -07:00
Wesley Wigham
11333a7bc2 Conditional declaration (#18506) 2017-09-15 10:45:20 -07:00
Wesley Wigham
fd4a8d1516 Let the RWC harness iterate over files instead of building one big file (#18416)
* Let the RWC harness iterate over files instead of building one big file

* Handle duplicated-only-in-case outputs better in the type baseliner

* Always lowercase output names

* Move common code into helper function

* Always write .delete for missing files even if there were errors
2017-09-14 16:22:14 -07:00
Wesley Wigham
d1c4754b37 Better-scheduled parallel tests (#18462)
* Out with the old...

* Brave new world

* Throttle console output

* Batches test messages on large inputs initially

* Move parallel runner code into seperate files
2017-09-14 15:42:06 -07:00
Andy
0747b33038 Fixes to emit / format for codeFix (#18484) 2017-09-14 14:30:50 -07:00
Andy
6e512a495f extractMethod: Don't try to extract an ExpressionStatement consisting of a single token (#18450)
* extractMethod: Don't try to extract an ExpressionStatement consisting of a single token

* Move to unit test
2017-09-14 11:16:21 -07:00