Commit Graph

5087 Commits

Author SHA1 Message Date
Sheetal Nandi
17ceddaa1a Merge pull request #29493 from Kingwl/avoid-quickfix-for-declaration-file
avoid add missing member in declaration file
2019-03-29 11:58:08 -07:00
Gabriela Araujo Britto
bb5eb025a8 Handle imports and exports in 'convert parameters to destructured object' (#30475)
* add test for imported function

* start to implement import references check

* fix imported function test

* skip alias when looking for symbol target

* recognize ES6 imports

* recognize some export syntax

* add tests for imports/exports

* add test for imported function

* start to implement import references check

* fix imported function test

* skip alias when looking for symbol target

* recognize ES6 imports

* recognize some export syntax

* add tests for imports/exports

* add test for imported function

* start to implement import references check

* fix imported function test

* recognize ES6 imports

* recognize some export syntax

* add mode import/export syntax cases

* fix entryToFunctionCall to deal with new calls through property/element access expressions

* add more tests for imports/exports

* allow function and class declarations that have no name but have a default modifier

* rename tests

* fix conflict

* fix tests

* add test for nameless class

* rename function

* minor refactor

* remove old tests

* delete old test

* refactor as suggested

* use getContainingFunctionDeclaration
2019-03-28 13:34:29 -07:00
王文璐
9050d0fdf8 update external files api 2019-03-27 19:06:21 +08:00
王文璐
6bc5ef3474 Merge branch 'master' into avoid-quickfix-for-declaration-file 2019-03-27 18:36:56 +08:00
Gabriela Araujo Britto
0f6f3b79b5 Fix find all references of inherited constructor (#30514)
* recursively look for inherited constructor references

* add test

* remove outdated comment

* add tests

* move function

* improve tests

* minor refactor

* fix convert params refactoring to deal with inherited constructor calls

* simplify refactor test
2019-03-22 15:17:50 -07:00
Sheetal Nandi
800f7a3447 Merge pull request #30414 from Microsoft/jsSyntaxCompletions
Filter ts only keywords from js file completion
2019-03-20 10:38:11 -07:00
Gabriela Araujo Britto
84087d0e0a Use shorthand property assignment in convert parameters to object (#30468)
* create shorthand property assignment in argument object when possible

* add shorthand property assignment test

* don't offer refactor on jsdoc comment

* add jsdoc test

* improve jsdoc test

* use crlf
2019-03-19 09:28:09 -07:00
Gabriela Britto
10b9051624 Fix convert to named parameters rest parameter tuple (#30286)
* check if rest parameter is of tuple type in isOptionalParameter

* expose isArrayType and isTupleType in checker

* don't offer refactor if rest parameter type is neither array nor tuple type

* add tests for rest parameters

* fix tests for renamed refactor

* remove unnecessary conditional operator
2019-03-18 10:31:38 -07:00
Anders Hejlsberg
d0646a629a Merge pull request #30084 from dragomirtitian/GH-26563
Improved argument description for parameters originating from tuples
2019-03-18 06:14:52 -10:00
Nathan Shively-Sanders
658798032b Fix globalThis completions (#30441)
* Fix, but with test not quite right

* Add missing completions to test

* Remove out-of-date comment
2019-03-15 19:10:39 -07:00
Sheetal Nandi
34a7b7bbd8 implements not a keyword in js 2019-03-15 15:21:38 -07:00
Sheetal Nandi
e78f52d246 Add more information when getValidSourceFile cant find the file in question.
Log for #30180
2019-03-15 15:03:45 -07:00
Sheetal Nandi
ad740f226e Duh!! Static is allowed in JS. 2019-03-15 09:07:23 -07:00
Sheetal Nandi
f829f958a2 Filter ts only keywords from js file completion
Fixes #29212
2019-03-14 15:52:50 -07:00
Gabriela Britto
1c8a359914 rename convert to named parameters (#30401) 2019-03-14 13:41:29 -07:00
Gabriela Britto
7824fbc395 Merge pull request #30383 from Microsoft/fixFindAllRefsOfDefaultExport
Fix find all refs of default export
2019-03-14 09:39:06 -07:00
Sheetal Nandi
8b04143675 Merge pull request #30380 from Microsoft/completionsWhileWritingSpread
Fix completions when writing spread expression
2019-03-14 09:38:50 -07:00
Sheetal Nandi
526eda8f18 Add extends of type parameter as type only location for completions
Fixes #28511
2019-03-13 15:22:33 -07:00
Gabriela Araujo Britto
c130fde79e fix check for default export 2019-03-13 15:10:54 -07:00
Sheetal Nandi
12d736f0a4 Fix completions when writing spread expression
Fixes #29234
2019-03-13 14:25:43 -07:00
Wenlu Wang
b97b1a8de6 add jsx factory and hold text in jsxtext node (#29439)
* add jsx factory and hold text in jsxtext node

* update jsxtext prop name and factory
2019-03-11 16:00:18 -07:00
Titian Cernicova-Dragomir
d433042386 Fixed isVariadic handling when signature parameters are expanded for itemInfoForParameters 2019-03-11 02:55:10 +02:00
Titian Cernicova-Dragomir
88babf2a90 Merge remote-tracking branch 'remotes/origin/master' into GH-26563 2019-03-11 02:31:07 +02:00
Anders Hejlsberg
79813b8ece Show expanded parameter lists in signature help 2019-03-09 12:23:57 -08:00
Sheetal Nandi
990b199ebd Merge branch 'master' into incrementalBuildInfo 2019-03-08 11:42:19 -08:00
Anders Hejlsberg
d59e51b063 Merge pull request #30215 from Microsoft/higherOrderFunctionTypeInference
Higher order function type inference
2019-03-08 10:41:32 -08:00
Gabriela Britto
d2364f555f Merge pull request #30089 from Microsoft/convert-to-named-parameters
Convert to named parameters
2019-03-06 09:33:01 -08:00
Anders Hejlsberg
b34fe67ac5 Fix issue of more inferences leading to worse results 2019-03-05 17:49:58 -08:00
Gabriela Araujo Britto
60b2d6a2f5 remove unnecessary closures 2019-03-05 16:56:30 -08:00
Gabriela Araujo Britto
98a146dcfc use getTouchingToken 2019-03-01 13:23:59 -08:00
Gabriela Araujo Britto
cd060e75fe use interface for ValidVariableDeclaration 2019-03-01 09:17:44 -08:00
Gabriela Araujo Britto
1f91aa1c9b remove inlineable 2019-02-28 16:55:40 -08:00
Sheetal Nandi
46ddbff7b1 Fix test by reverting change in textChanges that occured by mistake in 499bc70056 2019-02-28 14:28:27 -08:00
Sheetal Nandi
5fd745d834 Update the tsconfigs 2019-02-28 14:01:40 -08:00
Sheetal Nandi
d53efdf380 Changes to generation of .tsbuildinfo:
- If composite or incremental then only the .tsbuildinfo will be generated
- if --out or --outFile the file is outputFile.tsbuildinfo
- if rootDir and outDir then outdir/relativePathOfConfigFromRootDir/configname.tsbuildinfo
- if just outDir then outDir/configname.tsbuild
- otherwise config.tsbuildinfo next to configFile
2019-02-28 13:46:26 -08:00
Gabriela Araujo Britto
617d5af67e add diagnostics message for refactor description 2019-02-28 11:22:05 -08:00
Gabriela Araujo Britto
51616a4043 use sortAndDeduplicate instead of deduplicate 2019-02-28 09:50:57 -08:00
Gabriela Araujo Britto
7fd6868f8b minor refactors to convertToNamedParameters 2019-02-27 16:42:54 -08:00
Gabriela Araujo Britto
54c7996ff5 refactor getGroupReferences 2019-02-27 16:19:01 -08:00
Sheetal Nandi
ed35741b5f Merge branch 'master' into incrementalBuildInfo 2019-02-27 15:45:59 -08:00
Nathan Shively-Sanders
be2db9db12 Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
Gabriela Araujo Britto
006fe14bcc refactor utilities 2019-02-26 16:22:08 -08:00
Gabriela Araujo Britto
970ec62364 remove unused LeadingTriviaOption and TrailingTriviaOption options 2019-02-26 10:02:57 -08:00
Gabriela Araujo Britto
bf5123de6a don't export useNonAjustedPositions 2019-02-26 09:49:10 -08:00
Gabriela Araujo Britto
e3a465ffa3 change startPosition and endPosition to leadingTriviaOption and trailingTriviaOption 2019-02-26 09:43:35 -08:00
Gabriela Araujo Britto
365967d484 Merge branch 'master' into convert-to-named-parameters 2019-02-25 10:54:58 -08:00
Titian Cernicova-Dragomir
8d66d55de1 Improved argument description for parameters originating from tuples that were extracted from functions. (ie mapped functions) 2019-02-25 18:18:00 +02:00
Sheetal Nandi
9fa28158bb Enable building typescript.d.ts with current source 2019-02-22 18:11:27 -08:00
Joseph Wunderlich
d87e67df58 clarify intent in returnType creation 2019-02-22 18:00:21 -08:00
Joseph Wunderlich
21ab39649c remove any annotation from declare method quickfix 2019-02-22 17:24:21 -08:00