3876 Commits

Author SHA1 Message Date
Anders Hejlsberg
9d9dea0e77 Merge branch 'master' into fix41581 2020-12-03 17:27:10 -10:00
Jack Works
0b6c9254a8
Fix import tracker for dynamic import (#41473)
* chore: migrate findAllRefs_importType_js to baseline

* fix: reference for dynamic import

* fix: find all reference for typeof import()

* fix: test

* refactor: addIndirectUser

* refactor: isExported

* refactor: isExported

* resolve review
2020-12-02 14:46:20 -08:00
Ryan Cavanaugh
9a957e7b9c
Remove incorrect assert that triggers crash on completions of globalThis (#40278)
Fixes #39338
2020-12-02 11:47:32 -08:00
Armando Aguirre
fd50f1e3c9
Merge pull request #41543 from a-tarasyuk/fix/41534
fix(41534): Maximum call stack error while computing document symbol file
2020-12-01 18:03:11 -08:00
Wenlu Wang
55810095f4
Allow qualified name for convert namespace import (#41592) 2020-12-01 15:23:57 -08:00
Oleksandr T
23b3eb685f
fix(41621): fixUnusedIdentifier - allow deleting prefix/postfix unary operators (#41624) 2020-11-30 13:58:47 -08:00
Oleksandr T
1bd8e388ae
fix(41688): completions with infer keyword (#41704) 2020-11-30 11:56:12 -08:00
Song Gao
d5779c75d3
replace whole path if directory separator appears for import completion. (#41412)
* replace whole path if directory separator appears.

* Fix.

* revert change.

* Fix test case.

* add test.

* fix as suggested.

* revert useless change

* adapt to code change.

* fix baseline for test file.
2020-11-25 09:37:08 -08:00
Oleksandr T
5adb55eb18
feat(41216): show JSDoc for aliases (#41452) 2020-11-24 14:40:51 -08:00
Jean Pierre
71559a5c0c
Fix show deprecated suggestion for alias (#41128)
* Fix show deprecated suggestion for alias

* Fix failing tests

* Avoid duplicated kind modifiers
2020-11-23 15:50:12 -08:00
Anders Hejlsberg
bf1ac8ae49 Update fourslash test 2020-11-23 08:35:50 -10:00
Nathan Shively-Sanders
d057f7a992
Remove-unused-identifiers codefix skips assigned identifiers (#41168)
* Remove-all-unused-identifiers skips assigned identifiers

Previously, fixUnusedIdentifier worked the same in fix-all mode as for a
single fix: identifiers with assignments would be deleted:

```ts
function f(a) { }
f(1)
```

becomes

```ts
function f() { }
f()
```

But any kind of argument will be deleted, even one with side effects.
For a single codefix invocation, this is probably OK.
But for fix-all, this could lead to multiple changes
spread throughout a large file.

Now fix-all will only delete parameters and variable declarations with
no assignments:

```ts
function f(a) { }
function g(a) { }
f(1)
g
let x = 1
let y
```

becomes

```
function f(a) { }
function g() { }
f(1)
g
let x = 1
```

* Don't remove assigned parameters for single codefix either

* add optional parameter test case

* Skip initialised params and binding elements

Based on PR feedback from @amcasey

* fixAll removes unused binding patterns completely

* Fixes from comments

Thanks @amcasey for the thorough review

* fix trailing space lint

* correctly remove-all array binding
2020-11-21 09:57:17 -08:00
Oleksandr T
9bcbca4e6c fix(41534): fix children circular references 2020-11-20 22:41:12 +02:00
Nathan Shively-Sanders
d3abd35428
Unused Identifier codefix better understands constructors and methods (#41555)
* Unuse Identifier codefix understands constructors

Previously, it did not look for `super()` and `new this()` calls when
determining whether a constructor parameter could be deleted.

* better names, fix off-by-1 bug

* Codefix understands super methods now too

This unifies the code, changing it considerably.
2020-11-18 11:19:43 -08:00
Andrew Branch
266d8de64a
Proposal: importModuleSpecifierPreference: project-relative (#40637)
* Add new importModuleSpecifierPreference value

* Add second test

* Update API baselines

* Clean up and add some comments

* Rename option value
2020-11-11 11:48:32 -08:00
Nathan Shively-Sanders
64be2a8d16
Revert "Revert "feat(40197): handle uncalled function checks in binary expressions (#40260)"" (#41462)
This reverts commit cf3e28ea66bdfb4e438f86bd7d7860b66dae0ed8.
2020-11-09 11:34:41 -08:00
Wenlu Wang
ca7510ea05
String literal rename support (#39298)
* add basicly support for rename string literal type

* fix merge conflict

* fix some behavior

* Update package-lock.json

* Update package-lock.json

* do not break old behavior if not type checked

* fix cr issue

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2020-11-06 09:58:34 -08:00
Oleksandr T
899e2d00e9
fix(40469): suggest QF convert 'Convert to named function' to function expressions (#40476) 2020-11-05 10:25:24 -08:00
Oleksandr T
98aaeb7f48
fix(40610): handle template string concatenation (#40653) 2020-11-05 10:09:21 -08:00
Oleksandr T
09048656d2
feat(40750): add refactoring to infer a return type annotation to a function (#41052) 2020-11-03 16:22:13 -08:00
Oleksandr T
e4c1568c5d
fix(41078): add element access expressions support in convertFunctionToEs6Class (#41089) 2020-11-02 15:49:22 -08:00
Oleksandr T
3f92a6498f
fix(40257): fix type parameters range (#40265) 2020-11-02 15:20:13 -08:00
Wenlu Wang
ce8d702586
Add support for pedantic property access (#40171)
* Add support for pedantic property access

* accept baseline

* Update diag message

* Avoid pedantic

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-11-02 15:19:00 -08:00
Nathan Shively-Sanders
ae81add083
Separate delete-all-imports from other delete-all (#41105)
This fixes the first part of #32196
2020-11-02 14:18:50 -08:00
Oleksandr T
eb6ddf6b29
fix(40671): suggest ConvertStringToTemplateLiteral refactoring for string with property/element acceses elements (#40942) 2020-10-29 15:23:11 -07:00
Wesley Wigham
ca8a15d37b
Merge pull request #41287 from weswigham/bind-exports-assigned-object-as-alias
Bind `module.export = {Thing}` with alias symbols
2020-10-28 13:14:20 -07:00
Sheetal Nandi
e17d95dada
When creating synthetic default symbol set parent as module symbol (#41282)
Fixes #40684
2020-10-28 11:24:40 -07:00
Wesley Wigham
e96ce39b60
Fixup other fourslash test 2020-10-27 16:25:30 -07:00
Wesley Wigham
d1bc6b1ba6
Bind module.export = {Thing} with alias symbols 2020-10-27 15:43:00 -07:00
Michael
71cd5d522d
Fix two issues with ConvertToTypeOnlyExport codefix (#40490)
* Modify test case to reproduce error

* Fix TypeOnlyExport codefix to work with 3 or more type exports in the same declaration

The check to ensure that a fixed export declaration wasn't fixed again
was reversed. This only surfaced when 3 or more type exports existed in
the same declaration.

* Add failing test cases for comments being duplicated

* Fix convertToTypeOnlyExport codefix from duplicating leading comments

* Simplify convertToTypeOnlyExport when change is just inserting `type` keyword

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-27 15:08:20 -07:00
Oleksandr T
9ed608b439
fix(41244): ignore synthesized imports (#41267) 2020-10-27 13:22:02 -07:00
Oleksandr T
3754bb4455
fix(40994): change type for optional properties (#41011) 2020-10-27 10:05:40 -07:00
Alex T
417b8a9481
fix(29881): infer quote preference for property access conversion in completions (#41041) 2020-10-13 10:06:27 -07:00
Andrew Branch
83d02a5f05
Fix auto imports for export default edge cases (#41068) 2020-10-12 15:42:58 -07:00
Alex T
05be3b421a
fix: show deprecated error for alias (#40961) 2020-10-12 08:45:08 -07:00
Andrew Branch
4766a2e5a3
Fix overlapping changes when un-qualifying import use site within transformed export (#40987)
* Fix overlapping changes when un-qualifying import use site within transformed export

* Break long line
2020-10-09 13:24:18 -07:00
Alex T
23c5f9260c
fix(3758): show completion for object literals in an assignment pattern (#40976) 2020-10-08 12:27:53 -07:00
Nathan Shively-Sanders
cf3e28ea66 Revert "feat(40197): handle uncalled function checks in binary expressions (#40260)"
This reverts commit eaf4f46c172f9899306765e38a36c9517e04b676.
2020-10-07 14:14:49 -07:00
Alex T
eaf4f46c17
feat(40197): handle uncalled function checks in binary expressions (#40260) 2020-10-07 14:06:42 -07:00
Wesley Wigham
4dc7e59248
Merge pull request #40953 from weswigham/improve-completions-large-literal-perf
Improve the performance of requesting completions within a massive array literal
2020-10-07 12:44:20 -07:00
Alex T
5c55fc0a21
fix(40817): suggest import for default exported alias (#40845) 2020-10-06 09:52:35 -07:00
Alex T
1e49ad8370
fix(40685): fix generating docs for arrow functions (#40728) 2020-10-06 07:50:08 -07:00
Wesley Wigham
da57f9876e
Improve the performance of requesting completions within a massive array literal 2020-10-05 14:42:10 -07:00
Andrew Branch
6ee4a6b7f0
Skip past module.exports = { Foo } in go-to-defintion on 'Foo' (#40835)
* Add test

* Skip shorthand property assignments of module.exports in go-to-definition

* Skip past shorthand property assignments in module.exports in go-to-definition

* Revert WIP change

* Fix comment typo

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-10-05 11:47:19 -07:00
Andrew Branch
736363b427
Use other files when necessary to determine import style in JS (#40879)
* Use other files when necessary to determine import style in JS

* Fix existing tests
2020-10-05 11:39:20 -07:00
Andrew Branch
a301001420
Use correct program when checking for reexports from AutoImportProviderProject (#40843) 2020-09-30 09:32:19 -07:00
Alex T
df33dd593f
fix(40441): show deprecated error for deprecated property in namespace (#40605) 2020-09-30 08:26:35 -07:00
Armando Aguirre
f645418833
Merge pull request #40783 from armanio123/FixCommentOnStartLine
Fixed bug with toggleLineComment ends in a start line
2020-09-29 11:43:51 -07:00
Alex T
1e9f42fb16
fix(40609): add tests to cover TemplateLiteralType extraction (#40834) 2020-09-29 11:29:51 -07:00
Alex T
335ed915f1
fix(40609): fix crash for extracting type alias with several type arguments (#40820) 2020-09-28 23:12:15 -07:00