Commit graph

2310 commits

Author SHA1 Message Date
Benjamin Lichtman dcc1f1497f
Merge pull request #19619 from uniqueiniquity/indentJsxText
Properly indent JSXText on format document
2017-11-01 09:03:52 -07:00
uniqueiniquity 9f68ff5b0f Remove markers 2017-10-31 16:10:17 -07:00
uniqueiniquity 20e1f5258b Update test 2017-10-31 16:09:30 -07:00
Armando Aguirre cf2bdf8250
Merge pull request #19175 from armanio123/AddDefinitionAndBoundSpan
Added DefinitionAndBoundSpan command
2017-10-31 14:58:36 -07:00
uniqueiniquity b6ea2f955a Refactor test and annotate object literal 2017-10-31 14:52:15 -07:00
wenlu.wang deb94886fd fix completion module path (#19351)(#19367) (#19366)
* completion module path with re-export(#19351)

* completion module path with dynamic import(#19367)
2017-10-31 14:10:38 -07:00
uniqueiniquity 9b9032f8c5 Add JSXText indentation test 2017-10-31 14:09:36 -07:00
Armando Aguirre d5c18a6fb7
Merge branch 'master' into AddDefinitionAndBoundSpan 2017-10-30 17:02:23 -07:00
Andrew Casey a89c055a48
Merge pull request #19578 from amcasey/GH19395
Don't pass synthesized node to typeToTypeNode
2017-10-30 16:35:20 -07:00
Ron Buckton 91c37f72d3
Merge pull request #19401 from Microsoft/fix19349
Remove escaped names of well known symbols from string completions
2017-10-30 12:37:13 -07:00
Andrew Casey d8aafeef0a Add regression test for #19395
Thanks to @mjbvz for finding it and @sandersn for reducing it.
2017-10-30 11:21:22 -07:00
Andy 212efd5c7b
In quick info, show all jsdoc tags (#19357) 2017-10-30 10:27:19 -07:00
Andy 9c96eee7a4 Support completion details for special JsDoc completions (#19494) 2017-10-26 10:58:33 -07:00
Andy 9615e54e13 Support multiple completions with the same name but different source module (#19455)
* Support multiple completions with the same name but different source module

* Use optional parameters for source

* Simplify use of `uniques`

* Update test

* Fix `undefined` error
2017-10-26 08:22:17 -07:00
Armando Aguirre c62f2880cb Merge branch 'AddDefinitionAndBoundSpan' of https://github.com/armanio123/TypeScript into AddDefinitionAndBoundSpan 2017-10-24 14:02:41 -07:00
Armando Aguirre 7f577dcef3 Added triple slash support 2017-10-24 14:02:02 -07:00
Armando Aguirre ae266f6aa1 Merge branch 'master' into AddDefinitionAndBoundSpan 2017-10-24 11:18:07 -07:00
Andrew Casey 1b6e991924 Demote some extraction ranges to produce better results
Attempt to extract return expressions, rather than return statements, and
initializers, rather than variable declarations.
2017-10-24 11:13:49 -07:00
Ron Buckton a0412da4fa Merge branch 'master' into fix19349 2017-10-23 14:51:05 -07:00
Andy f916e38015 For @types installing quickfix, only activate for implicit-any module (#19394) 2017-10-23 13:36:36 -07:00
Ron Buckton a31ce789f4 Remove escaped names of well known symbols from string completions 2017-10-21 17:19:46 -07:00
Armando Aguirre 16c3255988 Updated an incredible amount of tests. 2017-10-18 15:49:46 -07:00
Andy e5f8287e5c findAllRefs: Support anonymous default export (#19302) 2017-10-18 15:46:39 -07:00
Nathan Shively-Sanders b40e18df00 Merge pull request #19304 from Microsoft/dedupe-jsdoc-annotation-refactors
Fixes for refactor "Annotate with type from JSDoc"
2017-10-18 14:50:13 -07:00
Nathan Shively-Sanders c13506e70c Update annotateWithTypeFromJSDoc tests
1. Object literals are single-line now.
2. Index signatures transform to TS index signatures.
3. The refactoring is only available when it could add types.
2017-10-18 13:04:13 -07:00
Andy 3220ebc182 Disambiguate same-named refactors using description (#19267)
Disambiguate same-named refactors using actionName
2017-10-18 10:23:18 -07:00
Mohamed Hegazy 0c1730a218 Fix #19257: Ensure a generated signature has a return type (#19264)
* Fix #19257: Ensure a generated signature has a return type

* Ensure generated properties have types

* Use the same context for multiple inferences to the same property access
2017-10-17 16:51:22 -07:00
Nathan Shively-Sanders e962e4abfb Update baselines 2017-10-17 16:35:28 -07:00
Andy d05443bb1d Add quickfix and refactoring to install @types packages (#19130)
* Add quickfix and refactoring to install @types packages

* Move `validatePackageName` to `jsTyping.ts`

* Remove combinePaths overloads

* Respond to code review

* Update api baselines

* Use native PromiseConstructor

* Return false instead of undefined

* Remove getProjectRootPath

* Update api
2017-10-17 15:04:09 -07:00
Andy 2b566b9a53 Add exported members of all project files in the global completion list (#19069)
* checker.ts: Remove null check on symbols

* tsserverProjectSystem.ts: add two tests

* client.ts, completions.ts, types.ts: Add codeActions member to CompletionEntryDetails

* protocol.ts, session.ts: Add codeActions member to CompletionEntryDetails protocol

* protocol.ts, session.ts, types.ts: add hasAction to CompletionEntry

* session.ts, services.ts, types.ts: Add formattingOptions parameter to getCompletionEntryDetails

* completions.ts: define SymbolOriginInfo type

* completions.ts, services.ts: Add allSourceFiles parameter to getCompletionsAtPosition

* completions.ts, services.ts: Plumb allSourceFiles into new function getSymbolsFromOtherSourceFileExports inside getCompletionData

* completions.ts: add symbolToOriginInfoMap parameter to getCompletionEntriesFromSymbols and to return value of getCompletionData

* utilities.ts: Add getOtherModuleSymbols, getUniqueSymbolIdAsString, getUniqueSymbolId

* completions.ts: Set CompletionEntry.hasAction when symbol is found in symbolToOriginInfoMap (meaning there's an import action)

* completions.ts: Populate list with possible exports (implement getSymbolsFromOtherSourceFileExports)

* completions.ts, services.ts: Plumb host and rulesProvider into getCompletionEntryDetails

* completions.ts: Add TODO comment

* importFixes.ts: Add types ImportDeclarationMap and ImportCodeFixContext

* Move getImportDeclarations into getCodeActionForImport, immediately after the implementation

* importFixes.ts: Move createChangeTracker into getCodeActionForImport, immediately after getImportDeclarations

* importFixes.ts: Add convertToImportCodeFixContext function and reference it from the getCodeActions lambda

* importFixes.ts: Add context: ImportCodeFixContext parameter to getCodeActionForImport, update call sites, destructure it, use compilerOptions in getModuleSpecifierForNewImport

* importFixes.ts: Remove moduleSymbol parameter from getImportDeclarations and use the ambient one

* importFixes.ts: Use cachedImportDeclarations from context in getCodeActionForImport

* importFixes.ts: Move createCodeAction out, immediately above convertToImportCodeFixContext

* Move the declaration for lastImportDeclaration out of the getCodeActions lambda into getCodeActionForImport

* importFixes.ts: Use symbolToken in getCodeActionForImport

* importFixes.ts: Remove useCaseSensitiveFileNames altogether from getCodeActions lambda

* importFixes.ts: Remove local getUniqueSymbolId function and add checker parameter to calls to it

* importFixes.ts: Move getCodeActionForImport out into an export, immediately below convertToImportCodeFixContext

* completions.ts: In getCompletionEntryDetails, if there's symbolOriginInfo, call getCodeActionForImport

* importFixes.ts: Create and use importFixContext within getCodeActions lambda

* importFixes.ts: Use local newLineCharacter instead of context.newLineCharacter in getCodeActionForImport

* importFixes.ts: Use local host instead of context.host in getCodeActionForImport

* importFixes.ts: Remove dummy getCanonicalFileName line

* Filter symbols after gathering exports instead of before

* Lint

* Test, fix bugs, refactor

* Suggestions from code review

* Update api baseline

* Fix bug if previousToken is not an Identifier

* Replace `startsWith` with `stringContainsCharactersInOrder`
2017-10-17 10:20:11 -07:00
Arthur Ozga 63074bcba0 Merge pull request #16695 from aozgaa/fixIifeIndentation
Fix indentation for function argument in call expression
2017-10-16 14:03:25 -07:00
Mohamed Hegazy 1f63fbbc08 Merge branch 'fix11857' of https://github.com/RyanCavanaugh/TypeScript into RyanCavanaugh-fix11857 2017-10-14 11:31:39 -07:00
Andy 769d202d4c In getContextuallyTypedParameterType, skip a this parameter when counting parameter index (#19155) 2017-10-13 14:53:52 -07:00
Nathan Shively-Sanders 22769d95e1 Merge pull request #18747 from Microsoft/refactor-jsdoc-types-to-typescript
Refactor jsdoc types to typescript
2017-10-13 10:21:54 -07:00
Nathan Shively-Sanders c83daa6481 JSDoc->type refactor:Renames+improve never handling 2017-10-13 09:38:01 -07:00
Nathan Shively-Sanders f35764d4ec Fix duplicated JSDoc comments
Incorporate suppressLeadingAndTrailingTrivia just added by @amcasey.
2017-10-12 14:28:34 -07:00
Andrew Casey 2ea4cfe23b Insert a line break before a function at EOF if needed
This is a pre-existing issue that became more obvious after refining
trivia handling.
2017-10-12 14:19:36 -07:00
Nathan Shively-Sanders c2c18a8d06 Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-12 14:18:28 -07:00
Nathan Shively-Sanders b440d75bc4 Test refactor of JSDoc @template tag 2017-10-12 11:40:40 -07:00
Andrew Casey 4de6b0dd2d Introduce and consume suppressLeadingAndTrailingTrivia
Fixes #18626
2017-10-12 11:34:34 -07:00
Andrew Casey b12947a35b Merge pull request #18931 from amcasey/ExtractConstantThis
Allow Extract Constant into enclosing scope in spite of RangeFacts.UsesThis
2017-10-12 11:25:00 -07:00
Mohamed Hegazy 260d37e8ea Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-12 10:23:21 -07:00
Mohamed Hegazy 4487917f89 Quick fix for no-implicit-any errors to add explicit type annotation (#14786)
* Infer from usage quick fix

* Change full function singature

* Add property/element access support

* Fix a few issues

* Some cleanup

* Expose getArrayType and getPromiseType

* Switch to collecting all usage before infering

* Infer array and promise type arguments

* Handel enums in binary operators

* consolidate usage of addCandidateTypes

* Handel rest paramters

* Properly handel `+=` and `+` inference for numbers and strings

* Add print quickfixes debug helper

* Add rest param tests

* Add optional paramter tests

* Handel set accessors

* Support getters

* Support no implicit any error for variable at use site

* Support properties

* Only offer quick fix if an infered type other than any is available

* Rename functions

* Move to a separate namespace

* Check cancellation token

* Cleanup

* Check for accesibile symbols where serializing types

* Remove JS support

* Reorganize functions

* Mark APIs as internal

* Fix lint errors

* Removed conflict markers.

* Update 'createSymbol' to use '__String'.

* Fixed most problems relating to '__String' and 'includeJsDocComments' in the fix itself.

* Addressed most API changes.

* Make all helpers internal

* Use a diffrent writer and not the built-in single line write

* Infer types for all parameters in a parameter list instead of one at a time

* Accept baselines

* Code review commments

* Respond to code review comments
2017-10-12 10:14:58 -07:00
Andrew Casey 73826bdb7b Allow Extract Constant into enclosing scope in spite of RangeFacts.UsesThis 2017-10-12 09:32:05 -07:00
Andrew Casey 568c8a3298 Allow extraction of variable decls used outside the extracted range
If there are only declarations, use the new function as the initializer
for a destructuring declaration.

If there are declarations and writes, changes all of the `const`
declarations to `let` and add `| undefined` onto any explicit types.
Use destructuring assignment to accomplish both "initialization" and
writes.

I don't believe there is a case where there are both declarations and a
return (since the declarations wouldn't be available after the return).

UNDONE: this could probably be generalized to handle binding patterns
but,
for now, only identifiers are supported.

Fixes #18242
Fixes #18855
2017-10-11 16:38:38 -07:00
Nathan Shively-Sanders d7424b00b2 Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-11 13:41:45 -07:00
Nathan Shively-Sanders 1a1c1f9e93 Add and update jsdoc annotation refactoring tests 2017-10-11 13:34:16 -07:00
Charles Pierce 576bd8c25f Ensure Async Modifier is maintained through ES6 Class Conversion (#19092) 2017-10-11 09:04:51 -07:00
Sheetal Nandi 61dd815ebc Merge pull request #19072 from Microsoft/completionInClassMember
Handle the case of completion of class member when member name is being edited
2017-10-10 15:45:11 -07:00
Charles Pierce 249c2cbaf7 Maintain Export Modifier when Refactoring to ES6 Class #18435 (#19070) 2017-10-10 15:39:59 -07:00