Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom terminal executable settings #973

Merged
merged 3 commits into from May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 18 additions & 16 deletions docs/SETTINGS.md
Expand Up @@ -92,22 +92,24 @@ These settings are used to configure the [Code coverage](./COVERAGE.md) colors.

## Extension Behaviour Settings

| Setting ID | Description | Scope |
| -------------------------------------- | --------------------------------------------------------------------------- | ------------------------- |
| `idf.enableUpdateSrcsToCMakeListsFile` | Enable update source files in CMakeLists.txt (default `true`) | User, Remote or Workspace |
| `idf.flashType` | Preferred flash method. DFU, UART or JTAG | |
| `idf.launchMonitorOnDebugSession` | Launch ESP-IDF Monitor along with ESP-IDF Debug session | |
| `idf.notificationSilentMode` | Silent all notifications messages and show tasks output (default `true`) | User, Remote or Workspace |
| `idf.showOnboardingOnInit` | Show ESP-IDF Configuration window on extension activation | User, Remote or Workspace |
| `idf.saveScope` | Where to save extension settings | User, Remote or Workspace |
| `idf.saveBeforeBuild` | Save all the edited files before building (default `true`) | |
| `idf.useIDFKconfigStyle` | Enable style validation for Kconfig files | |
| `idf.telemetry` | Enable Telemetry | User, Remote or Workspace |
| `idf.deleteComponentsOnFullClean` | Delete `managed_components` on full clean project command (default `false`) | User, Remote or Workspace |
| `idf.monitorNoReset` | Enable no-reset flag to IDF Monitor (default `false`) | User, Remote or Workspace |
| `idf.monitorStartDelayBeforeDebug` | Delay to start debug session after IDF monitor execution | User, Remote or Workspace |
| `idf.enableStatusBar` | Show or hide the extension status bar items | User, Remote or Workspace |
| `idf.enableSizeTaskAfterBuildTask` | Enable IDF Size task to be executed after IDF Build task | User, Remote or Workspace |
| Setting ID | Description | Scope |
| -------------------------------------- | ------------------------------------------------------------------------------ | ------------------------- |
| `idf.enableUpdateSrcsToCMakeListsFile` | Enable update source files in CMakeLists.txt (default `true`) | User, Remote or Workspace |
| `idf.flashType` | Preferred flash method. DFU, UART or JTAG | |
| `idf.launchMonitorOnDebugSession` | Launch ESP-IDF Monitor along with ESP-IDF Debug session | |
| `idf.notificationSilentMode` | Silent all notifications messages and show tasks output (default `true`) | User, Remote or Workspace |
| `idf.showOnboardingOnInit` | Show ESP-IDF Configuration window on extension activation | User, Remote or Workspace |
| `idf.saveScope` | Where to save extension settings | User, Remote or Workspace |
| `idf.saveBeforeBuild` | Save all the edited files before building (default `true`) | |
| `idf.useIDFKconfigStyle` | Enable style validation for Kconfig files | |
| `idf.telemetry` | Enable Telemetry | User, Remote or Workspace |
| `idf.deleteComponentsOnFullClean` | Delete `managed_components` on full clean project command (default `false`) | User, Remote or Workspace |
| `idf.monitorNoReset` | Enable no-reset flag to IDF Monitor (default `false`) | User, Remote or Workspace |
| `idf.monitorStartDelayBeforeDebug` | Delay to start debug session after IDF monitor execution | User, Remote or Workspace |
| `idf.enableStatusBar` | Show or hide the extension status bar items | User, Remote or Workspace |
| `idf.enableSizeTaskAfterBuildTask` | Enable IDF Size task to be executed after IDF Build task | User, Remote or Workspace |
| `idf.customTerminalExecutable` | Absolute path to shell terminal executable to use (default to vscode Terminal) | User, Remote or Workspace |
| `idf.customTerminalExecutableArgs` | Shell arguments for idf.customTerminalExecutable | User, Remote or Workspace |

## Custom tasks for build and flash tasks

