Commit Graph
2673 Commits
Author SHA1 Message Date
Andy 59765e2d86 goToDefinition: Also add definitions for symbol if it does not match the signature symbol (#23657) 2018-04-24 09:41:47 -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 fc30bd10e3 Suggestion to convert to ES6 module should only trigger in projects which express some intent to use ES6 (#23576) 2018-04-23 16:05:37 -07:00
Nathan Shively-Sanders 905f9a02ad module.exports = Entity is an alias, just like export = Entity (#23570)
* Make `module.export =` an alias like `export=` is

This breaks a couple of tests for previous workarounds. Fix in upcoming
commits.

* Basically fixes all the breaks, but needs cleanup

* More notes to myself

* Clean up TODOs

* Call mergeSymbolTable and delete export= afterward

instead of basically copying the code myself.

* More cleanup

* Remove unnecessary check in import type checking

* Revert to DIY code.

It is more correct and will go away in a few days.

* Exported class expressions can be used as type

In both JS and TS

* Do not require named class expressions
2018-04-23 15:24:31 -07:00
Andy 222f35d927 Make symbol display at ExportSpecifier use 'export', not 'import' (#23629) 2018-04-23 13:29:14 -07:00
Andy 645258cc7d Allow getting import completion details with misspelled name (#23624) 2018-04-23 11:24:51 -07:00
Andy 2e78d1ef21 getEditsForFileRename: Update tsconfig "files" (#23625) 2018-04-23 11:11:06 -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 22f2b118b7 Add 'triggerCharacter' option for completions requests (#23491)
* Add 'triggerCharacter' option for completions requests

* mhegazy code review

* More code review

* Handle '<' in comment
2018-04-20 10:25:58 -07:00
Andy 94cc59ca60 Support getting JSDoc comment starting at a FunctionType node (#23546)
* Support getting JSDoc comment starting at a FunctionType node

* Move || to end of line
2018-04-20 09:43:20 -07:00
Nathan Shively-Sanders 8d969a23cb In JS, class supports @template tag for declaring type parameters (#23511)
* Support @template as a class type parameter

Still need to do the following:
1. Correctly get jsdoc host in predicate.
2. Make this work for constructor functions too.
3. Scan rest of codebase for other usages of the type parameters
property that should be calls to getEffectiveTypeParameterDeclarations.
4. Rename tp to something more readable, like typar or ts'.

* Use jsdoc host declaration to find container

* Longer names for type parameters

* Fix renaming operation

* Update fourslash test

* Support @template for JS constructors

* Look for both outer and tag type parameters

* Improve naming to improve code clarity
2018-04-19 15:58:43 -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 c258d6e1b6 Fix bug: Don't rename 'default' in export { default as x } from "m"; (#23434)
* Fix bug: Don't rename 'default' in `export { default as x } from "m";`

* Rename `foo` in `{ default as foo }` if that's the original export name
2018-04-19 15:35:25 -07:00
Andy bc7979c174 quickInfo: Get JSDoc tags from aliased symbol (#23526)
* quickInfo: Get JSDoc tags from aliased symbol

* Add test with existing tags
2018-04-19 15:33:36 -07:00
Andy f5101e21c3 Find-all-references: Don't crash on 'typeof import' (#23448)
* Find-all-references: Don't crash on 'typeof import'

* Move `| ImportTypeNode` out of `AnyImportOrReExport`
2018-04-17 15:01:36 -07:00
Andy d1fde3786c Symbol kind for a method on a mapped type should still be 'method' (#23478) 2018-04-17 14:07:59 -07:00
Andy b00e370605 Add '?' in quick info for optional properties/methods (#23480) 2018-04-17 12:42:23 -07:00
Benjamin Lichtman 48f98bdd4d Merge pull request #23452 from uniqueiniquity/normalizeDocumentHighlightsPaths
Normalize document highlights paths
2018-04-17 12:31:00 -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 bc285aa9a1 findAllReferences: Mark *every* search symbol as seen, not just search.symbol (#23451) 2018-04-17 07:53:43 -07:00
Andy 40fd6aebdc Shrink span for convert-to-es6-module suggestion (#23441) 2018-04-16 16:46:27 -07:00
Benjamin Lichtman 221ac50c4c Merge pull request #23437 from Microsoft/getOutliningSpansDepthElseIf
In outliningElementsCollector, treat 'else if' as having same depth as the 'if'
2018-04-16 16:25:57 -07:00
uniqueiniquity e9d6f788ca Add test 2018-04-16 15:59:22 -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
Andy Hanson a60caba467 In outliningElementsCollector, treat 'else if' as having same depth as the 'if' 2018-04-16 11:33:30 -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 d36f83a98d Remove TODO: GH#18795 comments (#23337) 2018-04-11 16:23:04 -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
Andy f6b206a75a When testing references, also test documentHighlights respects filesToSearch (#23306)
* When testing references, also test documentHighlights respects filesToSearch

* Fix handling for redirects and move assertion inside getDocumentHighlights

* Add another assert
2018-04-11 14:07:22 -07:00
Wenlu Wang 9c0671d661 add refactor of convert private field to getter and setter (#22143)
* add refactor of convert private field to getter and setter

* fix refactor

* stash

* refactor accessor generate

* revert merge union type

* refeactor and accept baseline

* add support of PropertyAssignment and StringLiteral

* add support for js file

* allow static modifier in js file
2018-04-10 11:51:41 -07:00
Andy ce5d22fef0 Fix bug: don't insert a semicolon when inserting a FunctionDeclaration (#23240) 2018-04-09 15:03:24 -07:00
Andy 98a5e5cc0d Prioritize spelling fix over add-missing-member fix (#23268) 2018-04-09 13:23:11 -07:00
Andy 998beadba2 Support goto-definition for index signatures (#23220)
* Support goto-definition for index signatures

* Use checker.getIndexInfoOfType

* Handle undefined info.declaration
2018-04-09 12:48:41 -07:00
Andy 9762598775 findAllReferences: forEachRelatedSymbol can always include shorthand destructuring (#23223)
* findAllReferences: forEachRelatedSymbol can always include shorthand destructuring

* Update rename tests
2018-04-06 16:30:55 -07:00
Andy 70682b7799 Clean up code for nonrelative path completions (#23150)
* Clean up code for nonrelative path completions

* Remove unnecessary test and simplify based on that

* More code review

* Call getCompletionEntriesFromTypings unconditionally
2018-04-06 12:19:08 -07:00
Andy 05cd784230 Remove unnecessary test file (#23214) 2018-04-06 10:45:01 -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 aa8631de98 findAllReferences: Share code between populateSearchSymbolSet and getRelatedSymbol (#23028) 2018-04-05 15:00:14 -07:00
Andy 24842b4002 When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00
Andy f61f12613c findAllReferences: Be consistent how we handle unions in root symobls (#23002) 2018-04-05 10:55:55 -07:00
Andy 7520f9578b Fix bug: <div a="1" b/**/ > is not a jsx initializer (#23138) 2018-04-05 08:30:02 -07:00
Nathan Shively-Sanders dca3a94f88 Print js-constructor function type names (#23089)
* Print js-constructor function type names

Instead of printing them as a type literal, which is scary.

* Use assigned name for functions and classes

That otherwise have no name. This helps quick info for javascript a
*lot*. Typescript mainly benefits when printing the type of class
expressions.

* Improve names of functions in binding elements

Also fix some fourslash baselines
2018-04-04 15:43:41 -07:00
Andy 4aeb295e3a completions: Properly handle preferences.includeCompletionsWithInsertText (#23092) 2018-04-04 08:36:48 -07:00
Mohamed Hegazy db74229a89 Merge pull request #19317 from igelbox/fix-insert-space-after-function-generic
Fixed incorrect insertSpaceBeforeFunctionParenthesis behavior on funtions with type-arguments
2018-04-03 16:11:30 -07:00
Mohamed Hegazy 84548d5c9b Merge pull request #22049 from Kingwl/spelling-fix
replace element access if suggession is not a valid identifier
2018-04-03 13:29:43 -07:00
Wesley Wigham a81a645128 Enable member completions for import types (#23085)
* Enable member completions for import types

* Add missing semicolon

* Compact statements

* Ye doth compacteth too much

* Handle class accesibility
2018-04-03 11:53:01 -07:00
王文璐 414266cc32 Merge branch 'master' into spelling-fix 2018-04-03 10:51:40 +08:00
Andy 1e04bd4168 Support completions for members with symbol names (#23091) 2018-04-02 18:08:00 -07:00
Wesley Wigham fd553df3a6 Path completions for import types (#23082)
* Path completions

* Add missing flag to test

* Minify test, fix lint
2018-04-02 16:15:50 -07:00