6204 Commits

Author SHA1 Message Date
TypeScript Bot
ea5a43a290
Cherry-pick PR #47830 into release-4.6 (#47928)
Component commits:
8f0e9356c3 fix(47820): forbid extraction jsdoc

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
2022-02-17 16:59:09 -08:00
Andrew Branch
954d0442eb
Avoid auto-importing from barrel re-exporting index files that are likely to make an import cycle (#47516)
* Avoid auto-importing from barrel re-exporting index files that are likely to make an import cycle

* Finish fixing merge conflict
2022-02-10 15:05:08 -08:00
Oleksandr T
b456702755
feat(11378): check param names in JSDoc (#47257) 2022-02-10 10:02:07 -08:00
Oleksandr T
c06849ad16
fix(47787): show QF to delete parameter in getter (#47797) 2022-02-08 13:39:54 -08:00
Oleksandr T
17b97ccc43
fix(47788): forbid convertToMappedObjectType QF in invalid index signatures (#47798) 2022-02-08 11:36:45 -08:00
Andrew Casey
c216b2db5b
Trace document registry operations (#47785)
...to help detect misconfigurations like #47687.
2022-02-07 16:10:38 -08:00
Oleksandr T
867470ca26
fix(47783): show globals completion in case keyword outside of switch statement (#47786) 2022-02-07 14:08:35 -08:00
Oleksandr T
afeacf41bd
fix(47782): forbid super() extraction outside this container (#47784) 2022-02-07 13:26:39 -08:00
Andrew Branch
9c3b41d3cc
Refactor named imports to default instead of namespace when esModuleInterop is on and module is an export= (#47744) 2022-02-04 17:11:25 -08:00
Oleksandr T
8ddead50eb
fix(32941): include Template tag constraint to QuickInfo response (#47567) 2022-02-04 16:12:23 -08:00
Oleksandr T
ceee975052
fix(45917): show completions in string literal followed by a comma (#46970) 2022-02-04 12:15:02 -08:00
Andrew Branch
300a53c333
Auto-import perf: Do symbol name/flags filtering before cache rehydration (#47678)
* Do symbol name filtering before cache rehydration

* Fix typo

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

* Update test

* Fix variable clobbered in merge conflict

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-02-04 09:17:55 -08:00
Oleksandr T
0d5abd8a15
feat(27601): include JSDoc comments for destructuring arguments (#46886) 2022-02-03 11:27:40 -08:00
Oliver Joseph Ash
b7d011777e
"Convert parameters to destructured object": enable for functions with just one parameter (#46945)
* "Convert parameters to destructured object": enable for functions with just one parameter

Fixes https://github.com/microsoft/TypeScript/issues/41753

* Add test
2022-02-03 10:13:05 -08:00
Nathan Shively-Sanders
c4fd0028f5
Fix @link https:// formatting (#47705)
* Fix @link https:// formatting

Also improve .d.ts formatting of `@link`,`@linkcode`,`@linkplain`.

Fixes #46734

1. Previously, `@link` incorrectly put a space between "https" and "://"
when formatting jsdoc for editors. Now it does not.
2. When fixing the same output for .d.ts, I discovered that all `@link` tags
were formatted as `@link`, even if they were `@linkcode` or
`@linkplain`. I fixed that too.

* semicolon lint
2022-02-02 14:00:08 -08:00
Oleksandr T
854cec7387
fix(47670): remove import alias that uses the same name (#47676) 2022-02-02 10:45:18 -08:00
Zzzen
880e2c0783
support quickinfo and go-to-definition on typeof this (#47085)
* support quickinfo and go-to-definition on `typeof this`

* update baseline

* move code to checkIdentifier
2022-02-01 16:16:01 -08:00
Oleksandr T
2d501b1d98
fix(47582): skip extraction if the type node is in the range of the type parameter declaration (#47596) 2022-01-28 12:19:48 -08:00
Gabriela Araujo Britto
90280518ae
Add assert keyword in completions (#47644)
* add contextual keyword assert in completions

* clean up
2022-01-27 16:17:43 -08:00
Andrew Branch
4d298591db
Fix duplicate completions from two different copies of a node_modules package (#47584)
* Fix duplicate completions from two different copies of a node_modules package

* Fix logic for scoped packages

* Fix errors from merge

* Less gross way to reconcile these two conflicting PRs
2022-01-27 14:35:36 -08:00
Andrew Branch
e9092f3723
Proposal: simplify auto import descriptions (#47631)
* Simplify import fix descriptions

* Update tests

* Fix new test
2022-01-27 10:21:08 -08:00
Andrew Branch
5813a3541c
Allow moduleSymbolToValidIdentifier to be uppercase for JSX tags (#47625)
* Allow moduleSymbolToValidIdentifier to be uppercase for JSX tags

* Cleaner way of getting the uppercase name when needed

* Fix build errors, get rid of basically unnecessary ScriptTarget

* More accurate name for parameter

* Rename other parameter too

* Fix failing test
2022-01-26 16:12:40 -08:00
Andrew Branch
0d3ff0cce8
Add codefix and completions for promoting existing type-only imports to non-type-only (#47552)
* Import fix

* Wire up completions, add sorting to fix

* Fix overlapping changes when there’s only one import specifier

* Update API baseline

* Add sorting and filtering back to UMD fix
2022-01-26 15:07:41 -08:00
Jake Bailey
3718182a13
Don't block completion after end of type parameters in JSX elements (#47501) 2022-01-26 14:45:21 -08:00
Song Gao
0673f0288c
Fix JsDocTags inheritage and setter/getter quickInfo (#46801)
* tmp

* fix jsdoc inheritage for property and setter/getter

* fix test

* fix test

* fix mirrors

* add more tests

* add tests of jsdoc for intance of class
2022-01-25 15:43:12 -08:00
Oleksandr T
5e38082a9e
fix(47165): ignore spaces in goToDefinition imports (#47541) 2022-01-21 10:09:10 -08:00
Or Ouziel
5e09e86612
return early from fixUnreachableCode if syntactic errors exists (#47463) 2022-01-20 15:45:42 -08:00
Oleksandr T
e9453f411a
fix(47524): skip assertion on checking this in fixImplicitThis QF (#47527) 2022-01-20 14:58:28 -08:00
Wesley Wigham
bae0f50818
Fix import assertion occurrences crash and make import assertion parsing more generous (#47535) 2022-01-20 14:08:47 -08:00
Daniel Rosenwasser
04d77fe900
Update to TypeScript 4.5.5, fix semantic lints. (#47529)
* Update to TypeScript 4.5.5, fix semantic lints.

* Remove extra parens.

* Remove now-outdated non-null comment around #18217.
2022-01-20 11:33:30 -08:00
Eli Barzilay
8d9fa685b5 Avoid global mutations
This removes a few places where global compiler bindings are mutated:

1. Make `sysLog` call an internal binding which is changed via
   `setSysLog`.

2. Use `Object.assign` to change values *in* `objectAllocator` instead
   of mutating the binding itself.  (The type should verify that any
   future uses of this will properly override all bindings.)

3. `localizedDiagnosticMessages` is not really needed as an exported
   value, there's only one place that uses it to test whether it is set
   or not.  So drop the export and replace it with a new
   `maybeSetLocalizedDiagnosticMessages` (internal) function.
2022-01-19 20:01:19 -05:00
Daniel Rosenwasser
ad5ca673e6
Avoid crash for import code fixes with dotted require (#47433)
* Add failing test.

* Update failing test.

* Finalized failing test case.

* Separate our usages of utilities that expect variables initialized to require(...) and require(...).foo.

* Renamed types and utilities, removed accidental indentation.

* Renamed both utilitiy functions uniformly.
2022-01-19 15:05:01 -08:00
Jake Bailey
049d4e049f
Modify debug assertion to avoid crashing on SyntaxList (#47500) 2022-01-19 13:37:55 -08:00
Oleksandr T
c44fd466a7
fix(47451): Implicit 'any' quick fix text grabs text from wrong file (#47493) 2022-01-18 20:59:26 -08:00
Jake Bailey
2635102f7b
Deprecate ScriptElementKind.jsxAttribute (#47414) 2022-01-18 13:53:51 -08:00
Andrew Branch
d0b3ac376d
Better reuse of package.json cache, module resolution cache, and package.json auto import filter (#47388)
* Use package.json cache in module specifier generation

* Let AutoImportProviderProject reuse module resolution cache of host project

* Add missing module resolution cache access, add logging to getRootFileNames

* Reuse packageJsonImportFilter

* Only log when the project will be created, update API baseline

* Remove override that could mess up watches
2022-01-18 13:23:13 -08:00
Oleksandr T
8153475ca5
fix(47438): show auto-complete for this inside class static blocks (#47460) 2022-01-18 12:40:00 -08:00
Oleksandr T
febfd442cd
fix(47417): allow undefined type to be added to JSDoc types (#47449) 2022-01-16 13:44:07 -08:00
Andrew Branch
28c2084aca
Deprioritize import paths made up of only dots and slashes (#47432)
* Deprioritize import paths made up of only dots and slashes

* Fix test

* Hoist regex

* Yaaaay RegExp state
2022-01-14 10:33:05 -08:00
Jake Bailey
16bbddbd22
Rewrite logic for JSX attribute completion detection (#47412) 2022-01-14 09:56:57 -08:00
Oleksandr T
42ea5ec3d8
fix(47415): don't show addConvertToUnknownForNonOverlappingTypes QF in JS (#47424) 2022-01-13 11:17:36 -08:00
Daniel Rosenwasser
14f33d5c4b
Fix for crash in navbar with double ambient modules (#47395)
* Add failing test.

* Guard against undefined module bodies in navbar/navtree.
2022-01-11 18:14:22 -08:00
Daniel Rosenwasser
ed014db864
Add names for refactoring functions. (#47375)
* Add names for refactoring functions.

* Consistency in function names.
2022-01-11 12:20:17 -08:00
Andrew Branch
0f1496f354
Process package.json exports with auto-import provider (#47092)
* Have auto-import provider pull in `exports`

* Revert filtering of node_modules relative paths, to do in separate PR

* Do @types and JS prioritization correctly

* Cache entrypoints on PackageJsonInfo

* Add one more test

* Delete unused function

* Fix other tests - dependencies need package.json files

* Do two passes of exports resolution

* Fix missed refactor

* Apply suggestions from code review

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

* Uncomment rest of test

* Handle array targets

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-01-11 11:10:35 -08:00
Oleksandr T
6fc0584dd5
fix(46402): create valid property keys/jsx attribute names (#46716) 2022-01-07 11:46:26 -08:00
Gabriela Araujo Britto
404a7d602d
Gabritto/semicolons (#46832)
* call formatter in completions

* fixes

* add test

* update api baselines

* fix createModifiersFromModifierFlag to not return empty array
2022-01-04 11:50:49 -08:00
LowR
7e0e8671fa
fix(47134): show all meanings for type-only imports and exports (#47138) 2021-12-14 10:58:21 -08:00
Andrew Branch
430599722e
Fix extract type crash (#47136) 2021-12-13 10:39:34 -08:00
Oleksandr T
022542548e
fix(47043): as const cast wrong colour when using typescript 4.5.2 (#47066) 2021-12-08 10:15:58 -08:00
Oleksandr T
5f372d9d7e
fix(46606): show completion in jsdoc property tag (#46657) 2021-12-07 15:28:41 -08:00