Commit Graph

2859 Commits

Author SHA1 Message Date
Mohamed Hegazy
e07e2e0e1f Merge pull request #23423 from Kingwl/add-braces
add support for add or remove braces to arrow function
2018-06-11 13:09:38 -07:00
Andy
7df81311ac goToDefinition: Don't add duplicate definitions for VariableDeclaration and ArrowFunction at f = () => {} (#24863) 2018-06-11 11:20:34 -07:00
Andy
1aad3c6273 addClassStaticThisReferences: Don't cross class boundary (#24860) 2018-06-11 10:51:11 -07:00
Andy
986532d36b Fix bug: In findAllReferences, don't crash on static method missing body (#24814) 2018-06-11 08:43:17 -07:00
Andy
04187bde8d fixStrictClassInitialization: Support array initializer (#24810) 2018-06-08 15:56:56 -07:00
Andy
e821d613a1 fixUnusedIdentifier: Remove unused writes (#24805) 2018-06-08 15:20:33 -07:00
Andy
855c3a6d4f fixUnusedIdentifier: Delete trailing comma in array binding pattern (#24800) 2018-06-08 10:39:01 -07:00
kingwl
0d730c008a Merge branch 'master' into add-braces 2018-06-09 01:32:53 +08:00
Mohamed Hegazy
b4dea5ecce Merge pull request #24760 from krk/codefix-asterisk
addMethodDeclaration codefix creates a generator function when target…
2018-06-08 08:57:49 -07:00
Andy
3822e3e4ed tryGetModuleNameAsNodeModule: Ignore file extension (#24774) 2018-06-07 15:45:03 -07:00
Andy
48dedacf3b fixStrictClassInitialization: Don't provide a default for string or number (#24767)
* fixStrictClassInitialization: Don't provide a default for `string` or `number`

* Update baselines
2018-06-07 15:03:38 -07:00
Andy
33d0893259 Add completions from literal contextual types (#24674)
* Add completions from literal contextual types

* Remove getTypesOfUnion

* undo baseline changes
2018-06-07 15:03:19 -07:00
Andy
fde6f22408 Fix bug: In newFileChanges, setParentNodes in new source file (#24765) 2018-06-07 14:28:06 -07:00
Andy
87217018b8 Add 'nameSpan' property to NavigationTree (#24698) 2018-06-07 12:43:57 -07:00
Andy
0fefaf286d moveToNewFile: Infer quote preference (#24652) 2018-06-07 12:10:48 -07:00
Andy
83c58a4fb5 Don't consider x. a new identifier location just because x has a number index signature (#24699)
* Don't consider `x.` a new identifier location just because x has a number index signature

* Update more tests
2018-06-07 12:05:47 -07:00
krk
acbda14450 addMethodDeclaration codefix creates a generator function when target is child of a YieldExpression, resolves #24728 2018-06-07 20:59:06 +03:00
Andy
735a46f838 If parsing a function type fails, parseTypeReference() to ensure something is returned (#24567)
* If parsing a function type fails, parseTypeReference() to ensure something is returned

* Avoid tryParse

* Add missing semicolon

* Don't check for undefined, check for missing type

* Don't set parameters undefined, set to missingList and return false

* Update API baselines

* Code review
2018-06-05 10:24:37 -07:00
Andy
a641e6f85f goToDefinition: Put variable definition before signature definition (#24649)
* goToDefinition: Put variable definition before signature definition

* Fix lint
2018-06-04 14:13:27 -07:00
Nathan Shively-Sanders
34e68efdae Template tag allows specification of constraints (#24600)
* Parse (and mostly support) template tag constraints

A bunch of tests hit the asserts I added though.

* Messy version is finished. Need to add a few tests

* Refactor to be smaller

* Small refactor + Add one test

* Another test

* Minor cleanup

* Fix error reporting on type parameters on ctors

* Simplify syntax of `@template` tag

This is a breaking change, but in my sample, nobody except webpack used the
erroneous syntax. I need to improve the error message, so
jsdocTemplateTag3 currently fails to remind me of that.

* Better error message for template tag

* Fix fourslash baselines

* Another fourslash update

* Address PR comments

* Simplify getEffectiveTypeParameterDeclarations

Make checkGrammarConstructorTypeParameters do a little more work
2018-06-04 11:42:46 -07:00
Andy
2ce7e5f0cd Add 'unknown' to type keywords (#24606) 2018-06-04 11:31:48 -07:00
Andy
d8cea359f7 moveToNewFile: Update namespace imports (#24612) 2018-06-04 11:30:14 -07:00
Andy
046c5ea6c1 moveToNewFile: Ignore reference to global (#24651) 2018-06-04 10:35:23 -07:00
Andy
886377f8d3 Add autoCloseTag language service (#24543)
* Add autoCloseTag language service

* Change name to getJsxClosingTagAtPosition and return an object
2018-06-04 10:08:15 -07:00
Dan Freeman
4a36ee0c62 Support import completion for merged declaration exports (#24539) 2018-06-01 09:46:56 -07:00
Andy
d671c7ae96 getEditsForFileRename: Support directory rename (#24305)
* getEditsForFileRename: Support directory rename

* Code review

* Handle imports inside the new file/directory

* Document path updaters

* Shorten relative paths where possible

* Reduce duplicate code

* Rewrite, use moduleSpecifiers.ts to get module specifiers from scratch instead of updating relative paths

* Update additional tsconfig.json fields

* Add test with '.js' extension

* Handle case-insensitive paths

* Better tsconfig handling

* Handle properties inside compilerOptions

* Use getOptionFromName
2018-06-01 08:23:37 -07:00
Zen
95df51b7cf remove redundant assertions in fourslash tests (#24561) 2018-06-01 08:16:03 -07:00
Andy
9d42ab983d implementations: Use declaration name for the span (#24537)
* implementations: Use declaration name for the span

* Always get name in nodeEntry
2018-05-31 13:32:02 -07:00
Zzzen
2a8ff1c8d9 Merge remote-tracking branch 'ms/master' 2018-05-31 20:49:43 +08:00
Andy
2cb46407b1 moveToNewFile: Remove newlines after last moved statement (#24503) 2018-05-30 15:16:03 -07:00
Vyacheslav Pukhanov
75f20f9b65 fixUnusedIdentifier: fix "Remove variable statement" codefix (#24497)
* fixUnusedIdentifier: fix "Remove variable statement" codefix

* Add test for a single "Remove variable statement" codefix in a file
2018-05-30 14:51:08 -07:00
Nathan Shively-Sanders
cdfa63aa40 Fix exported type resolution in commonjs (#24495)
* Fix resolution of exported types in commonjs

It is fine to resolve the types of exported classes in ES6:

```js
export class C {
}
var c = new C()
```

But not for commonjs exported classes:

```js
module.exports.C = class {
}
var c = new C() // should error
```

Fixes #24492

* All jsdoc type aliases are available locally in commonjs modules

* Check that location isSourceFile before commonJsModuleIndicator
2018-05-30 14:12:38 -07:00
Andy
43bf039a94 Add refactor to convert namespace to named imports and back (#24469)
* Add refactor to convert namespace to named imports and back

* Add tests and comments

* Code review

* Handle shorthand property assignment and re-export

* Don't use forEachFreeIdentifier

* Fix rename after "."
2018-05-30 14:11:53 -07:00
Andy
77371679be Support getting references even if quickInfo failed (#24476)
* Support getting references even if quickInfo failed

* Add test
2018-05-30 14:11:36 -07:00
Mohamed Hegazy
c47df3a8fd Merge pull request #24438 from vpukhanov/issue-22674
addMethodDeclaration: add after quickfix location if possible
2018-05-30 10:30:01 -07:00
Mohamed Hegazy
04dc76ec9c Merge pull request #24442 from Kingwl/fix-implement-interface-with-extends-class
add lookup for extends class when implement interface
2018-05-30 09:20:50 -07:00
Andy
5e2c7ffce6 isValidMethodAccess: use getTypeOfPropertyOfType instead of getTypeOfFuncClassEnumModule (#24488) 2018-05-30 09:12:24 -07:00
Andy
011a4df4dd Don't allow to rename string literal (#24477) 2018-05-30 07:50:48 -07:00
王文璐
2cb211305b Merge branch 'master' into fix-implement-interface-with-extends-class 2018-05-30 09:05:56 +08:00
Andy
e99be8c47d Avoid duplicate import completions when a namespace is exported by two different modules (#24473) 2018-05-29 15:52:34 -07:00
Andy
8bc1932ed5 moduleSpecifiers: Don't return a relative path to node_modules (#24460) 2018-05-29 12:40:06 -07:00
Andy
160b667846 fixUnusedIdentifier: Don't remove parameter in override or non-last parameter in callback (#24306)
* fixUnusedIdentifier: Don't remove parameter in override or non-last parameter in callback

* Only allow removing last parameters; don't care about contextual type
2018-05-29 12:39:45 -07:00
Andy
816f1cee5a Include '...' on doc comment for rest parameter (#24462) 2018-05-29 12:17:57 -07:00
王文璐
f9a55beec5 add lookup for extends class when implement interface 2018-05-28 18:38:07 +08:00
Vyacheslav Pukhanov
1bc5977e3a Update undeclared method quickfix tests 2018-05-28 00:09:47 +03:00
Zzzen
dbe87a6741 Document highlights on yield keywords highlight other occurrences in the same body 2018-05-25 20:48:08 +08:00
王文璐
590476bf06 add more test and fix others 2018-05-25 10:25:52 +08:00
Wesley Wigham
8f9c0861bc Use external aliases in quickinfo and signature help return types (#24391)
* Dont include import types in quick info type names

* Add UseAliasDefinedOutsideCurrentScope flag to LS operations which were missing it
2018-05-24 15:19:57 -07:00
Elizabeth Dinella
b745ea059e Fix to issue 23326 for completions on new.target (#24342)
* Fix to issue 23326 for completions on new.target

* Fixed linting issues - whitespace in if statements

* Removed debug statement in test case and consolidated and cleaned up code in switch statement for completions

* Added support for import.meta completion
2018-05-24 14:12:33 -07:00
Andy
16af96b006 moveToNewFile: Format the new file (#24379) 2018-05-24 11:08:32 -07:00