fix: support hcpu/lcpu project entry for run triggers#26
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates project path resolution so build/run-related features work when the project’s SConscript lives under project/hcpu or project/lcpu (instead of only project/).
Changes:
- Add
LCPU_SUBFOLDERconstant and extend project detection to locateSConscriptunderproject/hcpu,project/lcpu, orproject/. - Extend
getProjectInfo()to return the resolved project entry path (absolute + workspace-relative). - Update terminal cd behavior, board command generation, and clangd config generation to use the resolved project entry path.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils/projectUtils.ts | Adds workspace root helper and logic to resolve the effective project entry directory based on where SConscript is found. |
| src/services/terminalService.ts | Uses resolved project entry path when cd-ing the terminal into the project. |
| src/services/boardService.ts | Uses resolved project entry path/relative path for build folder and board search path computations. |
| src/constants/index.ts | Adds LCPU_SUBFOLDER = 'lcpu'. |
| src/commands/configCommands.ts | Builds clangd --compile-commands-dir using the resolved project entry relative path. |
Comments suppressed due to low confidence (2)
src/services/boardService.ts:166
projectPathfalls back to an empty string whengetProjectInfo()returns null. That makes subsequentpath.relative(projectPath, ...)calculations use the process CWD (Node treats "" as "."), which can generate incorrect--board_search_pathvalues forproject_local/customboards. Use a deterministic fallback (e.g.${workspaceRoot}/project) or return/throw whenprojectInfois missing sopath.relativealways has a valid base path.
const projectInfo = getProjectInfo();
const projectPath = projectInfo?.projectEntryPath || '';
let boardSearchArg = '';
const availableBoards = await this.discoverBoards();
const currentBoard = availableBoards.find(b => b.name === boardName);
if (currentBoard) {
if (currentBoard.type === 'sdk') {
boardSearchArg = '';
} else if (currentBoard.type === 'project_local') {
const projectLocalBoardsDir = path.dirname(currentBoard.path);
const relativeToProject = path.relative(projectPath, projectLocalBoardsDir);
boardSearchArg = ` --board_search_path="${relativeToProject}"`;
} else if (currentBoard.type === 'custom') {
const relativeToProject = path.relative(projectPath, currentBoard.path);
boardSearchArg = ` --board_search_path="${path.dirname(relativeToProject)}"`;
src/services/boardService.ts:192
- Same issue as
getCompileCommand: falling back toprojectPath = ''makespath.relative(projectPath, ...)compute relative paths from the process CWD, producing incorrect--board_search_pathvalues whenprojectInfois null. Prefer a deterministic fallback base path (workspaceRoot/project) or fail early if no project can be resolved.
const projectInfo = getProjectInfo();
const projectPath = projectInfo?.projectEntryPath || '';
let boardSearchArg = '';
const availableBoards = await this.discoverBoards();
const currentBoard = availableBoards.find(b => b.name === boardName);
if (currentBoard && currentBoard.type !== 'sdk') {
if (currentBoard.type === 'project_local') {
const projectLocalBoardsDir = path.dirname(currentBoard.path);
const relativeToProject = path.relative(projectPath, projectLocalBoardsDir);
boardSearchArg = ` --board_search_path="${relativeToProject}"`;
} else if (currentBoard.type === 'custom') {
const relativeToProject = path.relative(projectPath, currentBoard.path);
boardSearchArg = ` --board_search_path="${path.dirname(relativeToProject)}"`;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
livewithme
reviewed
Feb 12, 2026
livewithme
pushed a commit
that referenced
this pull request
Mar 4, 2026
* fix: support hcpu/lcpu project entry for run triggers Co-authored-by: bakacai <bakacai@outlook.com>
livewithme
pushed a commit
that referenced
this pull request
Mar 17, 2026
* fix: support hcpu/lcpu project entry for run triggers Co-authored-by: bakacai <bakacai@outlook.com>
livewithme
pushed a commit
that referenced
this pull request
Mar 17, 2026
* fix: support hcpu/lcpu project entry for run triggers Co-authored-by: bakacai <bakacai@outlook.com>
livewithme
added a commit
that referenced
this pull request
Mar 20, 2026
* fix: support hcpu/lcpu project entry for run triggers (#26) * fix: support hcpu/lcpu project entry for run triggers Co-authored-by: bakacai <bakacai@outlook.com> * feat: 添加编译,文件是否保存检查 * chore: 添加遗漏的Save Dialog Alert 文本 * fix: 2 conversation advice * refactor(save-check): 重构保存检查的二次弹窗逻辑 * chore: 删除不记住 * chore: 回退 boardService * chore: rebase 之后功能修复,构建也需要检测时候保存 * fix: 修复QuickPick buildWithCheck 错误 * optimize: 1. 选择保存当前文件情况下,如果存在多个文件未保存,弹出选项给用户选择,2. 只有一个文件未保存的情况下,将焦点且到未保存文件,再进行保存 * optimize: 优化添加项目配置管理方式 设置构建保存偏好 * chore: 把构建保存配置到外层 --------- Co-authored-by: luyaoyao <382708508@qq.com> Co-authored-by: bakacai <bakacai@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.