970 Commits

Author SHA1 Message Date
Oleksandr T
f70cb769ef
feat(49928): Provide quick fix for a missing callback function (#49930)
* feat(49928): provide quick fix for a missing callback function

* remove addFunctionDeclarationFromSignature. fix formatting

* add tests
2022-08-09 15:28:03 -07:00
Oleksandr T
a44354af7c
fix(50188): omit QF on function arguments (#50189) 2022-08-04 17:52:09 -07:00
Josh Goldberg
ebd42abf95
Account for type parameters in missing function codefix (#49727)
* Account for type parameters in missing function codefix

* Apply suggestions from code review

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

* WIP

* Synthesize new type parameters instead of deep unions and intersections

* Pass along type parameter constraints

* E.T. phone home

* Clean up comments just a bit

* Only widen the instance type sometimes

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-07-26 15:22:19 -07:00
Oleksandr T
bcd22b47d2
fix(50048): remove token name from id (#50051) 2022-07-26 01:13:04 -07:00
Oleksandr T
455ea9b41f
fix(49964): handle auto-import dependencies/omit duplicate constraints (#50004) 2022-07-22 11:01:43 -07:00
Oleksandr T
91f7cfc501
fix(49392): show optional class methods with enabled strict option (#49768) 2022-07-18 14:49:13 -07:00
Wesley Wigham
52f4055174
For missing constraint quickfix insert position, Use node name end rather than related span end (#49673) 2022-06-29 11:46:42 -07:00
Oleksandr T
74d76e93b3
fix(49546): create computed property name for symbol props (#49554) 2022-06-20 13:46:47 -07:00
Andrew Branch
7e7c53961a
Add TS Server option to exclude files from auto-imports (#49578)
* Basic functionality

* Add tests

* Add test for ambient modules

* Add to protocol
2022-06-17 14:39:51 -07:00
Wesley Wigham
ba38fe1df2
Expand constraint suggestion related span and add quick fix (#49481)
* Expand constraint suggestion related span and add quick fix

* Remove circular constraint suggestions

* Add error code

* Style feedback and new error code in quickfix
2022-06-15 10:35:51 -07:00
Oleksandr T
806a710470
fix(49478): add return type to method signature (#49482) 2022-06-10 14:14:36 -07:00
Ron Buckton
1e65b330a7
Merge 'decorators' into 'modifiers' on various nodes (#49089)
* Merge 'decorators' into 'modifiers' on various Nodes

* Drop RESERVED argument in favor of removing parameter

* Ignore grammar error nodes when asserting invariants

* Revert 'illegalX' property renames

* PR Feedback
2022-06-09 17:24:02 -07:00
Andrew Branch
00c7c476dc
Avoid repeating codefix work when resolving auto-import specifiers for completions (#49442) 2022-06-09 10:37:16 -07:00
Oleksandr T
69214c0e56
fix(49001): handle missing imports in addMissingMember QF (#49009) 2022-05-09 15:52:15 -07:00
Daniel Rosenwasser
5f9c9a6ccf
Start Node ESM stable version at Node16 (#48879)
* Remove Node12, add Node16.

* Accepted baselines.

* Refactor checking for top-level await, give a better error message in CJS files.

* Accepted baselines.

* Stop erroring on JSON module imports in node ESM since they're no longer experimental.

* Accepted baselines.

* More refactoring, do the same checks for for-await loops.

* Accepted baselines.

* Adjust phrasing to permit for-await on CJS error.

* Accepted baselines.

* Accepted baselines.

* Fix lints.
2022-05-03 16:29:40 -07:00
Daniel Rosenwasser
18b08fc7c9
Use same error for iteration in <=ES5 (#48881)
* Use the same error for iterating over an Iterable in ES5 or lower.

* Accepted baselines.
2022-04-29 10:45:20 -07:00
Andrew Branch
476fc625df
Eagerly resolve module specifiers for auto-import completions in --moduleResolution node12+ (#48752)
* Add failing test

* Block auto-import module specifiers including node_modules path

* Eagerly resolve module specifiers in completions in nodenext so failures can be filtered

* Add completion info flags for telemetry

* Update API baseline

* Update completions baselines

* Fix missed boolean flip

* Fix remaining tests
2022-04-27 16:07:15 -07:00
Nicola Dardanis
d45012c5e2
Add JS-specific diagnostic message for resolve() in Promise where type argument can't be inferred (#48533)
* change error message on Promise

* fix(46570): Unhelpful Promise type argument hint in JS file

* refactor: Reword void Promise message for JSDoc type hint to provide better feedback

Co-authored-by: Osa <osaimola@gmail.com>
2022-04-27 11:55:35 -07:00
Andrew Branch
c99380f87b
Fix auto-import completions sometimes not updating existing imports (#48815) 2022-04-22 15:32:52 -07:00
Andrew Branch
8bd7ce6feb
Find Source Definition (#48264)
* Prototype resolving to JS when go-to-def aliases all resolve to ambient declarations

* Add test infrastructure

* Start fleshing out test coverage

* Fix some go-to-def stuff

* Finish lodash test case

* Make go-to-implementation never return ambient results

* Build new functionality into go-to-implementation

* Update baselines

* Two more test cases

* Refine definition searches for unresolved imports

* Revert "Build new functionality into go-to-implementation"

This reverts commit 381799d0f104000c676334c8e08fcdff9ccac896.

* Fix tests

* Revert go-to-implementation changes

* Wow a bunch of code was unnecessary

* Update baselines and go-to-def test

* Fix navigation on symbols that are not aliases but resolve through aliases in chain

* Temporarily replace go-to-def with new command implementation

* Revert "Temporarily replace go-to-def with new command implementation"

This reverts commit 34c6cfdebbb9e2506ea5e6d528d2cb57b2cdeb2e.

* Revert "Wow a bunch of code was unnecessary"

This reverts commit 1cb2ba646c9e80d1ca08b6fc3f6a2219aac44f67.

* Bring back some deleted code needed for a new test case

* Clean up a little

* Rename more stuff

* Update test

* Update API baseline

* Temporarily replace go-to-def with new command implementation

* PR review fixes

* Fix getTopMostDeclarationNamesInFile

* Rename local

* Use hash set

* Remove option from commandLineParser

* Keep noDtsResolution project around

* Handle AuxiliaryProject kind in ScriptInfo getDefaultProject etc.

* Do not run updateGraph in the background for AuxiliaryProject

* Don’t create auxiliary project outside of semantic mode

* No-op on scheduled invalidation

* Add comments to unit test

* Sync compiler options to auxiliary project

* Fix case sensitivity

* Update extensionIsOk with new file extensions

* PR feedback

* Update API baseline

* Mark scheduleInvalidateResolutionsOfFailedLookupLocations internal

* Use same heuristics on property accesses of loosely-resolvable aliases as unresolvable named imports

* Rename command, and no need to return the bound span

* Update API baseline
2022-04-14 15:44:19 -07:00
Andrew Branch
af3e1d4dfd
Reuse type nodes from optional parameters even when not written as a union with undefined (#48605)
* Reuse type nodes from optional parameters and properties even when not written as a union with `undefined`

* Remove newly unneeded NodeBuilderFlag

* Update public API

* Update baselines from main
2022-04-08 14:28:36 -07:00
Oleksandr T
aa3c5a787c
fix(48418): allow using empty tuple (#48420) 2022-04-04 14:56:35 -07:00
Oleksandr T
2db17fdda2
fix(48520): fix getting parameter type by index (#48521) 2022-04-03 21:42:37 -07:00
Oleksandr T
c639d3afb9
feat(27615): Add missing member fix should work for type literals (#47212) 2022-03-30 12:55:18 -07:00
Wesley Wigham
b5a3a058f5
Merge diagnosticsProducing and nonDiagnosticsProducing checkers into a single checker supporting lazy diagnostics (#36747)
* Merge diagnosticsProducing and nonDiagnosticsProducing checkers into a single checker supporting lazy diagnostics

* Fix lint
2022-03-23 16:21:06 -07:00
Minh Quy
4ec16b2a6b
Fix#48281 - Indentation not respected when executing various refactorings (TypeScript/JavaScript) (#48340)
* fix(48281) - Preserve indentation when adding missing properties

* fix(48281) - Fix object literal indentation like block

* fix(48281) - Indentation for object literal started with curly brace similar to block
2022-03-23 10:40:50 -07:00
Anders Hejlsberg
6cb58d382f
Optional variance annotations (#48240)
* Simplify getVariancesWorker and associated logic

* Accept new API baselines

* Add 'in' and 'out' modififers / add modifiers to type parameters

* Check variance annotations

* Update test runner

* Accept new API baselines

* Allow variance annotations only on certain type parameters

* Add deprecated implementation of createTypeParameterDeclaration

* Accept new API baselines

* Report variance markers as 'sub-XXX' and 'super-XXX'

* Add tests

* Accept new baselines
2022-03-22 11:31:08 -07:00
Andrew Branch
df1faa09b8
Add isolatedModules error for ambiguous imports referenced in decorator metadata (#42915)
* Add isolatedModules error for ambiguous imports referenced in decorator metadata

* Improve test and accept baselines

* Error only for es2015+

* Add namespace import to error message as workaround

* Add codefix

* Fix merge fallout
2022-03-17 12:00:23 -07:00
Minh Quy
b996287e00
fix(48191): Duplicates comments on "Add definite assignment assertion to property" (#48299)
* Suppress leading and trailing comments for adding missing definite assignment assertion action

* Suppress leading and trailing comments for adding missing initalizer action

* Test for initializer property action
2022-03-17 09:57:10 -07:00
Jake Bailey
4abad556be
Prevent crash on code fixes on default keyword (#48028) 2022-03-04 10:43:04 -08:00
Gabriela Araujo Britto
733eff2b10
Revert "Use related spans for "implement abstract class" errors" (#48029) 2022-02-24 16:15:31 -08:00
Gabriela Araujo Britto
4b395c6097 Merge branch 'related-spans-for-implement-abstract-class-error' of https://github.com/FlyingPumba/TypeScript into FlyingPumba-related-spans-for-implement-abstract-class-error 2022-02-24 16:11:03 -08:00
Oleksandr T
51d34466e7
feat(47281): use unknown type instead of any (#47308) 2022-02-17 13:54:02 -08:00
Oleksandr T
73506f3512
fix(46803): remove unused react imports with enabled react-jsxdev, react-jsx (#47247) 2022-02-11 11:13:26 -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 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
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
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
Oleksandr T
c44fd466a7
fix(47451): Implicit 'any' quick fix text grabs text from wrong file (#47493) 2022-01-18 20:59:26 -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
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
Oleksandr T
42ea5ec3d8
fix(47415): don't show addConvertToUnknownForNonOverlappingTypes QF in JS (#47424) 2022-01-13 11:17:36 -08:00
Oleksandr T
6fc0584dd5
fix(46402): create valid property keys/jsx attribute names (#46716) 2022-01-07 11:46:26 -08:00