Commit Graph

3857 Commits

Author SHA1 Message Date
Andy
478b404f42 Detect re-exports from "export *" in completions (#20043) 2017-11-16 11:15:14 -08:00
Andy
94581c1946 Strip "/index" from import fix module specifiers (#19962)
* Strip "/index" from import fix module specifiers

* Require "node" module resolution

* More tests
2017-11-16 11:12:34 -08:00
Ron Buckton
a21a129abb Merge branch 'master' into dynamicNames 2017-11-15 15:24:05 -08:00
Andy
d49491b3a7 smartIndenter: Don't indent after control-flow ending statements like break; (#20016)
* smartIndenter: Don't indent after control-flow ending statements like `break;`

* Fix bug

* Fix bug for function after `return`
2017-11-15 11:08:51 -08:00
Andy
592ee00906 Have CompletionEntryDetails source use a relative path (#19917)
* Have CompletionEntryDetails source use a relative path

* Use getCanonicalFileName from services Instead of creating a new one
2017-11-14 14:26:49 -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
Ryan Cavanaugh
de7fbc041a Merge pull request #19542 from RyanCavanaugh/fix19533
Exclude legacy safelist files in external projects
2017-11-10 15:28:35 -08:00
Wesley Wigham
06dd3f246f Fail fast on synthetic nodes in services (#19894) 2017-11-10 12:55:07 -08:00
Andy
b94940525b Allow applyCodeActionCommand to take an array (#19870)
* Allow applyCodeActionCommand to take an array

* Use this.host.newLine
2017-11-09 13:17:47 -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
Ryan Cavanaugh
b043edd61c Merge 2017-11-09 12:42:37 -08:00
Andy
5ad7e9516b Remove unnecessary wrapper classes in ts.formatting.Rule (#19744)
* Remove unnecessary wrapper classes in ts.formatting.Rule

* RulesProvider -> immutable FormatContext

* Remove Rules class, just use a list of rules

* Remove Shared namespace, replace Shared.TokenRange with TokenRange

* Simplify TokenRange

* Separate Rule and RuleSpec

* Move FormattingRequestKind to formattingContext.ts

* Simplify references

* Fix lint

* Revert removal of trailing newlines
2017-11-08 13:39:03 -08:00
Andy
1a0ec81488 quickInfo: Display info for signature on a separate line from variable info (#18698) 2017-11-08 09:56:50 -08:00
Nathan Shively-Sanders
9b36e1155a Merge pull request #19039 from Microsoft/guard-name-in-getSuggestionForNonexistentSymbol
In getSuggestionForNonexistentSymbol, guard name against undefined
2017-11-07 15:03:26 -08:00
Andrew Casey
62eeb7254c Merge pull request #19791 from amcasey/ImportLineBreaks
Handle windows linebreaks in getSourceFileImportLocation
2017-11-07 11:34:39 -08:00
Andrew Casey
2715f890b4 PascalCase -> camelCase 2017-11-07 10:47:36 -08:00
Andrew Casey
3e339d88a1 Handle other linebreak characters and add boundary checks 2017-11-07 10:33:35 -08:00
Andrew Casey
d1fa006a1e Use CharacterCode enum 2017-11-07 10:10:34 -08:00
Aluan Haddad
b2b54cbf5c Import fix add import require support (#19802)
* import fix: suggest import..require where supported if synthetic defaults are unavailable

* Add tests for import..require fix when targeting CommonJS, AMD, and UMD modules

* fix failing tests
2017-11-07 09:45:30 -08:00
Andy
bd2e97597d Enable 'no-empty' tslint rule (#19769)
* Enable 'no-empty' tslint rule

* Fix bug
2017-11-07 09:22:28 -08:00
Andy
2fcf8b7068 Fix assertion -- an import may come from a require() call (#19667)
* Fix assertion -- an import may come from a require() call

* Add test for `import("./a")`
2017-11-07 07:41:21 -08:00
Aluan Haddad
70cabdda41 fix inconsistencies in import UMD code fixes adapting to module format (#19572)
* improve import code fixes for UMD modules
 - use default import under --allowSyntheticDefaultImports
 - import..require support
 - make make quick fix info match resulting import
 - make diagnostics

* Address PR feedback:
 - extract test for synethetic default imports into getAllowSyntheticDefaultImports in core.ts
 - use getAllowSyntheticDefaultImports in checker.ts and importFixes.ts
 - move compilerOptions to top level destructuring

* add tests

* remove `import =` quick fix and supporting code.

* update feature tests

* remove errant whitespace
2017-11-06 22:55:37 -08:00
Andy
6d273cfb33 Consistently use "JSX Attribute" completion kind (#19781)
* Consistently use "JSX Attribute" completion kind

* Update tests and fix bug

* Fix bug: In a JsxOpeningElement, if at an Identifier we are not at an attribute but at the tag itself.
If at a GreaterThanToken, we are about to fill in an attribute.
2017-11-06 19:14:24 -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
Andy
77b24aec83 Apply 'unified-signatures' tslint rule (#19738)
* Apply 'unified-signatures' tslint rule

* Fix new failure
2017-11-06 18:38:03 -08:00
Andrew Casey
2f13222180 Handle windows linebreaks in getSourceFileImportLocation 2017-11-06 18:29:38 -08:00
Sean Barag
a46d2705ef Use documentation comments from inherited properties when @inheritDoc is present (#18804)
* Use documentation comments from inherited properties when @inheritDoc is present

The JSDoc `@ineheritDoc` [tag](http://usejsdoc.org/tags-inheritdoc.html)
"indicates that a symbol should inherit its documentation from its
parent class".  In the case of a TypeScript file, this also includes
implemented interfaces and parent interfaces.

With this change, a class method or property (or an interface property)
with the `@inheritDoc` tag in its JSDoc comment will automatically use
the comments from its nearest ancestor that has no `@inheritDoc` tag.
To prevent breaking backwards compatibility,
`Symbol.getDocumentationComment` now accepts an optional `TypeChecker`
instance to support this feature.

fixes #8912

* Use ts.getJSDocTags as per @andy-ms 's recommendation

* Convert @inheritDoc tests to verify.quickInfoAt

* Concatenate inherited and local docs when @inheritDoc is present

* Make typeChecker param explicitly `TypeChecker | undefined`

* Re-accept baseline after switch to explicit `| undefined`

* Update APISample_jsodc.ts to match new getDocumentationComment signature

* Re-accept baselines after rebasing
2017-11-06 13:18:21 -08:00
Andy
ed38889ca6 Enable 'no-unused-expression' tslint rule (#19734) 2017-11-06 13:01:07 -08:00
Benjamin Lichtman
4977bf4328 Merge pull request #19544 from uniqueiniquity/interfaceJsDoc
Insert JsDoc comment templates for additional nodes
2017-11-06 09:49:59 -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
Andy
8d5b0529b2 Add localizable diagnostic for "Install '{0}'" (#19651) 2017-11-03 18:14:21 -07:00
Andy
bb7fb7dda9 For getCompletionsAtPosition, require a flag to provide completions with code actions (#19687)
* For getCompletionsAtPosition, require a flag to provide completions with code actions

* Change name

* Increase API version

* Update API baselines

* Add comment

* Update API baseline
2017-11-03 15:55:31 -07:00
Andy
d998e97d8c Apply 'prefer-for-of' tslint rule (#19721) 2017-11-03 15:20:35 -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
749e151c23 Support path completions inside node_modules (#19692)
* Support path completions inside node_modules

* Fix: Start searching from current file's directory, not host.getCurrentDirectory()

* Add test for nested node_modules

* Also test in /src/folder/b.ts
2017-11-03 15:05:44 -07:00
uniqueiniquity
21093503a8 Respond to CR 2017-11-03 11:19:53 -07:00
uniqueiniquity
612616a105 Loosen restrictions on jsdoc completion locations 2017-11-03 09:53:56 -07:00
Andy
d54ad4b01a Add refactoring to use default import (#19659)
* Add refactoring to use default import

* Add localizable description
2017-11-03 08:31:13 -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
Andy
f67a9ba96e Apply 'interface-name' lint rule (#19695) 2017-11-02 17:20:18 -07:00
Andy
fd41521421 Enable 'callable-types' tslint rule (#19654) 2017-11-02 17:16:09 -07:00
Andy
01ad4f7dfb Support quick info at function and => locations (#19669)
* Support quick info at `function` and `=>` locations

* Fixes
2017-11-02 14:47:23 -07:00
uniqueiniquity
b1b611f40a Add undefined to return type 2017-11-02 11:08:26 -07:00
uniqueiniquity
12baae6c84 Revert "Return empty doc comment instead of undefined"
This reverts commit 22eb519b0f.
2017-11-02 10:59:58 -07:00
uniqueiniquity
509b9ad087 Complete to single line jsdoc comment if no params 2017-11-02 09:55:56 -07:00
Mike Morearty
1a7a587a9e Fix TokenOrIdentifierObject.getText() crash (#19673)
TokenOrIdentifierObject.getText() needs to pass `sourceFile` as an
argument to `getStart()`.

Fixes https://github.com/Microsoft/TypeScript/issues/19670
2017-11-01 16:37:06 -07:00
Nathan Shively-Sanders
146addc4d5 Use explicit undefined checkk 2017-11-01 10:35:54 -07:00
Nathan Shively-Sanders
f4d4e89fa9 Merge branch 'master' into guard-name-in-getSuggestionForNonexistentSymbol 2017-11-01 10:34:19 -07:00