-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add menuconfig abstraction framework with priority-based fallback #34
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b54d3d9
Initial plan
Copilot 3c5f8ee
feat: Add support for vscode-kconfig-visual-editor and menuconfig con…
Copilot 9af19c7
refine: Improve BSP menuconfig handling for vscode-kconfig-visual-editor
Copilot fbc23b0
refactor: Address code review feedback - extract constants and add er…
Copilot 952da81
refactor: Extract terminal menuconfig fallback logic to reduce duplic…
Copilot 4c4fefc
style: Use const instead of let for immutable variable
Copilot a081765
refactor: Comment out vscode-kconfig-visual-editor support until ready
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,74 @@ export function getParallelBuildNumber() { | |
|
|
||
| return parallel; | ||
| } | ||
|
|
||
| /* get whether to use terminal menuconfig only */ | ||
| export function getUseTerminalMenuconfig() { | ||
| const config = vscode.workspace.getConfiguration('smart'); | ||
| const useTerminal = config.get('useTerminalMenuconfig') as boolean; | ||
|
|
||
| return useTerminal; | ||
| } | ||
|
|
||
| /** | ||
| * Menuconfig method type | ||
| */ | ||
| export interface MenuconfigMethod { | ||
| type: 'extension' | 'terminal'; | ||
| command?: string; // VS Code command for extension type | ||
| terminal?: string; // Terminal command for terminal type | ||
| } | ||
|
|
||
| /** | ||
| * Extension command constants for menuconfig | ||
| */ | ||
| export const MENUCONFIG_COMMANDS = { | ||
| RT_THREAD_KCONFIG: 'rt-thread-kconfig.menuconfig.windows', | ||
| KCONFIG_VISUAL_EDITOR: 'kconfig-visual-editor.open' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @flyingcys 这里的扩展id对吗?谢谢 |
||
| }; | ||
|
|
||
| /** | ||
| * Get the appropriate menuconfig method based on installed extensions and configuration | ||
| * Priority: | ||
| * 1. If useTerminalMenuconfig is true, always use terminal | ||
| * 2. Check for rt-thread.rt-thread-kconfig extension | ||
| * 3. Check for ai-embedded.vscode-kconfig-visual-editor extension (currently disabled) | ||
| * 4. Fall back to terminal scons --menuconfig | ||
| * | ||
| * @param kconfigPath Optional Kconfig file path for vscode-kconfig-visual-editor | ||
| * @returns MenuconfigMethod object describing the method to use | ||
| */ | ||
| export function getMenuconfigMethod(kconfigPath?: string): MenuconfigMethod { | ||
| // Check if user wants to force terminal menuconfig | ||
| if (getUseTerminalMenuconfig()) { | ||
| return { | ||
| type: 'terminal', | ||
| terminal: 'scons --menuconfig' | ||
| }; | ||
| } | ||
|
|
||
| // Priority 1: Check for rt-thread-kconfig extension | ||
| const rtThreadKconfig = vscode.extensions.getExtension('rt-thread.rt-thread-kconfig'); | ||
| if (rtThreadKconfig !== undefined) { | ||
| return { | ||
| type: 'extension', | ||
| command: MENUCONFIG_COMMANDS.RT_THREAD_KCONFIG | ||
| }; | ||
| } | ||
|
|
||
| // Priority 2: Check for vscode-kconfig-visual-editor extension | ||
| // TODO: Uncomment when vscode-kconfig-visual-editor is ready | ||
| // const kconfigVisualEditor = vscode.extensions.getExtension('ai-embedded.vscode-kconfig-visual-editor'); | ||
| // if (kconfigVisualEditor !== undefined) { | ||
| // return { | ||
| // type: 'extension', | ||
| // command: MENUCONFIG_COMMANDS.KCONFIG_VISUAL_EDITOR, | ||
| // }; | ||
| // } | ||
|
|
||
| // Priority 3: Fall back to terminal menuconfig | ||
| return { | ||
| type: 'terminal', | ||
| terminal: 'scons --menuconfig' | ||
| }; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.