使用Visual Studio Code编辑以及debug apex

准备阶段
安装Visual Studio Code
https://code.visualstudio.com/

安装salesforce 命令行工具
https://developer.salesforce.com/tools/sfdxcli.
验证安装是否正确
在windows命令行 输入命令

sfdx update

安装插件
在Visual Studio Code中的Extension中搜索相关插件安装
插件 :salesforce extension pack
Apex Replay Debugger

安装java ide
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

配置java环境
1,In Visual Studio Code, click File > Preferences > Settings (Windows or Linux) or Code > Preferences > Settings (macOS).
2,Enter apex java in the search box, then under the Salesforcedx-vscode-apex > Java: Home section, click Edit in settings.json.
3,change salesforcedx-vscode-apex.java.home like this ,then relunch.

	{
    "salesforcedx-vscode-apex.java.home": "C:\\Program Files\\Java\\jdk1.8.0_191",
    "explorer.confirmDelete": false,
    "force.autoRefresh": true
}

Debug阶段
运行测试
SFDX: Invoke Apex Tests
设定断点和观察点
Debug: Toggle Breakpoint
SFDX: Toggle Checkpoint
设定观察点后,要把设定的观察点部署到系统
SFDX: Update Checkpoints in Org
设定断点和观察点后,打开生成Debug log 开关
SFDX: Turn On Apex Debug Log for Replay Debugger
获取Debug log文档
SFDX: Get Apex Debug Logs…
Log存放目录
.sfdx/tools/debug/logs
右键点击目录中任意一行,然后执行下面命令,就可以进行debug
SFDX: Launch Apex Replay Debugger with Current File.

你可能感兴趣的:(Salesforce学习)