File tree Expand file tree Collapse file tree 5 files changed +60
-2
lines changed Expand file tree Collapse file tree 5 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -1126,6 +1126,7 @@ def generateProjectFiles(
11261126
11271127 # settings
11281128 settings = f'''{{
1129+ "cmake.showSystemKits": false,
11291130 "cmake.options.statusBarVisibility": "hidden",
11301131 "cmake.options.advanced": {{
11311132 "build": {{
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { EventEmitter } from "events";
33import { CommandWithResult } from "./command.mjs" ;
44import Logger from "../logger.mjs" ;
55import Settings , { SettingsKey } from "../settings.mjs" ;
6-
6+ import { cmakeToolsForcePicoKit } from "../utils/cmakeToolsUtil.mjs" ;
77export default class CompileProjectCommand extends CommandWithResult < boolean > {
88 private _logger : Logger = new Logger ( "CompileProjectCommand" ) ;
99
@@ -24,6 +24,9 @@ export default class CompileProjectCommand extends CommandWithResult<boolean> {
2424 settings !== undefined &&
2525 settings . getBoolean ( SettingsKey . useCmakeTools )
2626 ) {
27+ // Ensure the Pico kit is selected
28+ await cmakeToolsForcePicoKit ( ) ;
29+
2730 // Compile with CMake Tools
2831 await commands . executeCommand ( "cmake.launchTargetPath" ) ;
2932
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { CommandWithResult } from "./command.mjs";
33import { commands , window , workspace } from "vscode" ;
44import { join } from "path" ;
55import Settings , { SettingsKey } from "../settings.mjs" ;
6+ import { cmakeToolsForcePicoKit } from "../utils/cmakeToolsUtil.mjs" ;
67
78export default class LaunchTargetPathCommand extends CommandWithResult < string > {
89 constructor ( ) {
@@ -66,6 +67,9 @@ export default class LaunchTargetPathCommand extends CommandWithResult<string> {
6667 settings !== undefined &&
6768 settings . getBoolean ( SettingsKey . useCmakeTools )
6869 ) {
70+ // Ensure the Pico kit is selected
71+ await cmakeToolsForcePicoKit ( ) ;
72+
6973 // Compile with CMake Tools
7074 const path : string = await commands . executeCommand (
7175 "cmake.launchTargetPath"
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ import FlashProjectSWDCommand from "./commands/flashProjectSwd.mjs";
8282import { NewMicroPythonProjectPanel } from "./webview/newMicroPythonProjectPanel.mjs" ;
8383import type { Progress as GotProgress } from "got" ;
8484import findPython , { showPythonNotFoundError } from "./utils/pythonHelper.mjs" ;
85-
85+ import { cmakeToolsForcePicoKit } from "./utils/cmakeToolsUtil.mjs" ;
8686export async function activate ( context : ExtensionContext ) : Promise < void > {
8787 Logger . info ( LoggerSource . extension , "Extension activation triggered" ) ;
8888
@@ -811,6 +811,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
811811 ) ;
812812 }
813813 } ) ;
814+ } else if ( settings . getBoolean ( SettingsKey . useCmakeTools ) ) {
815+ // Ensure the Pico kit is selected
816+ await cmakeToolsForcePicoKit ( ) ;
814817 } else {
815818 Logger . info (
816819 LoggerSource . extension ,
Original file line number Diff line number Diff line change 1+ import { commands , window , ProgressLocation } from "vscode" ;
2+
3+
4+ export async function cmakeToolsForcePicoKit ( ) : Promise < void > {
5+ let cmakeToolsKit = await commands . executeCommand (
6+ "cmake.buildKit"
7+ ) ;
8+ if ( cmakeToolsKit === "Pico" ) {
9+ return ;
10+ }
11+
12+ await window . withProgress ( {
13+ location : ProgressLocation . Notification ,
14+ title : "Select the Pico kit in the dialog at the top of the window" ,
15+ cancellable : false ,
16+ } , async progress => {
17+ let i = 0 ;
18+ while ( cmakeToolsKit !== "Pico" ) {
19+ if ( i >= 2 ) {
20+ const result = await window . showErrorMessage (
21+ "You did not select the Pico kit - " +
22+ "you must select the Pico kit in the dialog, " +
23+ "else this extension will not work" ,
24+ "Try again" ,
25+ "Cancel"
26+ ) ;
27+
28+ if ( result === "Try again" ) {
29+ i = 0 ;
30+ continue ;
31+ }
32+
33+ progress . report ( { increment : 100 } ) ;
34+
35+ return ;
36+ }
37+ await commands . executeCommand ( "cmake.selectKit" ) ;
38+ cmakeToolsKit = await commands . executeCommand (
39+ "cmake.buildKit"
40+ ) ;
41+ i ++ ;
42+ }
43+ progress . report ( { increment : 100 } ) ;
44+
45+ return ;
46+ } ) ;
47+ }
You can’t perform that action at this time.
0 commit comments