5642 Commits

Author SHA1 Message Date
Ron Buckton
6ab6d5f949 Merge branch 'master' into nodeFactory
# Conflicts:
#	src/compiler/binder.ts
#	src/compiler/checker.ts
#	src/compiler/factory.ts
#	src/compiler/transformers/declarations.ts
#	src/compiler/transformers/es2015.ts
#	src/compiler/transformers/module/module.ts
#	src/compiler/transformers/module/system.ts
#	src/compiler/transformers/taggedTemplate.ts
#	src/compiler/transformers/ts.ts
#	src/compiler/utilities.ts
#	src/compiler/visitor.ts
#	src/harness/vfsUtil.ts
#	src/services/codefixes/addMissingAsync.ts
#	src/services/codefixes/convertToMappedObjectType.ts
#	src/services/codefixes/helpers.ts
#	src/services/completions.ts
#	src/services/refactors/generateGetAccessorAndSetAccessor.ts
2020-05-15 14:34:33 -07:00
Ron Buckton
9350a5ec44 Merge branch 'master' into nodeFactory-merge
# Conflicts:
#	src/compiler/factoryPublic.ts
#	src/services/codefixes/convertToAsyncFunction.ts
#	src/services/codefixes/helpers.ts
#	src/services/codefixes/inferFromUsage.ts
#	src/services/signatureHelp.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2020-05-15 13:58:03 -07:00
Alexander T
71711257ea
fix(33836): allow readonly modifier for a field with only get accessor (#36543) 2020-05-13 13:28:32 -07:00
Daniel Rosenwasser
b682ee1a8a
Merge pull request #38489 from microsoft/removeDuplicateInfo
Remove duplicate JSDoc comments
2020-05-12 12:52:15 -07:00
Nathan Shively-Sanders
3f06adf662
Merge pull request #38240 from a-tarasyuk/feat/add-outlining-spans-for-object-destructuring-elements
feat: Add outlining spans for object destructuring elements
2020-05-12 07:35:03 -07:00
Nathan Shively-Sanders
cbf15bb6ed
feat(38225): change diagnostic message for remove braces from arrow function body (#38226) 2020-05-12 07:27:09 -07:00
Alexander T
5895493815
fix(37877): include in NavigationBar default exported child items (#38255) 2020-05-12 07:26:31 -07:00
Daniel
e9867a7353 Add and use the 'intersperse' helper function. 2020-05-11 22:17:01 +00:00
Ron Buckton
d07e866a28
Fix for jsdoc modifiers on constructor params (#38403)
* Fix for jsdoc modifiers on constructor params

* Update Public API baseline and fix unique symbol grammar check for js
2020-05-11 15:07:43 -07:00
Daniel
74d6d04d70 Don't add duplicates of JSDoc comments. 2020-05-11 21:39:47 +00:00
jeffy-g
fd71eb2c85
fix broken regex on "src/services/completions.ts#getCompletionData" (#37546)
* fix broken regex on src/services/completions.ts#840

* update forslash test

breaking changes fourslash test

Temporarily retain the before fix code for easy comparison

* regex

* fourslash test (Temporary code

* regex: more restrictive in terms of jsdoc format

fourslash test

* regex: max indent restriction

* achieved goal by partial match strategy (probably

* cleanup

* apply requested changes

* Change to a version with minimal modifications
2020-05-11 13:02:20 -07:00
Alexander T
738b6b5b68
fix(38073): hide 'Extract to function in global scope' action for arrow functions which use 'this' (#38107) 2020-05-11 12:25:25 -07:00
Ron Buckton
086633f4db Merge branch 'master' into nodeFactory-merge 2020-05-07 19:00:13 -07:00
Eli Barzilay
29cf049e61 moveToNewFile: handle namespace imports too
Fixes #35591
2020-05-07 11:46:36 -04:00
Alexander T
683b3ec058
feat(37782): 'declare method' quick fix for adding a private method (#37806)
* feat(37782): add quick-fix action to declare a private method for names that start from underscore

* better merge order in messages json

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:10:02 -07:00
Wenlu Wang
e66ce879a9
expose jsdoc factory (#29539)
* expose jsdoc factory

* refactor jsdoc factory

* correctly jsdoc factory types

* update jsdoc factory

* Add check for delete expression must be optional

* accept new basseline

* Revert "Add check for delete expression must be optional"

This reverts commit 76937c3b1a5c3acbb3da8e449f5f88978be4eed0.

* remove newline

* make linter happy

* Add deprecated comment

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:06:12 -07:00
Wenlu Wang
8d78984558
Add support of contextual quick info (#37451)
* Add support of contextual quick info

* Avoid document comment map

* Make lint happy

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:05:31 -07:00
Alexander T
d86bdf4e5c
add outlining spans for the tuple type (#38179) 2020-05-05 09:48:33 -07:00
Alexander T
2bdc8fdc94
add outlining spans for array destructuring elements (#38191) 2020-05-05 09:29:24 -07:00
Daniel Rosenwasser
94c5c3ff47
Add missing arguments to typeToTypeNode. (#38336)
* Add missing arguments to typeToTypeNode.

* Use returnTypeNode as the enclosingDeclaration.

* Add a test.
2020-05-04 19:32:27 -07:00
Wesley Wigham
d9c9c9d9e4
Harden node builder APIs to no longer return undefined for a node when NodeBuilderFlags.IgnoreErrors is provided (#38273) 2020-05-04 14:47:39 -07:00
Alexander T
5e0e254ef7
fix(38177): add auto-import for missing argument type in new functions/methods (#38213) 2020-05-04 12:37:04 -07:00
Eli Barzilay
ba02f4303e Make getAwaitedType private
Also, fix an additional baseline change and break up huge line.
2020-05-04 13:18:52 -04:00
Alexander T
0503da225d feat(36266): add a quick fix for incorrect return types in async functions 2020-05-04 13:18:52 -04:00
Jack Works
6f7faa7636
Fix: convertFunctionToEs6Class cannot recognize x.prototype = {} pattern (#35219)
* fix: convertFunctionToEs6Class cannot recognize `x.prototype = {}` pattern

* test: add test for convert fn to es6

* chore: add more tests

* chore: move tests around

* chore: make code more clear
2020-04-30 11:06:46 -07:00
Alexander T
ef72e84314 Merge branch 'master' of https://github.com/microsoft/TypeScript into feat/add-outlining-spans-for-object-destructuring-elements 2020-04-28 17:15:25 +03:00
Alexander T
57f161eaa8 feat(38225): change diagnostic message for remove braces from arrow function body 2020-04-28 10:44:36 +03:00
Alexander T
31b81bafe7
fix(38138): show suggestions for identifier in class property initializer (#38157) 2020-04-24 13:50:34 -07:00
Andrew Branch
689822c183
convertToAsyncFunction: Disable for .then with both fulfillment and rejection handlers (#38152)
* Disable convert to async for `.then` with both fulfillment and rejection handlers

* Delete baselines

* Also disable refactor for 3+ arguments
2020-04-24 09:52:18 -07:00
Daniel Rosenwasser
d7e437a409
Have the ChangeTracker filter out edits that are no-ops (#38123)
* Filter out edits that are no-ops in 'organize imports'.

* Updated tests for 'organize imports'.

* Always remove no-op changes from the change tracker.

* Add a new `stringContainsAt` helper function to avoid traversing the entire file contents.

* Combine `map`/`filter` sequence into `mapDefined`.

* Fix up documentation.
2020-04-23 12:54:49 -07:00
Andrew Branch
9569e8aaa4
Fix newline issues when adding multiple imports (#38119)
* Add new import declarations in a single TextChanges call

* Refactor
2020-04-23 11:59:38 -07:00
Josh Goldberg
ef83109dbf
Prefer a likely literal over anonymous type in --noImplicitAny codefixes (#36015)
* Prefer a likely literal over anonymous type in --noImplicitAny codefixes

Before trying to make an anonymous type for a type's usage, we'll first check if there is exactly one builtin primitive the usage is assignable to, and use it if so. Right now that's only `number` and `string` because `boolean` has no distinguishable members.

A couple of implementation details:
* `tryInsertTypeAnnotation` needed to know to insert a type _after_ a node's `exclamationToken` if it exists
* This code area was written before `??` 😉

* Used unknown/any instead of void when applicable

* Fix little whitespace change in tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts

* Undid some now-unnecessary unknown additions

* Took advice on restricting void to just call expressions
2020-04-22 11:28:11 -07:00
Alexander T
d2016912b5
fix(37825): exclude private fields from completions in subclasses (#37906) 2020-04-22 12:07:36 -04:00
Alexander T
92a63741a2
fix(38080): add outlining spans for TypeLiteral (#38089) 2020-04-22 11:51:36 -04:00
Alexander T
1e48057b9e
fix(15398): skip adding line breaks when replacing JS checks directives (#38086) 2020-04-21 11:02:56 -07:00
Alexander T
52d32e5597 Add outlining spans for object destructuring elements 2020-04-21 12:57:52 +03:00
Andrew Branch
547fd12c2f
Fix doc comment template on assignment expressions (#38032) 2020-04-20 11:15:12 -07:00
sergeir82
b346f5764e
prefix-unused-parameter-with-_ codefix now works in jsdoc @param (#36152)
* Fix prepending unused TypeScript variables with underscore doesn't rename JSDoc @param.
Fix test for quick fix "Prefix all unused declarations with '_' where possible".
Fixes #33021.

* Replace FindAllReferences.Core.eachSymbolReferenceInFile function call to more ligher call of getJSDocParameterTags when searching for a parameter in jsdoc.

* Remove redundant constant declaration.

* Add test for prefix single unused parameter in jsdoc.
2020-04-17 13:18:05 -07:00
Joe Previte
583e70b3d1
fix(refactor): keep comments after refactor (#35937)
* add two tests: Refactor: Remove braces from arrow function

* refactor: simplify test and add another test

* fix: copyTrailingAsLeadingComments in addOrRemoveBracesToArrowFunction

* test: add additional test

* fix: clean up changes

* fix: add check for newEdit

* fix: add function for semi colon modifier

* feat: grab all comments during refactor

* refactor: update addOrRemoveBraces logic

* fix: remove duplicate function call

* Update src/services/refactors/addOrRemoveBracesToArrowFunction.ts

* remove blank line

remove blank line

Co-authored-by: Jesse Trinity <42591254+jessetrinity@users.noreply.github.com>
2020-04-15 11:06:04 -07:00
Alexander T
a8e1ad4e62
fix(37781): import missing argument types for a new method (#37857) 2020-04-13 10:23:12 -07:00
Alexander T
aa6be6ee6f
fix(37364): show completions for string literal index on mapped type (#37367) 2020-04-10 12:36:26 -04:00
Andrew Branch
57f9076612
Remove extraneous string escape from convert to template string refactor (#37743)
* Add failing test

* Remove extraneous string escape

* Revert unnecessary change
2020-04-09 09:40:28 -07:00
zhangciwu
126c6ab80d
Fix easy misunderstanding "! ===" (#37838)
* Remove unnecessary Non-null assertion operator

* Wrap Non-null assertion operator inside parentheses
2020-04-08 08:17:22 -07:00
Alexander T
e897eb1b2a
fix(37817): omit comments in name accessor (#37822) 2020-04-07 16:59:54 -07:00
Andrew Branch
2187ba1f84
Fix variable name collisions (#37761) 2020-04-02 15:12:19 -07:00
Wenlu Wang
afc41f095d
Quick fix for functions lacking return expressions (#26434)
* stash

* add surmise for return type

* add support for more case

* add more test case

* add more testcase and fix all test

* fix changed diagnosis

* fix broken test case

* add more case

* rename quickfix

* fix conflict

* fix fix desc

* fix semi

* Avoid replace brace with paren

* Split fix all action

* Add return work in same line

* fix test cases

* rename baseline

* refactor and handle comment

* Support semi

* make helper internal
2020-04-02 10:06:14 -07:00
Zixiang Li
54b0e4acc5
Fix goto implementation does not suggest all subtypes (#33652) 2020-04-02 09:57:48 -07:00
Andrew Branch
3810c2fe6b
Fix rename for type symbols imported as a different name (#37745)
* Add failing test

* Fix getMeaningFromLocation for imports

* Only the name of an ImportEqualsDeclaration counts

* Commit baseline
2020-04-02 09:06:19 -07:00
Alexander T
72a0411776
fix(37431): allow only one space between async keyword and method name (#37504) 2020-04-02 11:30:05 -04:00
Wenlu Wang
5596ed80d7
Add replacement span for string literal (#37490)
* Add replacement span for string literal

* fix change requests

* fix lint

* Avoid flag

* Fix baseline

* ADd misising baseline
2020-04-01 17:58:16 -07:00