Commit Graph

4729 Commits

Author SHA1 Message Date
Andy
cea49dfb0d Completion for tuple index doesn't need to include quotes (#26750) 2018-08-29 16:38:42 -07:00
Andy
f78dc2ad11 importFixes: Only provide a fix using the best module specifier for a given module (#26738) 2018-08-29 16:18:56 -07:00
Andy
02630273a2 codeFixInferFromUsage: Assume that using x[0] means that x is an array (#26739)
* codeFixInferFromUsage: Assume that using `x[0]` means that `x` is an array

* Remove unnecessary '||' with non-falsy LHS

If only there were some kind of type-checker for JavaScript that could detect this sort of thing
2018-08-29 11:37:31 -07:00
Andy
0feeb48783 Make generator function name a completion list blocker (#26640)
* Make generator function name a completion list blocker

* Improvements for class/object members

* Separate KeywordCompletionFilter.None and .All
2018-08-29 10:53:32 -07:00
Andy
9106fdbc47 Support signature help for type parameters of a type (#26702) 2018-08-28 14:21:09 -07:00
Andy
552bd1c8a2 Support import fix/completions for export = (#25708) 2018-08-28 13:04:11 -07:00
Andy
b94061c587 getEditsForFileRename: Avoid changing import specifier ending (#26177)
* getEditsForFileRename: Avoid changing import specifier ending

* Support .json and .jsx extensions

* Restore typeRoots tests

* Fix json test

* When --jsx preserve is set, import ".tsx" file with ".jsx" extension

* Support ending preference in UserPreferences
2018-08-28 13:03:24 -07:00
Andy
b183418124 Fix bug: Don't go to *any* constructor signature for jsx element (#26715) 2018-08-28 11:06:14 -07:00
Andy
4cf5774c5e Add tsserver test for completions and avoid excess properties (#25622) 2018-08-27 16:04:02 -07:00
Andy
e411381266 Fix bug: Don't let empty signature documentation override other documentation (#26638) 2018-08-27 09:38:52 -07:00
Wenlu Wang
8ba501926a try get add missing member return type from context (#26250)
* try get add missing member return type from context

* support contextual type
2018-08-23 21:31:53 -07:00
Andy
f3ceebe552 Fix duplicate completions bugs (#26648)
* Fix duplicate completions bugs

* Remove old TODO
2018-08-23 18:22:07 -07:00
David Sherret
0baf7465a5 Remove todo. 2018-08-21 13:29:32 -04:00
David Sherret
d00ad19bd7 Provide a default script target for the document registry. 2018-08-20 20:59:06 -04:00
Andy
ee25cdecbc Update LKG and remove newly unnecessary non-null assertions (#26515) 2018-08-17 09:13:43 -07:00
Andy
ad63468ed5 noUnusedLocals: f(x = 1) does not use x (#26366) 2018-08-13 11:14:52 -07:00
Sheetal Nandi
2b83b67aa3 Merge pull request #26140 from Kingwl/completionUnionType
improve completions for union type in type arguments
2018-08-13 10:36:19 -07:00
Elizabeth Dinella
421730a68d Refactoring promises returning functions to use async and await (#26373) 2018-08-10 16:11:45 -07:00
Andy
08f5edbd03 Treat NoSubstitutionTemplateLiteral like StringLiteral in more places (#26330)
* Treat NoSubstitutionTemplateLiteral like StringLiteral in more places

* Move isStringOrNumericLiteral closer to its only use
2018-08-10 16:00:08 -07:00
Andy
4bb740218d getDefaultExportInfo: Use getImmediateAliasedSymbol instead of getAliasedSymbol (#26364) 2018-08-10 14:35:18 -07:00
Andy
5efd1cb4a7 fixAddMissingMember: Support interface and don't crash on type parameter (#25995)
* fixAddMissingMember: Support interface and don't crash on type parameter

* Remove InfoBase
2018-08-09 17:32:28 -07:00
王文璐
23601a10b8 improve completions for union type in type arguments 2018-08-09 17:26:34 +08:00
Andy
1a05f13aef moveToNewFile: Don't remove empty named imports (#26265) 2018-08-07 12:54:46 -07:00
Andy
794f3a5e76 goToTypeDefinition: Go to function return type (#25952)
* goToTypeDefinition: Go to function return type

* Add more tests

* If a function returns 'void' or some other type with no definition, just return the function definition.
2018-08-07 12:54:19 -07:00
Andy
937afab4b0 Support signature help for contextual parameter type (#26022) 2018-08-06 16:46:30 -07:00
Andy
d0ed21cad1 completions: 'true' and 'false' are type keywords (#26237) 2018-08-06 12:42:56 -07:00
Andy
9c9f3e3cf9 importFixes: When one file redirects to another, consider both for global import specifiers (#25834)
* importFixes: When one file redirects to another, consider both for global import specifiers

* Add test for #26044

* Avoid a symlinked package globally importing itself (fixes another case of #26044)

* Compare to node_modules with getCanonicalFileName
2018-07-31 17:28:56 -07:00
Andy
f326b4b7cb Make import fix for default import mention that it's a default import (#26105) 2018-07-31 17:28:35 -07:00
Andy
0d1a49c865 Ignore trailing comma when resolving signature for quick info (#25841)
* Ignore trailing comma when resolving signature for quick info

* Add test for signature help
2018-07-31 11:39:39 -07:00
Andy
5e1872f0c0 getDocCommentTemplateAtPosition: Return result if in empty comment (#26026) 2018-07-27 17:34:16 -07:00
Andy
57d425169a createJavaScriptSignatureHelpItems: Use array helpers and simplify (#26025) 2018-07-27 17:33:17 -07:00
Andy
d40d54984e Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
Andy
3bfe91cdd8 navigationBar: Fix bug for shorthand ambient module (#25992) 2018-07-26 17:27:12 -07:00
Andy
af3f737451 Fix bug for isValidTrigger when contextToken is undefined (#25993) 2018-07-26 17:26:58 -07:00
Andy
0e5af11625 Fix bugs for go-to-definition on mapped type method (#25991) 2018-07-26 17:26:41 -07:00
Andy
998c911c49 Break createSignatureHelpItems into functions (#25948) 2018-07-26 17:26:29 -07:00
Andy
0227997fa5 Use import().T for import completions/fixes of pure types in JS files (#25852)
* Use `import().T` for import completions/fixes of pure types in JS files

* Don't call tryUseExistingNamespaceImport if position undefined
2018-07-26 16:16:57 -07:00
Andy
673ae746da Simplify and inline getPropertySymbolsFromType (#25940)
* Simplify and inline getPropertySymbolsFromType

* Combine lambdas
2018-07-26 11:52:22 -07:00
Andy
f12e9a8389 Minor refactor in goToTypeDefinition (#25951) 2018-07-25 17:10:06 -07:00
Andy
1e8a5bf2f1 signatureHelp: Factor out 'isSyntacticOwner' function (#25518) 2018-07-25 17:01:35 -07:00
Andy
7546fd03c6 Simplify getContainers (#23323) 2018-07-25 12:30:13 -07:00
Andy
d60f4988a6 In getPropertySymbolsFromContextualType, use union discriminant to filter types (#25914) 2018-07-25 11:53:20 -07:00
Nathan Shively-Sanders
9658b476c2 Fix inferFromUsage on index signatures (#25934)
* Fix inferFromUsage on index signatures

1. Check the argumentExpression to determine the index signature type.
Previously, the code mistakenly checked the type of the element access
itself, which never returned a good type.
2. If inference for the index signature type fails, substitute anyType.
Previously, the code would create a bad index signature with an
undefined type.
3. Add tests. Previously, there were no tests.

* Fixing (1) means that number index signatures are now created.
Previously, only string index signatures would be created.
* Fixing (2) means that index signatures will be inferred from single
usage like `return a[0]`. Previously, the refactoring would fail,
perhaps because of a check when stringifying the index signature (I
haven't tracked down why.)

* Update fourslash test with improved inference
2018-07-25 10:51:11 -07:00
Andy
e4d4b0ae4b Handle PropertyAssignment in getCommentOwnerInfo (#25911) 2018-07-24 17:43:46 -07:00
Andy
93722c8942 findAllReferences/rename: Search in all open projects (#25648)
* findAllReferences/rename: Search in all open projects

* Avoid needing a dummy location when location is unused

* Remove Program#getDeclarationEmitPath

* Only iterate over enabled projects
2018-07-20 16:53:59 -07:00
Andy
3d672d9550 Ensure fixSpelling and importFixes still trigger on "Did you mean the instance/static member ..." (#25847) 2018-07-20 16:51:35 -07:00
Andy
e103692f32 Don't report quickInfo inside a comment in a PropertyAccessExpression (#25813) 2018-07-20 11:49:21 -07:00
Wenlu Wang
fedcd3a1b4 improve completions keyword for function like body (#25824) 2018-07-20 08:25:16 -07:00
Andy
46827f4a76 Handle completions at name of namespace declaration (#25661)
* Handle completions at name of namespace declaration

* Handle namespace merging
2018-07-19 10:26:18 -07:00
Andy
854462d383 Fix formatting at trailing comma (#25706) 2018-07-17 15:21:35 -07:00