1. Install the below extension in Visual Studio Code.
Salesforce Package.xml Generator Extension for VS Code helps in generating the package.xml file.
https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator
2. Pres Ctrl + Shift + P.
3. Enter package and select Package.xml Generator: Choose Metadata Components.
4. Choose Metadata Components for Package.XML.
5. Click Update Package.xml button to update the package.xml file.
Sample Package.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<types>
<members>*</members>
<name>ApexTestSuite</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>AuraDefinitionBundle</name>
</types>
<types>
<members>*</members>
<name>StaticResource</name>
</types>
<types>
<members>*</members>
<name>CustomApplication</name>
</types>
<types>
<members>*</members>
<name>ApprovalProcess</name>
</types>
<types>
<members>*</members>
<name>AssignmentRule</name>
</types>
<types>
<members>*</members>
<name>AuthProvider</name>
</types>
<types>
<members>*</members>
<name>CallCenter</name>
</types>
<types>
<members>*</members>
<name>Community</name>
</types>
<types>
<members>*</members>
<name>ConnectedApp</name>
</types>
<types>
<members>*</members>
<name>CustomApplicationComponent</name>
</types>
<types>
<members>*</members>
<name>CustomMetadata</name>
</types>
<types>
<members>*</members>
<name>CustomPermission</name>
</types>
<types>
<members>*</members>
<name>Dashboard</name>
</types>
<types>
<members>*</members>
<name>DataCategoryGroup</name>
</types>
<types>
<members>*</members>
<name>Document</name>
</types>
<types>
<members>*</members>
<name>EmailTemplate</name>
</types>
<types>
<members>*</members>
<name>EntitlementProcess</name>
</types>
<types>
<members>*</members>
<name>EntitlementTemplate</name>
</types>
<types>
<members>*</members>
<name>FlexiPage</name>
</types>
<types>
<members>*</members>
<name>Flow</name>
</types>
<types>
<members>*</members>
<name>Group</name>
</types>
<types>
<members>*</members>
<name>HomePageComponent</name>
</types>
<types>
<members>*</members>
<name>HomePageLayout</name>
</types>
<types>
<members>*</members>
<name>CustomLabels</name>
</types>
<types>
<members>*</members>
<name>Layout</name>
</types>
<types>
<members>*</members>
<name>MilestoneType</name>
</types>
<types>
<members>Account</members>
<members>AccountContactRole</members>
<members>Activity</members>
<members>Asset</members>
<members>AssetRelationship</members>
<members>AssistantProgress</members>
<members>Campaign</members>
<members>CampaignMember</members>
<members>Case</members>
<members>CaseContactRole</members>
<members>CaseMilestone</members>
<members>ChatterActivity</members>
<members>CollaborationGroup</members>
<members>CollaborationGroupMember</members>
<members>Contact</members>
<members>ContentVersion</members>
<members>Contract</members>
<members>ContractContactRole</members>
<members>ContractLineItem</members>
<members>DuplicateRecordItem</members>
<members>DuplicateRecordSet</members>
<members>EmailMessage</members>
<members>Entitlement</members>
<members>EntitlementContact</members>
<members>EntityMilestone</members>
<members>Event</members>
<members>ExchangeUserMapping</members>
<members>FeedItem</members>
<members>ForecastingAdjustment</members>
<members>ForecastingCategoryMapping</members>
<members>ForecastingOwnerAdjustment</members>
<members>ForecastingQuota</members>
<members>ForecastingTypeToCategory</members>
<members>Idea</members>
<members>Indicator_Badge__mdt</members>
<members>Lead</members>
<members>LeadGen_Reroute_Parent_Queue__mdt</members>
<members>Macro</members>
<members>MacroAction</members>
<members>MacroInstruction</members>
<members>Opportunity</members>
<members>OpportunityCompetitor</members>
<members>OpportunityContactRole</members>
<members>OpportunityLineItem</members>
<members>Order</members>
<members>OrderItem</members>
<members>PartnerRole</members>
<members>PersonAccount</members>
<members>Pricebook2</members>
<members>PricebookEntry</members>
<members>Product2</members>
<members>ProfileSkill</members>
<members>ProfileSkillEndorsement</members>
<members>ProfileSkillUser</members>
<members>QuickText</members>
<members>Quote</members>
<members>QuoteLineItem</members>
<members>RecordAction</members>
<members>RequestsForAccessSIQ</members>
<members>Scorecard</members>
<members>ScorecardAssociation</members>
<members>ScorecardMetric</members>
<members>ServiceContract</members>
<members>Site</members>
<members>SocialPersona</members>
<members>Solution</members>
<members>StreamActivityAccess</members>
<members>StreamingChannel</members>
<members>Task</members>
<members>Topic</members>
<members>TopicAssignment</members>
<members>User</members>
<members>WorkBadge</members>
<members>WorkBadgeDefinition</members>
<members>WorkOrder</members>
<members>WorkOrderLineItem</members>
<members>WorkThanks</members>
<members>*</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>Letterhead</name>
</types>
<types>
<members>*</members>
<name>CustomObjectTranslation</name>
</types>
<types>
<members>*</members>
<name>PermissionSet</name>
</types>
<types>
<members>*</members>
<name>PostTemplate</name>
</types>
<types>
<members>*</members>
<name>Profile</name>
</types>
<types>
<members>*</members>
<name>Queue</name>
</types>
<types>
<members>*</members>
<name>QuickAction</name>
</types>
<types>
<members>*</members>
<name>RemoteSiteSetting</name>
</types>
<types>
<members>*</members>
<name>ReportType</name>
</types>
<types>
<members>*</members>
<name>Workflow</name>
</types>
<types>
<members>*</members>
<name>Report</name>
</types>
<types>
<members>*</members>
<name>SiteDotCom</name>
</types>
<types>
<members>*</members>
<name>CustomSite</name>
</types>
<types>
<members>*</members>
<name>Scontrol</name>
</types>
<types>
<members>*</members>
<name>Settings</name>
</types>
<types>
<members>*</members>
<name>CustomTab</name>
</types>
<types>
<members>*</members>
<name>Translations</name>
</types>
<types>
<members>*</members>
<name>CustomPageWebLink</name>
</types>
<types>
<members>*</members>
<name>Role</name>
</types>
<types>
<members>*</members>
<name>SamlSsoConfig</name>
</types>
<types>
<members>*</members>
<name>SharingCriteriaRule</name>
</types>
<types>
<members>*</members>
<name>SharingOwnerRule</name>
</types>
<types>
<members>*</members>
<name>SharingTerritoryRule</name>
</types>
<!-- Embedded Service Deployments -->
<types>
<members>*</members>
<name>EmbeddedServiceConfig</name>
</types>
<!-- Messaging Component Start -->
<types>
<members>*</members>
<name>ConversationMessageDefinition</name>
</types>
<!-- Messaging Component End -->
<version>52.0</version>
</Package>
Reports, documents, email templates, etc are under folders and currently not supported to retrieve without mentioning the folder names.
For additional component names, check https://infallibletechie.com/2014/07/salesforce-components-names-for-ant-tool.html