398 Commits

Author SHA1 Message Date
Andy
cdfd92b90d
Don't add import completion from a re-export in "./index" (#23623)
* Don't add import completion from a re-export in "./index"

* Simpler heuristic
2018-04-25 16:15:49 -07:00
Andy
5280d23b63
importNameCodeFix: consistently put fixes to use existing imports before fixes for existing imports (#23663) 2018-04-25 08:04:20 -07:00
Andy
969aa45ea5
Improve error message for unused type (#23633) 2018-04-24 08:54:42 -07:00
Andy
eca17ac243
Support import fix even when the error is that a type is used as a value (#23655) 2018-04-24 08:54:14 -07:00
Andy
5c94bef0e1
Add 'renameFile' command to services (#23573)
* Add 'renameFile' command to services

* renameFile -> getEditsForFileRename

* Support `<reference path>` directives
2018-04-20 13:43:09 -07:00
Andy
18c3f5ffa0
Use getFirstConstructorWithBody in one more place, and simplify other class members iteration (#23567) 2018-04-20 09:43:38 -07:00
Andy
a7c08e4691
Make code fix to add 'this.' work for statics (#23527)
* Make code fix to add 'this.' work for statics

* Add 'C.' instead of 'this.'

* DanielRosenwasser code review
2018-04-19 15:39:44 -07:00
Andy
e50b24a83b
convertFunctionToEs6Class: Copy comment from variable declaration (#23445) 2018-04-17 09:15:05 -07:00
Andy
55f9a6ffc2
Fix bug: VariableDeclaration initiazer may be undefined (#23439) 2018-04-17 08:59:07 -07:00
Andy
cae464058a
Delete "delete me" files (#23446) 2018-04-16 15:29:02 -07:00
Andy
aac9ef5e51
convertToEs6Module: Avoid replacing entire function (#22507)
* convertToEs6Module: Avoid replacing entire function

* Code review

* Fix typo
2018-04-16 13:16:04 -07:00
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