Commit Graph

1267 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
d2c0ec754b JS:resolve nested static classes+on func/class exps
1. In Javascript, support type references to class expressions whose
name is obtained via "static property assignment" to another class like
so:

```ts
function Outer() {
  this.y = 2
}
Outer.Inner = class { }

/** @type {Outer.Inner} */
var inner;
```

2. In Javascript, support type references to properties of function and
class expressions that are assigned to a variable, like so:

```ts
var Outer = function {
  this.y = 2
}
Outer.Inner = class { }

/** @type {Outer.Inner} */
var inner;
```
2017-11-21 10:17:48 -08:00
Andy
0c0f4b81ae Simplify documentHighlights (#20091) 2017-11-17 10:19:35 -08:00
Ron Buckton
a21a129abb Merge branch 'master' into dynamicNames 2017-11-15 15:24:05 -08:00
Andy
4b96edf72f Treat ... in jsdoc type as creating a synthetic rest parameter -- not as an array type (#19483)
* Treat `...` in jsdoc type as creating a synthetic rest parameter -- not as an array type

* Change type parsing so `...T[]` parses as `...(T[])` and not `(...T)[]`

* Replace the last parameter with ...args, and make access to it potentially undefined

* Code review
2017-11-15 13:04:08 -08:00
meyer
36ce7eac5a Update JSX intrinsic element test to match babel’s (#19946)
* Update JSX intrinsic element test to match babel’s

* Update baseline

* Move regex out of isIntrinsicJsxName

* Switch to non-regex intrinsic name test
2017-11-14 09:40:32 -08:00
Ron Buckton
804c7d3690 Merge branch 'master' into dynamicNames 2017-11-13 13:24:20 -08:00
Ron Buckton
ae11ae55c5 Fix getReturnTypeFromBody widening 2017-11-13 13:19:49 -08:00
Wesley Wigham
16efae2433 Consider the commonjs module indicator as a module indicator (#18490)
* Consider the commonjs module indicator as an indicator that something is effectively an external module

* Only use commonjs module indicator when targeting commonjs
2017-11-09 16:49:04 -08:00
Andy
65a191fa2b For import completion of default import, convert module name to identifier (#19875)
* For import completion of default import, convert module name to identifier

* Suggestions from code review
2017-11-09 13:13:23 -08:00
Andy
9c8129eeac Enable 'no-invalid-template-strings' lint rule (#19790) 2017-11-07 06:51:35 -08:00
Ron Buckton
3f248ecfe1 Merge pull request #19452 from Microsoft/compareStrings
Clean up outdated string comparison logic
2017-11-06 18:48:15 -08:00
Ron Buckton
33e09f9a9d Merge branch 'master' into dynamicNames 2017-11-06 12:05:25 -08:00
Andy
0a7b7e07ee Apply 'variable-name' tslint rule (#19743) 2017-11-06 09:23:47 -08:00
Ron Buckton
31c3d444f1 Merge branch 'master' into compareStrings 2017-11-03 23:01:51 -07:00
Ron Buckton
208dfa6b01 Merge branch 'master' into dynamicNames 2017-11-03 22:10:28 -07:00
Andy
1d7f449a87 Minor cleanups in pathCompletions.ts (#19685)
* Minor cleanups in pathCompletions.ts

* Update name
2017-11-03 15:06:22 -07:00
Andy
cc2a2a79b5 Use NodeFlags to detect nodes in ambient contexts instead of climbing ancestors (#17831)
* Use NodeFlags to detect nodes in ambient contexts instead of climbing ancestors

* Set context flags on tokens

* Remove 'isDeclarationFile' parameter to 'initializeState' and move to 'parseSourceFileWorker'

* Changes based on code review

* Update API baselines
2017-11-03 08:08:48 -07:00
Nathan Shively-Sanders
98e9a561af Merge pull request #19219 from Microsoft/abstract-property-access-error-in-own-constructor-only
Abstract property access error in own constructor only
2017-10-31 13:27:24 -07:00
uniqueiniquity
3ebb2e8a34 Merge branch 'master' into jsxFragment 2017-10-31 10:53:57 -07:00
Andy
f4236ec5c8 Rename "isPartOfExpression" (#18469) 2017-10-31 08:05:39 -07:00
Ron Buckton
967a426fe1 Unify deduplication, fix deferred global diagnostics 2017-10-30 17:19:27 -07:00
Ron Buckton
44117e19ea Reduce noise in PR, minor cleanup 2017-10-26 17:57:54 -07:00
Ron Buckton
3cb15378d7 Improve performance of deduplication of sorted arrays 2017-10-26 17:51:09 -07:00
Ron Buckton
170e6ec130 Ensure correct errors when emitting declarations 2017-10-26 15:50:07 -07:00
Ron Buckton
dfa1ffe650 Cleanup and reordering 2017-10-25 18:00:59 -07:00
Ron Buckton
c0ed26e605 Simplify comparers 2017-10-25 17:46:39 -07:00
Ron Buckton
130c407708 More control over which collator to use in each situation 2017-10-25 16:30:19 -07:00
Ron Buckton
51929acb89 Merge branch 'master' into dynamicNames 2017-10-21 00:36:52 -07:00
Ron Buckton
b5a7b036c3 Address PR feedback 2017-10-20 23:51:58 -07:00
Ron Buckton
55e63a8288 Simplify getLateBoundSymbol 2017-10-20 15:04:04 -07:00
Andy
d7be61a569 Subsequent variable declarations must have same type: Mention location of other declaration (#19356)
* Subsequent variable declarations must have same type: Mention location of other declaration

* Fix naming, remove template literal
2017-10-20 08:33:16 -07:00
Nathan Shively-Sanders
97a6f14ca2 Consolidate jsdoc node getters
They are now used both in getJSDocCommentsAndTagsWorker and in
geParameterSymbolFromJSDoc.
2017-10-19 14:12:56 -07:00
Nathan Shively-Sanders
c2bbfafcbe Fix getParameterSymbolFromJSDoc 2017-10-19 09:13:31 -07:00
Nathan Shively-Sanders
b40e18df00 Merge pull request #19304 from Microsoft/dedupe-jsdoc-annotation-refactors
Fixes for refactor "Annotate with type from JSDoc"
2017-10-18 14:50:13 -07:00
Nathan Shively-Sanders
f82dd7b1da Move isJSDocIndexSignature to utilities 2017-10-18 13:16:22 -07:00
Wesley Wigham
f9df4e69e6 Respect newLine compiler option in language service output (#19279) 2017-10-17 18:45:21 -07:00
Andy
2b566b9a53 Add exported members of all project files in the global completion list (#19069)
* checker.ts: Remove null check on symbols

* tsserverProjectSystem.ts: add two tests

* client.ts, completions.ts, types.ts: Add codeActions member to CompletionEntryDetails

* protocol.ts, session.ts: Add codeActions member to CompletionEntryDetails protocol

* protocol.ts, session.ts, types.ts: add hasAction to CompletionEntry

* session.ts, services.ts, types.ts: Add formattingOptions parameter to getCompletionEntryDetails

* completions.ts: define SymbolOriginInfo type

* completions.ts, services.ts: Add allSourceFiles parameter to getCompletionsAtPosition

* completions.ts, services.ts: Plumb allSourceFiles into new function getSymbolsFromOtherSourceFileExports inside getCompletionData

* completions.ts: add symbolToOriginInfoMap parameter to getCompletionEntriesFromSymbols and to return value of getCompletionData

* utilities.ts: Add getOtherModuleSymbols, getUniqueSymbolIdAsString, getUniqueSymbolId

* completions.ts: Set CompletionEntry.hasAction when symbol is found in symbolToOriginInfoMap (meaning there's an import action)

* completions.ts: Populate list with possible exports (implement getSymbolsFromOtherSourceFileExports)

* completions.ts, services.ts: Plumb host and rulesProvider into getCompletionEntryDetails

* completions.ts: Add TODO comment

* importFixes.ts: Add types ImportDeclarationMap and ImportCodeFixContext

* Move getImportDeclarations into getCodeActionForImport, immediately after the implementation

* importFixes.ts: Move createChangeTracker into getCodeActionForImport, immediately after getImportDeclarations

* importFixes.ts: Add convertToImportCodeFixContext function and reference it from the getCodeActions lambda

* importFixes.ts: Add context: ImportCodeFixContext parameter to getCodeActionForImport, update call sites, destructure it, use compilerOptions in getModuleSpecifierForNewImport

* importFixes.ts: Remove moduleSymbol parameter from getImportDeclarations and use the ambient one

* importFixes.ts: Use cachedImportDeclarations from context in getCodeActionForImport

* importFixes.ts: Move createCodeAction out, immediately above convertToImportCodeFixContext

* Move the declaration for lastImportDeclaration out of the getCodeActions lambda into getCodeActionForImport

* importFixes.ts: Use symbolToken in getCodeActionForImport

* importFixes.ts: Remove useCaseSensitiveFileNames altogether from getCodeActions lambda

* importFixes.ts: Remove local getUniqueSymbolId function and add checker parameter to calls to it

* importFixes.ts: Move getCodeActionForImport out into an export, immediately below convertToImportCodeFixContext

* completions.ts: In getCompletionEntryDetails, if there's symbolOriginInfo, call getCodeActionForImport

* importFixes.ts: Create and use importFixContext within getCodeActions lambda

* importFixes.ts: Use local newLineCharacter instead of context.newLineCharacter in getCodeActionForImport

* importFixes.ts: Use local host instead of context.host in getCodeActionForImport

* importFixes.ts: Remove dummy getCanonicalFileName line

* Filter symbols after gathering exports instead of before

* Lint

* Test, fix bugs, refactor

* Suggestions from code review

* Update api baseline

* Fix bug if previousToken is not an Identifier

* Replace `startsWith` with `stringContainsCharactersInOrder`
2017-10-17 10:20:11 -07:00
uniqueiniquity
abb3f58db2 Add support for JSX fragment syntax 2017-10-17 09:38:09 -07:00
Nathan Shively-Sanders
49beac919c Abstract property access error only on this access 2017-10-16 09:43:49 -07:00
Nathan Shively-Sanders
123347d5c4 Convert @template tag to type parameters in refactor 2017-10-12 11:40:07 -07:00
Mohamed Hegazy
260d37e8ea Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-12 10:23:21 -07:00
Mohamed Hegazy
4487917f89 Quick fix for no-implicit-any errors to add explicit type annotation (#14786)
* Infer from usage quick fix

* Change full function singature

* Add property/element access support

* Fix a few issues

* Some cleanup

* Expose getArrayType and getPromiseType

* Switch to collecting all usage before infering

* Infer array and promise type arguments

* Handel enums in binary operators

* consolidate usage of addCandidateTypes

* Handel rest paramters

* Properly handel `+=` and `+` inference for numbers and strings

* Add print quickfixes debug helper

* Add rest param tests

* Add optional paramter tests

* Handel set accessors

* Support getters

* Support no implicit any error for variable at use site

* Support properties

* Only offer quick fix if an infered type other than any is available

* Rename functions

* Move to a separate namespace

* Check cancellation token

* Cleanup

* Check for accesibile symbols where serializing types

* Remove JS support

* Reorganize functions

* Mark APIs as internal

* Fix lint errors

* Removed conflict markers.

* Update 'createSymbol' to use '__String'.

* Fixed most problems relating to '__String' and 'includeJsDocComments' in the fix itself.

* Addressed most API changes.

* Make all helpers internal

* Use a diffrent writer and not the built-in single line write

* Infer types for all parameters in a parameter list instead of one at a time

* Accept baselines

* Code review commments

* Respond to code review comments
2017-10-12 10:14:58 -07:00
Nathan Shively-Sanders
d7424b00b2 Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-11 13:41:45 -07:00
Arthur Ozga
1db762356e Merge pull request #18706 from aozgaa/dev/aozgaa/JsDocExtendsSupport
support @extends in jsdoc
2017-10-09 15:08:58 -07:00
Arthur Ozga
0afaadba3b add error for multiple tags 2017-10-06 15:56:39 -07:00
Andy
e821c2b6e9 A parameter not declared as a rest parameter is not one (#18825) 2017-10-06 15:05:00 -07:00
Andy
71f8852124 Have getNameOfDeclaration return x for export default x. (#18616) 2017-10-06 14:29:45 -07:00
Ron Buckton
6f05e43b55 Merge branch 'master' into dynamicNames 2017-10-02 19:08:09 -07:00
Nathan Shively-Sanders
6831e65235 Merge branch 'master' into refactor-jsdoc-types-to-typescript 2017-10-02 16:24:00 -07:00
Ron Buckton
fb3168d46f Merge branch 'master' into dynamicNames 2017-10-02 11:40:28 -07:00