Expand Down
2 changes: 2 additions & 0 deletions i18n/en/package.i18n.json
Expand Up @@ -122,6 +122,8 @@
"param.enableCCache.title": "Enable CCache in build task",
"param.monitorStartDelayBeforeDebug": "Delay to start debug session after IDF monitor execution (ms)",
"param.monitorNoReset": "Enable no-reset flag to IDF Monitor",
"param.customTerminalExecutable.title": "Custom executable for extensions tasks",
"param.customTerminalExecutableArgs.title": "List of arguments for the custom executable for extension tasks",
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.connect.title": "Connect with ESP-Rainmaker Cloud Server",
"esp.rainmaker.backend.logout.title": "Unlink Rainmaker Account",
Expand Down
2 changes: 2 additions & 0 deletions i18n/es/package.i18n.json
Expand Up @@ -108,6 +108,8 @@
"param.monitorNoReset": "Habilitar no-reset en el IDF Monitor",
"param.enableStatusBar.title": "Habilitar elementos de la barra de estatus de la extension ESP-IDF",
"param.enableSizeTaskAfterBuildTask.title": "Habilitar la tarea de IDF Size luego de la tarea IDF Build",
"param.customTerminalExecutable.title": "Ejecutable personalizado para las tareas de la extensión ESP-IDF",
"param.customTerminalExecutableArgs.title": "Lista de argumentos para el ejecutble personalizado de tareas de la extensión ESP-IDF",
"view.components.name": "Componentes de proyecto",
"configuration.title": "ESP-IDF",
"espIdf.apptrace.archive.refresh.title": "Refresh Trace Archive List",
Expand Down
2 changes: 2 additions & 0 deletions i18n/ru/package.i18n.json
Expand Up @@ -122,6 +122,8 @@
"param.notificationSilentMode": "Отключите все уведомления расширения ESP-IDF (за исключением уведомлений об ошибках)",
"param.saveScope": "Куда сохранять конфигурацию с помощью команд ESP-IDF с числовым значением vscode.ConfigurationTarget. Глобально = 1, Рабочая область = 2, Папка рабочей области = 3",
"param.rainmaker.api.server_url": "URL облачного сервера ESP-Rainmaker",
"param.customTerminalExecutable.title": "Пользовательский исполняемый файл для задач расширения",
"param.customTerminalExecutableArgs.title": "Список аргументов для пользовательского исполняемого файла для задач расширения",
"esp.rainmaker.backend.sync.title": "Синхронизация с облачным сервером ESP-Rainmaker",
"esp.rainmaker.backend.connect.title": "Подключится к облачному серверу ESP-Rainmaker",
"esp.rainmaker.backend.logout.title": "Отвязать аккаунт Rainmaker",
Expand Down
2 changes: 2 additions & 0 deletions i18n/zh-CN/package.i18n.json
Expand Up @@ -122,6 +122,8 @@
"param.notificationSilentMode": "禁用所有 ESP-IDF 扩展通知(排除错误通知)",
"param.saveScope": "将 ESP-IDF 命令将配置保存到 vscode.ConfigurationTarget。全局 = 1, 工作区= 2, 工作区文件夹=3",
"param.rainmaker.api.server_url": "ESP-Rainmaker 云服务器地址",
"param.customTerminalExecutable.title": "用于扩展任务的自定义可执行文件",
"param.customTerminalExecutableArgs.title": "扩展任务的自定义可执行文件的参数列表",
"esp.rainmaker.backend.sync.title": "同步到 ESP-Rainmaker 云服务器",
"esp.rainmaker.backend.connect.title": "连接到 ESP-Rainmaker 云服务器",
"esp.rainmaker.backend.logout.title": "取消关联 ESP-Rainmaker 帐户",
Expand Down
12 changes: 12 additions & 0 deletions package.json
Expand Up @@ -858,6 +858,18 @@
"description": "%param.enableSizeTaskAfterBuildTask.title%",
"scope": "resource",
"default": true
},
"idf.customTerminalExecutable": {
"type": "string",
"description": "%param.customTerminalExecutable.title%",
"scope": "resource",
"default": ""
},
"idf.customTerminalExecutableArgs": {
"type": "array",
"description": "%param.customTerminalExecutableArgs.title%",
"scope": "resource",
"default": []
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Expand Up @@ -120,6 +120,8 @@
"param.rainmaker.api.server_url": "ESP-Rainmaker cloud server URL",
"param.launchMonitorOnDebugSession.title": "Start IDF Monitor along with ESP-IDF Debug Adapter session",
"param.enableIdfComponentManager.title": "Enable IDF Component Manager in build task",
"param.customTerminalExecutable.title": "Custom executable for extensions tasks",
"param.customTerminalExecutableArgs.title": "List of arguments for the custom executable for extension tasks",
"param.enableCCache.title": "Enable CCache in build task",
"param.enableSizeTaskAfterBuildTask.title": "Enable IDF Size task after build task",
"esp.rainmaker.backend.sync.title": "Sync with ESP-Rainmaker Cloud Server",
Expand Down
31 changes: 31 additions & 0 deletions src/build/buildTask.ts
Expand Up @@ -131,6 +131,22 @@ export class BuildTask {
cwd: this.buildDirPath,
env: modifiedEnv,
};
const shellExecutablePath = idfConf.readParameter(
"idf.customTerminalExecutable",
this.curWorkspace
) as string;
const shellExecutableArgs = idfConf.readParameter(
"idf.customTerminalExecutableArgs",
this.curWorkspace
) as string[];
if (shellExecutablePath) {
options.executable = shellExecutablePath;
}

if (shellExecutableArgs && shellExecutableArgs.length) {
options.shellArgs = shellExecutableArgs;
}

const isSilentMode = idfConf.readParameter(
"idf.notificationSilentMode",
this.curWorkspace
Expand Down Expand Up @@ -236,6 +252,21 @@ export class BuildTask {
env: modifiedEnv,
};

const shellExecutablePath = idfConf.readParameter(
"idf.customTerminalExecutable",
this.curWorkspace
) as string;
const shellExecutableArgs = idfConf.readParameter(
"idf.customTerminalExecutableArgs",
this.curWorkspace
) as string[];
if (shellExecutablePath) {
options.executable = shellExecutablePath;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
options.shellArgs = shellExecutableArgs;
}

const isSilentMode = idfConf.readParameter(
"idf.notificationSilentMode",
this.curWorkspace
Expand Down
14 changes: 14 additions & 0 deletions src/customTasks/customTaskProvider.ts
Expand Up @@ -87,6 +87,20 @@ export class CustomTask {
cwd: this.currentWorkspace.fsPath,
env: modifiedEnv,
};
const shellExecutablePath = readParameter(
"idf.customTerminalExecutable",
this.currentWorkspace
) as string;
const shellExecutableArgs = readParameter(
"idf.customTerminalExecutableArgs",
this.currentWorkspace
) as string[];
if (shellExecutablePath) {
options.executable = shellExecutablePath;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
options.shellArgs = shellExecutableArgs;
}
const isSilentMode = readParameter(
"idf.notificationSilentMode",
this.currentWorkspace
Expand Down
10 changes: 10 additions & 0 deletions src/espIdf/monitor/command.ts
Expand Up @@ -90,6 +90,14 @@ export async function createNewIdfMonitor(
const projectName = await getProjectName(buildDirPath);
const elfFilePath = join(buildDirPath, `${projectName}.elf`);
const toolchainPrefix = utils.getToolchainToolName(idfTarget, "");
const shellPath = readParameter(
"idf.customTerminalExecutable",
workspaceFolder
) as string;
const shellExecutableArgs = readParameter(
"idf.customTerminalExecutableArgs",
workspaceFolder
) as string[];
const monitor = new IDFMonitor({
port,
baudRate: sdkMonitorBaudRate,
Expand All @@ -101,6 +109,8 @@ export async function createNewIdfMonitor(
elfFilePath,
workspaceFolder,
toolchainPrefix,
shellPath,
shellExecutableArgs
});
return monitor;
}
6 changes: 4 additions & 2 deletions src/espIdf/monitor/index.ts
Expand Up @@ -31,6 +31,8 @@ export interface MonitorConfig {
toolchainPrefix: string;
wsPort?: number;
workspaceFolder: Uri;
shellPath: string;
shellExecutableArgs: string[];
}

export class IDFMonitor {
Expand All @@ -50,8 +52,8 @@ export class IDFMonitor {
modifiedEnv.IDF_PATH ||
process.cwd(),
strictEnv: true,
shellArgs: [],
shellPath: env.shell,
shellArgs: this.config.shellExecutableArgs || [],
shellPath: this.config.shellPath || env.shell,
});
this.terminal.show();
this.terminal.dispose = this.dispose.bind(this);
Expand Down
14 changes: 14 additions & 0 deletions src/espIdf/size/idfSizeTask.ts
Expand Up @@ -72,6 +72,20 @@ export class IdfSizeTask {
cwd: this.curWorkspace.fsPath,
env: modifiedEnv,
};
const shellExecutablePath = readParameter(
"idf.customTerminalExecutable",
this.curWorkspace
) as string;
const shellExecutableArgs = readParameter(
"idf.customTerminalExecutableArgs",
this.curWorkspace
) as string[];
if (shellExecutablePath) {
options.executable = shellExecutablePath;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
options.shellArgs = shellExecutableArgs;
}
const sizeExecution = await this.getShellExecution(options);
const isSilentMode = readParameter(
"idf.notificationSilentMode",
Expand Down
15 changes: 15 additions & 0 deletions src/espMatter/espMatterDownload.ts
Expand Up @@ -81,6 +81,21 @@ export class EspMatterCloning extends AbstractCloning {
const shellOptions: ShellExecutionOptions = {
cwd: workingDir,
};
const shellExecutablePath = readParameter(
"idf.customTerminalExecutable",
this.currWorkspace
) as string;
const shellExecutableArgs = readParameter(
"idf.customTerminalExecutableArgs",
this.currWorkspace
) as string[];
if (shellExecutablePath) {
shellOptions.executable = shellExecutablePath;
}
if (shellExecutableArgs && shellExecutableArgs.length) {
shellOptions.shellArgs = shellExecutableArgs;
}

const buildGnExec = this.getShellExecution(bootstrapFilePath, shellOptions);
const isSilentMode = readParameter("idf.notificationSilentMode", this.currWorkspace);
const showTaskOutput = isSilentMode
Expand Down
10 changes: 10 additions & 0 deletions src/extension.ts
Expand Up @@ -2628,6 +2628,14 @@ export async function activate(context: vscode.ExtensionContext) {
"idf.monitorNoReset",
workspaceRoot
) as boolean;
const shellPath = idfConf.readParameter(
"idf.customTerminalExecutable",
workspaceRoot
) as string;
const shellExecutableArgs = idfConf.readParameter(
"idf.customTerminalExecutableArgs",
workspaceRoot
) as string[];
const monitor = new IDFMonitor({
port,
baudRate: sdkMonitorBaudRate,
Expand All @@ -2640,6 +2648,8 @@ export async function activate(context: vscode.ExtensionContext) {
elfFilePath,
wsPort,
workspaceFolder: workspaceRoot,
shellPath,
shellExecutableArgs,
});
if (wsServer) {
wsServer.close();
Expand Down
2 changes: 2 additions & 0 deletions src/support/configurationSettings.ts
Expand Up @@ -30,6 +30,8 @@ export function getConfigurationSettings(
espIdfPath: conf.get("idf.espIdfPath" + winFlag),
espMdfPath: conf.get("idf.espMdfPath" + winFlag),
espMatterPath: conf.get("idf.espMatterPath" + winFlag),
customTerminalExecutable: conf.get("idf.customTerminalExecutable"),
customTerminalExecutableArgs: conf.get("idf.customTerminalExecutableArgs"),
customExtraPaths: conf.get("idf.customExtraPaths"),
customExtraVars: conf.get("idf.customExtraVars"),
pythonBinPath: conf.get("idf.pythonBinPath" + winFlag),
Expand Down
2 changes: 2 additions & 0 deletions src/support/initReportObj.ts
Expand Up @@ -27,6 +27,8 @@ export function initializeReportObject() {
espMatterPath: undefined,
customExtraPaths: undefined,
customExtraVars: undefined,
customTerminalExecutable: undefined,
customTerminalExecutableArgs: undefined,
pythonBinPath: undefined,
pythonPackages: undefined,
serialPort: undefined,
Expand Down
2 changes: 2 additions & 0 deletions src/support/types.ts
Expand Up @@ -43,6 +43,8 @@ export class Configuration {
openOcdConfigs: string[];
toolsPath: string;
gitPath: string;
customTerminalExecutable: string;
customTerminalExecutableArgs: string[];
}

export class ConfigurationSpacesValidation {
Expand Down
6 changes: 6 additions & 0 deletions src/support/writeReport.ts
Expand Up @@ -56,6 +56,12 @@ export async function writeTextReport(
output += `OpenOCD Configs (idf.openOcdConfigs) ${reportedResult.configurationSettings.openOcdConfigs}${EOL}`;
output += `ESP-IDF Tools Path (idf.toolsPath) ${reportedResult.configurationSettings.toolsPath}${EOL}`;
output += `Git Path (idf.gitPath) ${reportedResult.configurationSettings.gitPath}${EOL}`;
if (reportedResult.configurationSettings.customTerminalExecutable) {
output += `Custom terminal executable (idf.customTerminalExecutable) ${reportedResult.configurationSettings.customTerminalExecutable}${EOL}`;
}
if (reportedResult.configurationSettings.customTerminalExecutableArgs && reportedResult.configurationSettings.customTerminalExecutableArgs.length) {
output += `Custom terminal executable args (idf.customTerminalExecutableArgs)${reportedResult.configurationSettings.customTerminalExecutableArgs}${EOL}`;
}
output += `-------------------------------------------------------- Configurations access -------------------------------------------------------------${EOL}`;
output += `Access to ESP-ADF Path (idf.espAdfPath) ${reportedResult.configurationAccess.espAdfPath}${EOL}`;
output += `Access to ESP-IDF Path (idf.espIdfPath) ${reportedResult.configurationAccess.espIdfPath}${EOL}`;
Expand Down