Commit Graph

4610 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
5c2eeb20b1 Destructuring declaration prefers type annotation type (#25282)
* Destructuring declaration prefers type annotation type

Previously, getTypeForBindingElement would always union the declarations type and
the type of the default initializer. Now, if the declaration has a type
annotation, it does not union with the initializer type. The type
annotation's type is the one used.

* Small cleanup in parentDeclarationHasTypeAnnotation

* Refactoring based on PR comments

* Combine getCombined*Flags into a single helper function

Retain the individual functions since they are used a lot.

* Remove unneeded temp
2018-06-28 10:41:38 -07:00
Andy
fd8b7f3da5 Remove redundant checks in getNameOfDeclaration (#25244) 2018-06-27 13:56:31 -07:00
Andy
1cb691f52d findPrecedingToken: default includeJsDocComment to true (#25262)
* findPrecedingToken: default includeJsDocComment to true

* Add exception for smartIndenter
2018-06-27 12:14:41 -07:00
Andy
c9d44ce395 getTouchingToken: default includeJsDocComment to true (#25258) 2018-06-27 11:15:15 -07:00
Andy
c35cb86192 When renaming at a tsx opening/closing tag, just rename the current element (#25273) 2018-06-27 11:01:38 -07:00
Andy
d957b1c8c2 fixUnusedIdentifier: Remove arguments corresponding to unused parameters (#25011)
* fixUnusedIdentifier: Remove arguments corresponding to unused parameters

* Update API (#24966)

* Fix handling of deletions: Make a list of things to delete and don't delete until the end

* Remove dummy test

* Bug fixes

* Update API (#24966)

* Move code to textChanges
2018-06-27 09:26:47 -07:00
Andy
c8c547a706 Only add completion for a symbol if it is accessible (#25096) 2018-06-26 18:03:07 -07:00
Andy
ab9e913af3 getEditsForFileRename: Test both before and after the rename (#25074) 2018-06-26 16:55:51 -07:00
Andy
13bc46d970 getTokenAtPosition: default includeJsDocComment to true (#25015)
* getTokenAtPosition: default includeJsDocComment to true

* Update API (#24966)

* Flip meaning of parameter

* Update API (#24966)

* Remove all `ignoreJsDocComment` uses (fixes #25162)
2018-06-26 16:20:44 -07:00
Andy
0b5b7ef547 Fix removal of default import (#25200) 2018-06-25 12:41:32 -07:00
Andy
f52c881ab1 Improve verify.renameLocations (#25192) 2018-06-25 12:41:12 -07:00
Andy
6cd27a3217 Support doc comment template at function expression (#25050) 2018-06-25 11:40:45 -07:00
Andy
9aa60f27eb goToDefinition: Don't add duplicate definitions for PropertyAssignment and ArrowFunction at m: () => {} (#24995)
* goToDefinition: Don't add duplicate definitions for PropertyAssignment and ArrowFunction at `m: () => {}`

* Just use !isCallLikeExpression
2018-06-25 11:33:47 -07:00
Andy
b3a6428186 Fix completions trigger character on JSX opening tag (#25167) 2018-06-25 11:10:38 -07:00
Andy
806a661be3 Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00
Wesley Wigham
bd97e12f76 Multifaceted approach to performantly enabling fileExists outside of the synchronize step in the emit host (#25107)
* Multifaceted approach to performantly enabling fileExists outside of the synchronize step in the emit host

* make cache undefinable and handle correctly

* Remove unneeded cast

* Readd assert

* More useful failure messager
2018-06-22 14:05:36 -07:00
Andy
42fc8431f7 getEditsForFileRename: Don't update import with non-relative path if the imported file didn't move (#25159) 2018-06-22 11:21:45 -07:00
Andy
cb9c3e0f6a Don't provide a path completion if a directory name was already typed (#25055) 2018-06-22 11:18:16 -07:00
Andy
e3e4c5dd2e getEditsForFileRename: For directory rename, preserve casing of suffix (#24975) 2018-06-21 11:46:13 -07:00
Andy
7a73c89c57 Convert getInsertNodeAfterOptionsWorker to switch statement (#25128) 2018-06-21 11:20:03 -07:00
Andy
e7b338e943 Don't treat a declaration as a type argument position (#25046) 2018-06-21 10:18:37 -07:00
Nathan Shively-Sanders
43d0794ba3 Fix crash when binding jsdoc-style inner namepaths (#25106)
* getDeclarationIdentifier handles undefined name

getNameOfDeclaration actually doesn't handle all declarations, only
those that produce names that could be reasonably used as an identifier.
Until now, getDeclarationIdentifier assumed that getNameOfDeclaration
always returned a name. This caused crashes whenever we tried to get the
name of something like a Constructor.

* Add test and baselines

* getNameOfDeclaration can return undefined

This requires all callers to handle it, which turns out now to be too
disruptive.

* Fix lint
2018-06-21 10:01:39 -07:00
Andy
3e50f502bb Mark some Type[] and Signature[] as ReadonlyArray (#25099) 2018-06-21 09:57:14 -07:00
Nathan Shively-Sanders
0f55566cf4 In JS, always check the extends tag of a class before its heritage clause (#25111)
* Check extends tag first in getClassExtendsHeritageClauseElement

Previously getBaseTypeNodeOfClass checked, but this is only used in a
few places.

* Fix names and add test

* Update API baseline

* Move jsdocAugments tests to conformance/jsdoc

* Better naming in checkClassLikeDeclaration
2018-06-20 16:28:30 -07:00
Andy
f3e2e891da navigationBar: Avoid double recursion on special property assignment (#25077) 2018-06-20 12:57:34 -07:00
Andy
7f553f4f93 refactorConvertToGetAccessAndSetAccess: Don't trigger on leading trivia (#25054)
* refactorConvertToGetAccessAndSetAccess: Don't trigger on leading trivia

* Update API (#24966)
2018-06-19 13:46:03 -07:00
Andy
db85f37669 fixUnusedIdentifier: Don't needlessly exclude jsdoc (#25014) 2018-06-19 13:44:00 -07:00
Markus Johnsson
aa87cc5b73 Merge branch 'master' of github.com:Microsoft/TypeScript 2018-06-19 11:18:20 +02:00
Andy
e7e69ad4a2 Fix bug in importTracker: default and namespace imports are not exclusive (#24965) 2018-06-15 12:15:39 -07:00
Ryan Cavanaugh
73844ac565 Accept baseline 2018-06-15 11:10:54 -07:00
Wesley Wigham
640af3f75e Introduce related spans into tsserver protocol (#24548)
* Introduce related spans into tsserver protocol

* Incorporate pretty output, implement esModuleInterop related span
2018-06-15 10:54:36 -07:00
Ryan Cavanaugh
d02fe4ac44 Merge branch 'master' into esau-squash
# Conflicts:
#	tests/baselines/reference/api/typescript.d.ts
2018-06-15 10:40:46 -07:00
Andy
7a1d75cc11 getEditsForFileRename: Don't update unrelated import (#24961)
* getEditsForFileRename: Don't update unrelated import

* Importing source file moved if it's the old path *or* new path
2018-06-14 15:42:16 -07:00
Andy
4a7a550502 moveToNewFile: Reuse code from importFixes for inserting import (#24957)
* moveToNewFile: Reuse code from importFixes for inserting import

* Fix test failures

* Update API baselines (#24966)
2018-06-14 15:41:47 -07:00
Ryan Cavanaugh
8491f70379 Merge branch 'master' into esau-squash
# Conflicts:
#	tests/baselines/reference/api/typescript.d.ts
2018-06-14 11:25:00 -07:00
Wesley Wigham
2a1503610b Stop generating sectional sourcemaps (#24917)
* Generate normal 1-part sourcemaps (at increased processing cost), since tools dislike sectional ones

* Add semicolon

* Accept sad baselines]

* Forward along sourcesContent if available

* Supress lint since the API actually calls for null here

* Fix concatenated sourcemap paths

* Accept bad baselines :(

* Add overloads

* Accept api update

* Fix lint
2018-06-13 18:52:23 -07:00
Ryan Cavanaugh
1bbe6610a4 Merge branch 'master' into esau-squash 2018-06-13 15:35:18 -07:00
Wesley Wigham
61fb222cd2 Use symlinks when looking for module names for declaration emit (#24874)
* fix symlink tag, support arbitrary (ie, directory) links via @link

Introduce indirect symlink lookup to specifier deriver

Use fileset, move exec

vfs path resolution :shakes fist:

Apply files symlink relative to dirname

Use directory function

* Accept really bad baseline updates
2018-06-12 12:52:44 -07:00
Wesley Wigham
212cd9b218 Use correct search order for position location (#24886) 2018-06-11 17:12:06 -07:00
Ryan Cavanaugh
066b191982 Collapse core/compiler/parser into parser 2018-06-11 17:07:58 -07:00
Wesley Wigham
6c78ce31ea Set use flag (#24881) 2018-06-11 17:00:17 -07:00
Ryan Cavanaugh
6876d981f2 Merge with master 2018-06-11 13:17:25 -07:00
Andy
ed20f7d983 Simplify tryDeleteDeclaration (#24808) 2018-06-11 13:10:29 -07:00
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
Ryan Cavanaugh
c7cee5ce26 Merge branch 'master' into projzilla 2018-06-11 11:15:21 -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
Ryan Cavanaugh
ab10b86205 Almost working? 2018-06-10 19:28:38 -07:00
Markus Johnsson
8850f74eab Merge branch 'master' of github.com:Microsoft/TypeScript 2018-06-10 15:00:52 +02:00