2197 Commits

Author SHA1 Message Date
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
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
Sheetal Nandi
bce77fdfd9 Merge pull request #18960 from Microsoft/builderHandlesChangeInResolution
Builder handles changes in resolution/references when file's contents dont change
2017-10-11 12:11:44 -07:00
Wesley Wigham
17a1cd069d Add deprecation warning to getSymbolDisplayBuilder (#18953)
* Add deprecation warning to getSymbolDisplayBuilder

* Accept API baselines
2017-10-09 16:55:20 -07:00
Arthur Ozga
1db762356e Merge pull request #18706 from aozgaa/dev/aozgaa/JsDocExtendsSupport
support @extends in jsdoc
2017-10-09 15:08:58 -07:00
Andy
8a55baf9a3 In @typedef tag, handle property with no type (#19013) 2017-10-09 09:58:02 -07:00
Arthur Ozga
5ea3ca4ef9 Merge branch 'master' into dev/aozgaa/JsDocExtendsSupport 2017-10-06 14:25:31 -07:00
Sheetal Nandi
bf4ca30bc3 Let builder find out from imports/typereference directives if file references have changed.
This is needed to ensure that the ambient module addition takes effect
Fixes #15632
2017-10-04 18:09:09 -07:00
Daniel Rosenwasser
301c90ccff Merge pull request #18300 from Microsoft/correctlyCacheTaggedTemplates
Correctly cache tagged template objects in modules
2017-10-03 12:06:57 -07:00
Mohamed Hegazy
ae3f29ade6 Accept baselines (#18903) 2017-10-02 19:08:13 -07:00
Sheetal Nandi
6997e9b731 Merge pull request #17269 from Microsoft/watchImprovements
Watch improvements in tsserver
2017-10-02 17:38:22 -07:00
Andy
d620129d4a Ensure getResolvedSignature never returns undefined (#18883) 2017-10-02 17:02:27 -07:00
Sheetal Nandi
4bb4711eff Merge branch 'master' into watchImprovements 2017-10-02 16:34:43 -07:00
Sheetal Nandi
7f969e8138 Making APIs as internal so that we can enable them after we have figured out final details 2017-10-02 16:27:26 -07:00
Daniel Rosenwasser
b80b2eeaa3 Move first/last shortcuts closer to the end of the helper flags. 2017-10-02 13:23:57 -07:00
Daniel Rosenwasser
5da45fb6de Addressed code review feedback. 2017-09-29 17:16:50 -07:00
Anders Hejlsberg
936f98d9ad Addressing CR feedback 2017-09-29 16:01:14 -07:00
Sheetal Nandi
9e08caebf5 Merge branch 'master' into watchImprovements 2017-09-29 10:43:05 -07:00
Anders Hejlsberg
0756aa1753 Merge branch 'master' into strictFunctionTypes 2017-09-28 15:39:57 -07:00
Andy
1a2de721b5 Fixes to @augments handling (#18775)
* Fixes to @augments handling

* Renames and diagnostic changes

* Add test for < > characters

* Use more specific return type
2017-09-28 12:34:54 -07:00
Daniel Rosenwasser
b406d5453e git Merge branch 'master' into correctlyCacheTaggedTemplates 2017-09-27 17:32:38 -07:00
Daniel Rosenwasser
1841afeaa2 Ensure that the import helper is checked for tagged templates, and update its name. 2017-09-27 17:31:32 -07:00
Sheetal Nandi
68d360585a PR feedback 2017-09-26 16:21:15 -07:00
Adrian Leonhard
70087ed0d8 type WriteFileCallback: make param sourceFiles required. (#18731)
Fixes https://github.com/Microsoft/TypeScript/issues/15007
2017-09-25 17:22:26 -07:00
Anders Hejlsberg
91691f6079 Strict function type checking only for certain function types 2017-09-25 16:59:18 -07:00
Daniel Rosenwasser
1cb5eb9685 Merge branch 'master' into correctlyCacheTaggedTemplates 2017-09-25 16:23:06 -07:00
Sheetal Nandi
23acff5bc8 Merge branch 'master' into watchImprovements 2017-09-25 16:18:26 -07:00
Arthur Ozga
b21c46b9b5 support @extends in jsdoc 2017-09-22 16:21:31 -07:00
Filipe Silva
d0fd964b69 Fix getSourceFile return type (#18689) 2017-09-22 11:54:20 -07:00
Anders Hejlsberg
afc8a261cc Always perform structural comparison when variance check fails 2017-09-21 21:31:11 -07:00
Daniel Rosenwasser
9907453e5f Merge branch 'master' into correctlyCacheTaggedTemplates 2017-09-21 13:44:09 -07:00
Anders Hejlsberg
b58e0fba0c Add comments 2017-09-19 10:11:18 -07:00
Anders Hejlsberg
a0fa69ff6c Handle contravariance in type inference 2017-09-18 17:31:54 -07:00
Anders Hejlsberg
f8ff7f7365 Use dedicated marker types for variance determination 2017-09-18 13:36:46 -07:00
Anders Hejlsberg
12f5dd85d7 Introduce --strictFunctionTypes mode 2017-09-18 06:33:47 -07:00
Armando Aguirre
21bbdd33c5 Merge pull request #17415 from armanio123/FixRenameInDefaultLibrary
Excluded the default library from rename service.
2017-09-14 14:04:46 -07:00
Andy
89eb06e475 For completions of union, exclude types with methods (#18124)
For completions of union, exclude arrays
2017-09-14 12:37:38 -07:00
Armando Aguirre
b03fbaf313 Merge branch 'master' into FixRenameInDefaultLibrary 2017-09-14 12:01:31 -07:00
Andy
e91af7d30d Allow template string with no substitutions to be used as a string literal type (#18452) 2017-09-14 11:19:54 -07:00
Anders Hejlsberg
2077835ff7 Merge pull request #18438 from Microsoft/unionIntersectionUnit
Remove empty intersection types in unit types
2017-09-14 18:44:02 +01:00
Anders Hejlsberg
c64beb90df Remove intersections of object and nullable types from union types 2017-09-13 11:52:10 -07:00
Sheetal Nandi
b536f9dade Should not remove the reused resolutions in the file when file contents have not changed. 2017-09-12 12:09:06 -07:00
Sheetal Nandi
fdb104b242 Merge branch 'master' into watchImprovements 2017-09-11 13:49:36 -07:00
Nathan Shively-Sanders
d4e3e19763 Merge pull request #18333 from Microsoft/fix-forEachChild-JSDocTypedefTag
Fix forEachChild jsdoc `@typedef` tag
2017-09-08 08:52:46 -07:00
Nathan Shively-Sanders
fb5e8c6110 Fix forEachChild's visit of JSDocTypedefTag
Also remove JSDocTypeLiteral.jsdocTypeTag, which made no sense since it
was only useful when storing information for its parent `@typedef` tag.
2017-09-07 16:37:13 -07:00
Andy
2e02778960 When loading a module from node_modules, get packageId even in the loadModuleFromFile case (#18185)
* When loading a module from node_modules, get packageId even in the `loadModuleFromFile` case

* Support packageId for <reference types> too
2017-09-07 14:31:20 -07:00
Andy
ed4e2e6e3b Ensure that emitter calls callbacks (#18284)
* Ensure that emitter calls calbacks

* Move new parameter to end of parameters

* Fix for ConditionalExpression

* Make suggested changes to emitter

* Fix parameter ordering

* Respond to minor comments

* Remove potentially expensive assertion

* More emitter cleanup
2017-09-07 14:30:19 -07:00
Wesley Wigham
c1f2afd645 Add typedef declaration space, unify typedef name gathering (#18172)
* Add typedef declaration space, unify typedef name gathering, strengthen errorUnusedLocal

* Bonus round: make jsdoc presence way mroe typesafe

* Be exhaustive in nameForNamelessJSDocTypedef

* Remove nonrequired casts

* Replace more casts with guards

* Cannot be internal

* Debug.fail returns never, assert never no longer needs unreachable throw to satisfy checker

* Rename type

* Add replacement message as in 18287
2017-09-07 10:28:58 -07:00
Mohamed Hegazy
c82881f36e Fix build break 2017-09-07 09:36:31 -07:00
Klaus Meinhardt
a8dfdf2fa1 Add and fix some AST Node parent types (#18200) 2017-09-07 09:22:26 -07:00