3428 Commits

Author SHA1 Message Date
Andy
6cf30fbccf Fix bug in importTracker: getExportNode must verify that we are on the LHS of a VariableDeclaration (#17205) 2017-07-17 12:29:29 -07:00
Nathan Shively-Sanders
61c9f98eef Merge branch 'master' into parse-jsdoc-with-ts-type-parser 2017-07-14 15:04:06 -07:00
Andy
680bfbb705 Combine moduleHasNonRelativeName with isExternalModuleNameRelative (#16564) 2017-07-13 13:46:04 -07:00
Nathan Shively-Sanders
bc69c7e6d1 Parse JSDoc types using the normal TS parser
This means that JSDoc types can include the full range of Typescript
types now. It also means that Typescript annotations can include JSDoc
types. This is disallowed with a new error, however. But Typescript can
still give the correct types to JSDoc that shows up in .ts files by
mistake. This can easily happen, for example with types like

```ts
var x: number? = null;
var y: ?string = null;
var z: function(string,string): string = (s,t) => s + t;

// less likely to show up, but still understood.
var ka: ? = 1;
```

In the future, I will add a quick fix to convert these into the correct
types.

Fixes #16550
2017-07-13 11:27:50 -07:00
Mine Starks
fd2dd2edc0 Merge pull request #17078 from minestarks/removeimportfix
Code fix to remove unused named import should preserve default import
2017-07-13 10:53:35 -07:00
Andy
c6a6467073 Remove unneeded ExportType and ExportNamespace flags (#16766) 2017-07-13 09:21:13 -07:00
Andy
69d3ca774a When adding completions for a module, don't get the type of the module if not necessary. (#16768)
* When adding completions for a module, don't get the type of the module if not necessary.

* Use SymbolFlags.Module alias
2017-07-13 09:20:40 -07:00
Andy
6880ee33a3 displayPartWriter: Use try-finally to clear (#16807) 2017-07-13 08:14:02 -07:00
Andy
79b10081a9 getApplicableRefactors: Don't return undefined response (#16773) 2017-07-13 07:32:41 -07:00
Andy
efc861c76d Add logging to discoverTypings (#16652) 2017-07-13 07:10:35 -07:00
Andy
33836f891c Clean up getJavaScriptCompletionEntries (#16750)
* Clean up getJavaScriptCompletionEntries

* Move each parameter to its own line
2017-07-13 06:54:04 -07:00
Andy
08030c7d02 Convert most of core.ts to accept ReadonlyArray (#17092)
* Convert most of core.ts to accept ReadonlyArray

* Fix lint

* Fix isArray
2017-07-11 17:39:33 -07:00
Mine Starks
3915d46913 Fix case where we can return [undefined] 2017-07-11 15:10:04 -07:00
Mine Starks
80b64de1e4 Fix comment behavior in remove unused named bindings 2017-07-11 14:53:08 -07:00
Mine Starks
bb063f1b5c Remove incorrect comment 2017-07-11 14:52:48 -07:00
Andy
23da0ab501 Use array helpers in more places (#17055) 2017-07-11 09:00:34 -07:00
Andy
aa2d1008bf Completion for default export should be '.default' (#16742)
* Completion for default export should be '.default'

* Don't include empty string in name table

* getSymbolsInScope() should return local symbols, not exported symbols

* Fix bug: getSymbolAtLocation should work for local symbol too
2017-07-11 07:23:32 -07:00
Mine Starks
39e4b1f9e3 Code fix to remove unused import should preserve default import 2017-07-10 14:23:18 -07:00
Andy
dab682767c Fix call to getCodeFixesAtPosition (#17063) 2017-07-10 13:25:48 -07:00
Andy
bffde588cc Improve performance of JSDoc tag utilities (#16836)
* Improve performance of JSDoc tag utilities

* Use emptyArray instead of null, and address PR comments
2017-07-10 11:26:59 -07:00
Andy
0567ca29c6 Remove EmptySafeList (#16647) 2017-07-10 09:19:18 -07:00
Andy
17578e8a5d Use Map<true> for sets (#16972) 2017-07-07 10:34:36 -07:00
Andy
2d802a62c4 Have isObjectBindingPatternElementWithoutPropertyName return the binding element (#16956) 2017-07-07 10:34:11 -07:00
Andy
e7dc2a67ca Enable "object-literal-shorthand" lint rule (#16987) 2017-07-07 07:26:58 -07:00
Wesley Wigham
4b19eb3200 Remove duplicate entries from tsconfig files (#16991) 2017-07-06 15:56:34 -07:00
Wesley Wigham
07e8263204 Start using a union for FunctionLike things (#16988)
* Start using a union for FunctionLike things

* Rename to shorter name
2017-07-06 14:46:15 -07:00
Wesley Wigham
4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Arthur Ozga
4e6e1d1b8b Merge pull request #16657 from aozgaa/formatOnOpenCurly
Format on open curly
2017-06-30 10:04:57 -07:00
Arthur Ozga
25abf8a9e8 respond ot comments 2017-06-29 17:31:41 -07:00
Ryan Cavanaugh
ec00bb9b72 Merge pull request #16697 from RyanCavanaugh/preserveMethodComments
Preserve method comments in JS->ES6 conversion.
2017-06-29 15:40:16 -07:00
Andrew Casey
ac72803bb2 Merge pull request #16684 from amcasey/Vsts434619
Watch for the creation of missing files
2017-06-29 13:41:18 -07:00
Arthur Ozga
60b78c618f only format open curly up to the open curly 2017-06-29 11:13:44 -07:00
Andy
179a3e10b5 Handle depth in all readDirectory implementations (#16646) 2017-06-29 11:04:33 -07:00
Andrew Casey
587309d029 Update error case check
`getTouchingWord` indicates failure by returning the sourceFile node,
rather than `undefined`.
2017-06-29 10:39:30 -07:00
t_
51fb7e9a81 Add alwaysStrict option (#16562)
* Add alwaysStrict option

* Enable alwaysStrict

* Fix for strict mode

* keep whitespace
2017-06-28 19:44:15 -07:00
Andy
c4319e3b94 Clean up uses of ensureScriptKind (#16714)
* Clean up uses of ensureScriptKind

* Remove unneeded parentheses
2017-06-28 14:29:16 -07:00
Andy
2ccfe502f7 Fix scope of @typedef references (#16718)
* Fix scope of @typedef references

* Remove unused variables
2017-06-28 13:30:23 -07:00
Andy
9013665e22 Replace FileMap with Map where there is no keyMapper (#16724)
* Replace FileMap with Map where there is no keyMapper

* Remove `toKey` and use `keyMapper` directly
2017-06-28 13:15:34 -07:00
Arthur Ozga
eae234cab2 disable spaceBeforeOpenCurly if newline rule is enabled 2017-06-28 13:13:53 -07:00
Andy
9260a399a3 Remove duplicate switch cases (#16721) 2017-06-28 12:53:43 -07:00
Andy
42e08f5578 findAllRefs: Find string references inside of template strings (#16723) 2017-06-28 12:53:12 -07:00
Arthur Ozga
a5c8a29fa4 only format opencurly if no intervening tokens 2017-06-28 12:48:14 -07:00
Andy
18357543c6 Provide better services for incomplete generic calls (#16535)
* Provide better services for incomplete generic calls

* Use clearer name

* Remove `inferredAnyDefaultTypeArgument` and `getBestGuessSignature`; have `resolveSignature` always get the best signature if !produceDiagnostics

* Update names and comments
2017-06-27 09:14:23 -07:00
Arthur Ozga
c5f6c4fac0 remove unecessary check 2017-06-26 11:21:21 -07:00
Arthur Ozga
61af315778 respond to comments 2017-06-26 10:55:04 -07:00
Ryan Cavanaugh
b52747e12c Add property comments as well 2017-06-26 10:54:18 -07:00
Andy
fd22a88abc Code cleanup in jsTyping.ts (#16632) 2017-06-23 10:03:01 -07:00
Ryan Cavanaugh
04d750f9f8 Preserve method comments in JS->ES6 conversion. Fixes #16622 2017-06-22 11:45:34 -07:00
Arthur Ozga
485927b26a clarify comment 2017-06-22 11:17:55 -07:00
Andrew Casey
aac7fb7cef Merge pull request #16664 from amcasey/TokenWorker
Short-circuit getTokenAtPositionWorker
2017-06-22 10:44:47 -07:00