Commit Graph

303 Commits

Author SHA1 Message Date
Andrew Casey
1957dfef8e Merge pull request #20991 from amcasey/GH18794
Refine extends-to-implements code fix
2018-01-05 17:52:22 -08:00
Andrew Casey
47aad0b8fd Switch to block-bodied lambda 2018-01-05 16:12:12 -08:00
Andrew Casey
ded788e560 Slightly simplify getCodeActions 2018-01-05 14:54:59 -08:00
Andrew Casey
8f5a76d48b Make fixCannotFindModule return an empty array if there is no code action 2018-01-05 14:24:40 -08:00
Andrew Casey
a961d7aa04 Only replace implements with a comma if the heritage clauses are sensible 2018-01-04 18:05:58 -08:00
Andrew Casey
afae97ce6e Refine extends-to-implements code fix
1. Retain surrounding trivia when swapping the keyword.
 2. Insert commas at the full-starts, rather than starts, of existing
 keywords when merging with existing implements clauses.

Fixes #18794
2018-01-04 17:55:12 -08:00
Wenlu Wang
2ea5f58d60 quick fix of indexed access type (#20956) 2018-01-04 12:45:16 -08:00
Andy
74b8160430 In import fixes, use a ".js" extension if other imports do (#20624)
* In import fixes, use a ".js" extension if other imports do

* Code review
2018-01-03 08:20:53 -08:00
Andy
813864f021 For import completion, use an existing namespace import (#20457) 2017-12-21 11:16:09 -08:00
Daniel Rosenwasser
69e091b40d Merge pull request #19797 from charlespierce/implements_class_error_message
Add new error message when class implements class
2017-12-19 11:39:05 -08:00
Andrew Casey
adc3234e46 Don't insert a blank line after extracted locals at the start of the file 2017-12-15 15:49:27 -08:00
Ryan Cavanaugh
f6603cd9f2 Merge pull request #20545 from RyanCavanaugh/codefixOmnibus
Omnibus fixes for telemetry-sourced crashes
2017-12-13 12:49:58 -08:00
Andy
8ad4aeece1 Make ChangeTracker#newLineCharacter public, to avoid having to pass newLineCharacter around as a parameter (#20574)
* Make ChangeTracker#newLineCharacter public, to avoid having to pass newLineCharacter around as a parameter

* Don't require newLineCharacter as input to ChangeTracker methods, and make it private again
2017-12-12 12:23:13 -08:00
Andy
21ff2cd501 Remove unnecessary getFirstChildOfKind helper function (#20647) 2017-12-12 11:25:58 -08:00
Charles Pierce
c489dd96f6 Resolve merge conflicts in codeFix 2017-12-11 22:27:56 -08:00
Wesley Wigham
eba15b5990 Preserve literal types in contextual unions (#19966)
* Cherrypick non-comparability related changes from prolific literals PR

* Renames and other style changes

* Accept changes to new tests

* Exclude the domain root from contextual typing literals except for type variables

* Readd simple preservation fix

* Add huge map test

* Revert changes to widening on destructuring initalizers

* Use tristate for subtype-reduction type

* Rename type and argument

* Move longer-running test to user suite
2017-12-11 18:03:38 -05:00
Ryan Cavanaugh
92c3b23a32 Bail at the correct point when containingFunction is undefined 2017-12-07 14:27:46 -08:00
Ryan Cavanaugh
b7b43fe601 Fixes #20527 2017-12-07 12:39:16 -08:00
Ryan Cavanaugh
2cf7295c4e Fix #20520 2017-12-07 12:38:44 -08:00
Ryan Cavanaugh
6e74f7ee11 Fix #20523 2017-12-07 12:38:08 -08:00
Andy
19ea189b42 Support a "getCombinedCodeFix" service (#20338)
* Support a "getCombinedCodeFix" service

* Rename things

* Code review

* Rename things

* Update API baselines

* CodeActionAll -> CombinedCodeActions

* Take a `scope` parameter instead of `fileName` for flexibility

* Renames and bugfixes

* Make API changes internal

* Code review

* Update comment
2017-12-07 12:14:18 -08:00
Andy
18a7c3fb53 For import fix, prefer symlink over a real path (#20395)
* For import fix, prefer symlink over a real path

* fixes

* Use best result from all symlinks

* Make originalPath optional more

* Only include real path if a symlink isn't available
2017-12-06 11:27:38 -08:00
Andy
8dca431733 Use InternalSymbolName.Default more (#20480) 2017-12-06 07:02:27 -08:00
Charles Pierce
472f087e69 Add new error message when class implements class #19793 2017-12-05 21:18:31 -08:00
Andy
8f23bf813c Add textChanges methods to insert nodes at the start of multiline bodies (#20445)
* Add textChanges methods to insert nodes at the start of multiline bodies

* Replace constructor body if not already multiline
2017-12-05 08:33:29 -08:00
Andrew Casey
8f1cdc9b0c Merge pull request #20373 from amcasey/PropertyUnderscore
Don't offer to prepend an underscore to the name of an unused private property
2017-11-30 13:08:26 -08:00
Andy
75e5b13775 Don't suggest import completions for /a/node_modules if we're in /b (#19928)
* Don't suggest import completions for /a/node_modules if we're in /b

* Remove test for delving into dependencies of dependencies
2017-11-30 11:25:01 -08:00
Andy
43a35bad2e Miscellaneous fixes to avoid duplicate completions (#20349)
* Miscellaneous fixes to avoid duplicate completions

* Move typeHasCallOrConstructSignatures to utility
2017-11-30 09:36:17 -08:00
Andrew Casey
011b567918 Don't offer to prepend an underscore to the name of an unused private property 2017-11-29 18:05:36 -08:00
Andy
185f15d2af Support both baseUrl and relative paths when adding missing import (#19724)
* Support both baseUrl and relative paths when adding missing import

* Code review

* Always use getRelativePathNParents, not getRelativePathLength
2017-11-28 14:01:51 -05:00
Mohamed Hegazy
6b3cfc7008 Fix #19959 and #19958: Remove un-localizable messages (#20019)
* Fix #19959 and #19958: Remove un-localizable messages

* Update message

* Update diagnostic messages
2017-11-24 22:02:48 -08:00
Andy
97bb471e48 For import completion, if multiple re-exports exist, choose the one with the shortest path (#20049)
* For import completion, if multiple re-exports exist, choose the one with the shortest path

* Code review
2017-11-17 14:35:32 -08:00
Andy
e7adb1ce79 Bundle fileName with CodeActionCommand (#19881)
* Bundle fileName with CodeActionCommand

* Update test

* Fix API tests

* Add new overloads in services

* Fix overload

* Update API baselines
2017-11-17 14:16:38 -08:00
Andy
94581c1946 Strip "/index" from import fix module specifiers (#19962)
* Strip "/index" from import fix module specifiers

* Require "node" module resolution

* More tests
2017-11-16 11:12:34 -08:00
Ron Buckton
a21a129abb Merge branch 'master' into dynamicNames 2017-11-15 15:24:05 -08:00
Andy
592ee00906 Have CompletionEntryDetails source use a relative path (#19917)
* Have CompletionEntryDetails source use a relative path

* Use getCanonicalFileName from services Instead of creating a new one
2017-11-14 14:26:49 -08:00
Ron Buckton
804c7d3690 Merge branch 'master' into dynamicNames 2017-11-13 13:24:20 -08:00
Ron Buckton
ae11ae55c5 Fix getReturnTypeFromBody widening 2017-11-13 13:19:49 -08:00
Andy
65a191fa2b For import completion of default import, convert module name to identifier (#19875)
* For import completion of default import, convert module name to identifier

* Suggestions from code review
2017-11-09 13:13:23 -08:00
Andy
5ad7e9516b Remove unnecessary wrapper classes in ts.formatting.Rule (#19744)
* Remove unnecessary wrapper classes in ts.formatting.Rule

* RulesProvider -> immutable FormatContext

* Remove Rules class, just use a list of rules

* Remove Shared namespace, replace Shared.TokenRange with TokenRange

* Simplify TokenRange

* Separate Rule and RuleSpec

* Move FormattingRequestKind to formattingContext.ts

* Simplify references

* Fix lint

* Revert removal of trailing newlines
2017-11-08 13:39:03 -08:00
Nathan Shively-Sanders
9b36e1155a Merge pull request #19039 from Microsoft/guard-name-in-getSuggestionForNonexistentSymbol
In getSuggestionForNonexistentSymbol, guard name against undefined
2017-11-07 15:03:26 -08:00
Aluan Haddad
b2b54cbf5c Import fix add import require support (#19802)
* import fix: suggest import..require where supported if synthetic defaults are unavailable

* Add tests for import..require fix when targeting CommonJS, AMD, and UMD modules

* fix failing tests
2017-11-07 09:45:30 -08:00
Andy
2fcf8b7068 Fix assertion -- an import may come from a require() call (#19667)
* Fix assertion -- an import may come from a require() call

* Add test for `import("./a")`
2017-11-07 07:41:21 -08:00
Aluan Haddad
70cabdda41 fix inconsistencies in import UMD code fixes adapting to module format (#19572)
* improve import code fixes for UMD modules
 - use default import under --allowSyntheticDefaultImports
 - import..require support
 - make make quick fix info match resulting import
 - make diagnostics

* Address PR feedback:
 - extract test for synethetic default imports into getAllowSyntheticDefaultImports in core.ts
 - use getAllowSyntheticDefaultImports in checker.ts and importFixes.ts
 - move compilerOptions to top level destructuring

* add tests

* remove `import =` quick fix and supporting code.

* update feature tests

* remove errant whitespace
2017-11-06 22:55:37 -08:00
Andy
8d5b0529b2 Add localizable diagnostic for "Install '{0}'" (#19651) 2017-11-03 18:14:21 -07:00
Andy
d998e97d8c Apply 'prefer-for-of' tslint rule (#19721) 2017-11-03 15:20:35 -07:00
Nathan Shively-Sanders
146addc4d5 Use explicit undefined checkk 2017-11-01 10:35:54 -07:00
Nathan Shively-Sanders
f4d4e89fa9 Merge branch 'master' into guard-name-in-getSuggestionForNonexistentSymbol 2017-11-01 10:34:19 -07:00
Nathan Shively-Sanders
a6a5b85b52 Switch from undefined guard to asserts
In both fixSpelling and getSuggestionForNonexistentSymbol
2017-11-01 10:33:24 -07:00
Andy
f4236ec5c8 Rename "isPartOfExpression" (#18469) 2017-10-31 08:05:39 -07:00