Commit Graph

387 Commits

Author SHA1 Message Date
Ryan Cavanaugh
ff60520460 Merge branch 'master' into referencesDogfood_1 2018-04-12 12:26:10 -07:00
Andy
d2dc2e6d48 Don't copy trivia when implementing an interface (#23343)
* Don't copy trivia when implementing an interface

* Use an `includeTrivia` flag instead of a separate function
2018-04-12 11:47:42 -07:00
Andy
ff7ef4a25a Add fixName property to CodeFixAction (#23350) 2018-04-12 09:05:30 -07:00
Andy
b0552b089d Don't include "/index" in import from @types even with classic resolution (#23347) 2018-04-11 16:22:10 -07:00
Ryan Cavanaugh
9a5a5b10a3 Remove all reference comments from services 2018-04-11 15:39:12 -07:00
Andy
98a5e5cc0d Prioritize spelling fix over add-missing-member fix (#23268) 2018-04-09 13:23:11 -07:00
Andy
2b59c9a0d7 Don't add import completion for re-export with different name (#23211) 2018-04-06 10:05:38 -07:00
Andy
1e227c6d77 Add type predicate helper functions to Type (#23066) 2018-04-04 08:10:09 -07:00
王文璐
414266cc32 Merge branch 'master' into spelling-fix 2018-04-03 10:51:40 +08:00
Nathan Shively-Sanders
d3e0929b14 Mark js-assignment functions' symbols as methods (#23078)
This make display more accurate:
1. The functions now print as methods
2. When the type of the function references the class, the type of the
function itself is now printed correctly instead of as `any`.
2018-04-02 12:17:35 -07:00
Andy
ea65f21677 textChanges: Don't crash when inserting type annotation on function with no parens (#23034) 2018-04-02 08:41:22 -07:00
Mohamed Hegazy
b47c1fd5a1 Merge pull request #22593 from Kingwl/module-spelling-fix
add spelling suggestion support for module
2018-03-29 16:56:43 -07:00
Andy
d5a7dc1053 fixAddMissingMember: Remove special-casing for 'this' (#22987)
* fixAddMissingMember: Remove special-casing for 'this'

* Update type of 'call'
2018-03-29 12:54:17 -07:00
Andy
659dc03f68 completions: isNewIdentifierLocation = false for string literal where all legal values are known (#22933) 2018-03-27 19:36:54 -07:00
Andy
6118f211d1 Add 'isParameterPropertyModifier' helper (#22841) 2018-03-27 19:36:42 -07:00
Andy
3e32e15895 Add 'fixAllDescription' property to CodeFixAction (#22616)
* Add 'fixAllDescription' property to CodeFixAction

* Code review

* Add to protocol

* Make fixAllDescription be just a string
2018-03-27 18:21:21 -07:00
Andy
b9f48c1d5d refactorConvertToEs6Module: Preserve quote style of imports (#22929) 2018-03-27 17:01:31 -07:00
Andy
2bd66b3292 textChanges: Add insertCommentBeforeLine method (#22902) 2018-03-27 11:50:48 -07:00
Andy
ea6740fa91 replaceNode: Always use non-adjusted end (#22519)
* replaceNode: Always use non-adjusted end

* Never adjust start position either

* Fix excess property checks, remove unnecessary arguments

* Make 'insertText' and 'newLineCharacter' private

* Use replaceNode in one more place now that it doesn't affect comments

* Update replaceNodeRange too

* Always ask for ChangeNodeOptions
2018-03-27 10:34:16 -07:00
Andy
ced4c00522 importFixes: Distinguish when we need to import JSX constructor or JSX namespace (#22828) 2018-03-26 14:05:03 -07:00
Andy
b6b51a4d38 convertFunctionToEs6Class: Combine deletes and deletedNodes (#22742) 2018-03-22 08:22:00 -07:00
Andy
f2f2393f4b convertFunctionToEs6Class: Copy comments from constructor to class (#22738) 2018-03-22 08:12:02 -07:00
Andy
cc3921323c Support services settings (#22236)
* Support services settings

* Code review

* More review

* Use different names for Options and GetCompletionsAtPositionOptions (todo: come up with better names)

* More renames

* More renaming

* Support quote style in importFixes

* Add `importModuleSpecifierPreference` option

* Support quote style for `throw new Error('Method not implemented.')` (#18169)

* options -> preferences
2018-03-20 13:07:59 -07:00
Andy
28ff6b6ef3 Store import nodes in SourceFile.imports instead of StringLiteral nodes (#22495)
* Store import nodes in SourceFile.imports instead of StringLiteral nodes

* Change SourceFile#imports storage back

* Code review

* StringLiteral -> StringLiteralLike
2018-03-16 14:01:00 -07:00
Andy
adf3635a1f For import fix, for "foo/index" module, use "foo" as default export name, not "index" (#22651) 2018-03-16 14:00:33 -07:00
Matt Bierner
9774cd5eb5 Fix await code action crashes when await is not in a function (#22623)
Fixes #22614
2018-03-16 11:53:17 -07:00
王文璐
58b147e4c4 add spelling suggestion support for module 2018-03-15 10:40:01 +08:00
Andy
e7ce3f9457 useNonAdjustedEndPosition when replacing import node (#22517)
* useNonAdjustedEndPosition when replacing import node

* Never adjust positions, and add trivia test
2018-03-14 11:46:45 -07:00
Andy
6ef2db5c48 inferFromUsage: Handle being at an unexpected location (#22569)
* inferFromUsage: Handle being at an unexpected location

* add comment
2018-03-14 10:57:38 -07:00
Andy
83b438ffa6 fixUnusedIdentifier: Don't remove setter parameter (#22488) 2018-03-12 16:07:20 -07:00
Andy
0f47c8a205 annotateWithTypeFromJSDoc: Do less special-casing for arrow functions (#22407)
* annotateWithTypeFromJSDoc: Do less special-casing for arrow functions

* Code review
2018-03-08 16:32:32 -08:00
Andy
a49e83ffa7 annotateWithTypeFromJSDoc: Use changes.insertTypeAnnotation instead of replaceNode (#22404) 2018-03-08 11:47:30 -08:00
Nathan Shively-Sanders
f8134d0b45 Merge branch 'master' into js-object-literal-assignments-as-declarations 2018-03-08 10:40:55 -08:00
Andy
0605424852 fixJSDocTypes: Use ChangeTracker (#22391) 2018-03-08 07:52:03 -08:00
Nathan Shively-Sanders
d86440f94f Merge branch 'master' into js-object-literal-assignments-as-declarations 2018-03-07 14:51:55 -08:00
Andy
1f7a5097fa When every import is unused, error on the entire import declaration (#22386)
* When every import is unused, error on the entire import declaration

* Code review

* Store key in map value
2018-03-07 14:42:09 -08:00
Andy
e5804aefde inferFromUsage: use ChangeTracker and typeToTypeNode (#22379)
* inferFromUsage: use ChangeTracker and typeToTypeNode

* Use typeToTypeNode with SymbolTracker

* Add comment
2018-03-07 14:40:50 -08:00
Andy
0be9ee2871 Increase size of span for unused declaration (#22388) 2018-03-07 14:14:11 -08:00
Sheetal Nandi
36b45e3f13 Merge pull request #22343 from Microsoft/codeFixActionNotUndefined
Create the action only if the text change creation is successful.
2018-03-06 12:31:04 -08:00
Mohamed Hegazy
b2dd610e92 Fix ignore message indentation (#22340)
* Update baselines for user tests

* Add explicit indentation

* Fix https://github.com/Microsoft/TypeScript/issues/21355: Format `// @ts-ignore` added by quick fix

* Extract check to a separate function

* Consolidate checking for valid insert location

* Code review comments

* Do not return makeChange
2018-03-06 12:19:19 -08:00
Sheetal Nandi
70944428a1 Create the action only if the text change creation is successful. …
Make change for the infer type from usage could return undefined even if type is present if the type cannot be named
Fixes #22184
2018-03-06 11:03:20 -08:00
Andy
e5f91f5948 Convert annotateWithTypeFromJSDoc refactor to a codefix (#22336)
* Convert annotateWithTypeFromJSDoc refactor to a codefix

* Compute isJsFile once at top
2018-03-06 07:49:21 -08:00
Andy
2ac2291b84 Convert use-default-import refactor to a codefix (#22334) 2018-03-05 12:43:01 -08:00
Andy
87c3cca3f0 Make convertFunctionToEs6Class a codefix (#22241)
* Make convertFunctionToEs6Class a codefix

* Change diagnostic message
2018-03-02 12:57:29 -08:00
Andy
ba8879d005 Prefer 'return Debug.fail()' over 'throw Debug.fail()' (#22092) 2018-03-02 10:44:06 -08:00
Andy
16fc256823 Convert 'installTypesForPackge' refactor to a suggestion (#22267)
* Convert 'installTypesForPackge' refactor to a suggestion

* Have checker collect a list of suggestion diagnostics instead of redoing work in calculateSuggestionDiagnostics

* Add comment

* Add diagnostic even with `--allowJs`
2018-03-01 14:41:55 -08:00
Andy
a564912d9a Apply 'no-unnecessary-qualifier' lint rule (#22009) 2018-03-01 14:20:18 -08:00
Andy
fa4619c5c1 Add 'info' diagnostics (#22204)
* Add 'info' diagnostics

* Code review
2018-02-28 11:16:32 -08:00
Wesley Wigham
32c63a2628 Add support for transpiling per-file jsx pragmas (#21218)
* Add support for per-file jsx pragmas

* Add error for using jsx factory pragma with fragments

* More tests, use different regex class for pragma capture

* Unify all pragma parsing machinery
2018-02-26 16:10:00 -08:00
Wenlu Wang
30a96ba335 add support of codefix for Strict Class Initialization (#21528)
* add support of add undefined type to propertyDeclaration

* add support of add Definite Assignment Assertions to propertyDeclaration

* add support of add Initializer to propertyDeclaration

* remove useless parameter

* fix PropertyDeclaration emit missing exclamationToken

* merge fixes and fix

* fix unnecessary type assert
2018-02-23 07:25:50 -08:00