7961 Commits

Author SHA1 Message Date
Andy
6cd27a3217
Support doc comment template at function expression (#25050) 2018-06-25 11:40:45 -07:00
Andy
8923a01481
Fix test failure (#25199) 2018-06-25 11:34:04 -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
e8e80d2bbd
Don't crash on property access with type (#25170)
* Don't crash on property access with type

* Move test
2018-06-25 11:25:52 -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
Nathan Shively-Sanders
0bb897273f
Parse nested prop and param tags the same way (#25139)
That is, only nest them if their name matches the provided parent name.
Otherwise do not nest them.

Note that this commit changes the behaviour of an incorrect typedef that
contains both an `@type` child tag and `@property` child tags.

Previously, the `@type` would be incorrectly nested under a `@property`
tag with type `object`, just like `@property` tags would be. Now, the
`@type` tag causes the entire typedef to ignore the `@property` tags and
treat the typedef as if it were an instance of the
typedef-and-nested-type pattern:

```js
/**
 * @typedef {Object} name
 * @type {{ the, actual, type }}
 */
```
2018-06-21 16:12:55 -07:00
Daniel Rosenwasser
72068e22af
Merge pull request #25115 from Microsoft/matchingTypeRefs
Improved errors using type reference targets
2018-06-21 13:46:21 -07:00
Wenlu Wang
51e7ae0813 provide spelling suggestion for indexed access (#22225)
* provide spelling suggestion for indexed access

* update merge

* accept baseline

* fix suggession return type

* allow string or identifier on getSuggestionForNonexistentProperty

* fix lint
2018-06-21 13:40:41 -07:00
Andy
e3e4c5dd2e
getEditsForFileRename: For directory rename, preserve casing of suffix (#24975) 2018-06-21 11:46:13 -07:00
Nathan Shively-Sanders
a7af92eb63
check return tag in getTypePredicateOfSignature (#25130) 2018-06-21 11:30:37 -07:00
Andy
2b9166b2f9
Don't recommend to install '@types/foo' if that already exists (#24815)
* Don't recommend to install '@types/foo' if that already exists

* Add different extra diagnostic text if the @types package exists

* Update API (#24966)
2018-06-21 10:19:14 -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
40899eaf5b
Error on 'const' in class expression (#25125) 2018-06-21 09:57:52 -07:00
Daniel Rosenwasser
639d9ebb15 Added test. 2018-06-21 00:27:12 -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
b3f9ec3796
Fix bug: Still implement a method even if the return type is defined in another file (#24978) 2018-06-19 16:36:18 -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
Nathan Shively-Sanders
03fff50fa4
Simplify getJSDocCommentAndTags (#24997)
Previously, getJSDocCommentAndTags could recur up to four times if any
of four predicates matched. However, to avoid duplicates, the predicates
have been tuned to be mutually exclusive, which means that the recursion
can be turned into a while loop. The while loop is much simpler and
safer, since it is guaranteed to only walk up the tree one time. In
addition, the extra check that adds jsdoc from initializers only runs
once, before the loop, further reducing the opportunity for duplicate
jsdocs.

I thought about further simplifying the code that gets the next node to
check, but to know when to stop the loop, I'd need a predicate that is
as complicated as the code in `getNextJSDocCommentLocation`, so I kept
the existing code, just reordering it for compactness.
2018-06-19 10:14:47 -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
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
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
Nathan Shively-Sanders
4db1c132b7
No dupe jsdoc for assignment inside an initializer (#24973) 2018-06-14 15:32:10 -07:00
Nathan Shively-Sanders
57e652dd02
Js/check type tags (#24967)
* Check the type expression of `@type` tags

* Update existing tests and baselines
2018-06-14 13:11:52 -07:00
Andy
345012e29d
Don't add diagnostic on unused import starting with underscore (#24958)
* Don't add diagnostic on unused import starting with underscore

* Fix lint
2018-06-14 12:55:12 -07:00
Nathan Shively-Sanders
a56b272d38
In JS, fix crash with in a file with conflicting ES2015/commonjs exports (#24960)
* fix crash with conflicting ES2015/commonjs modules

* Refactor based on PR comments
2018-06-14 11:18:23 -07:00
Wesley Wigham
a77068827d
Handle combinations of rootdir and outdir when calculating paths (#24941) 2018-06-14 11:07:46 -07:00
Mohamed Hegazy
90895198fa Merge branch 'master' into fixAPISampleTests 2018-06-13 11:14:22 -07:00
Nathan Shively-Sanders
2a8c4d1bd7
Support @this tags (#24927)
* Type check `@this` tags

No special support in fourslash yet, so quickinfo probably doesn't work.

* Do no require braces and update API baselines
2018-06-13 10:11:12 -07:00
Mohamed Hegazy
838b76e928 Merge remote-tracking branch 'origin/master' into fixAPISampleTests 2018-06-12 13:03:11 -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
Mohamed Hegazy
1b6f0ea07e Fix API Sample tests 2018-06-12 12:52:06 -07:00
Mohamed Hegazy
7a322d72f7
Merge pull request #23989 from a-tarasyuk/bug/23180-generate-source-maps-with-relative-path
#23180 - Generating source maps with relative path in sourceRoot option produces maps with absolute file paths
2018-06-12 10:57:17 -07:00
Nathan Shively-Sanders
5be8f1f9f9
Better handling of circular JS containers in getTypeOfVariableOrParameterOrProperty (#24732)
* avoid circularity in getTypeOfVariableOrParameterOrProperty

Modify getTypeOfVariableOrParameterOrProperty to get the type of the
variable declaration before widening it. This essentially avoids some
circularities by (1) setting the type of the variable declaration to the
unwidened type (2) updating the type of the variable declaration to the
widened one.

You will still get a circular noImplicitAny in (1), for expressions that
actually are circular, but not in (2), for the containers of things that
are not themselves circular.

* Stop checking js init object literals via checkObjectLiteral

* checkBinaryExpression: new code for special assignments

* Chained lookup for js initializer type

* Check for JS-specific types only once

Also make sure to respect the type annotation if there is one.

* Accept API changes
2018-06-12 09:42:26 -07:00
Alexander T
f007c3586b mapRoot is not filePath 2018-06-12 18:20:53 +03:00
Wesley Wigham
6c78ce31ea
Set use flag (#24881) 2018-06-11 17:00:17 -07:00
Mohamed Hegazy
64dab639ce Merge remote-tracking branch 'origin/master' into Fix24826 2018-06-11 15:50:41 -07:00
Mohamed Hegazy
c34a6d9d12 Remove error baseline 2018-06-11 15:29:52 -07:00
Nathan Shively-Sanders
923a8aab0e
Add Variable to HasExports (#24871)
JS containers are variables, but may have exports just like classes and
modules.
2018-06-11 14:45:27 -07:00
Mohamed Hegazy
35d25ff280
Merge pull request #24645 from Kingwl/this-type-accessibility
allow access protected member in this parameter context
2018-06-11 13:17:58 -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
Mohamed Hegazy
b33d5e3f19 Fix #24826: Add mapping for ES2018 target to library 2018-06-11 12:46:13 -07:00