Skip to content

Rustup support #96

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 141 additions & 132 deletions README.md

Large diffs are not rendered by default.

1,028 changes: 62 additions & 966 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 31 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
},
"activationEvents": [
"workspaceContains:./pico_sdk_import.cmake",
"workspaceContains:./.pico-rs",
"onWebviewPanel:newPicoProject",
"onWebviewPanel:newPicoMicroPythonProject"
],
Expand All @@ -79,20 +80,26 @@
"command": "raspberry-pi-pico.switchSDK",
"title": "Switch Pico SDK",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject"
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.switchBoard",
"title": "Switch Board",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject"
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.launchTargetPath",
"title": "Get path of the project executable",
"category": "Raspberry Pi Pico",
"enablement": "false"
},
{
"command": "raspberry-pi-pico.launchTargetPathRelease",
"title": "Get path of the project release executable (rust only)",
"category": "Raspberry Pi Pico",
"enablement": "false"
},
{
"command": "raspberry-pi-pico.getPythonPath",
"title": "Get python path",
Expand Down Expand Up @@ -147,6 +154,18 @@
"category": "Raspberry Pi Pico",
"enablement": "false"
},
{
"command": "raspberry-pi-pico.getOpenOCDRoot",
"title": "Get OpenOCD root",
"category": "Raspberry Pi Pico",
"enablement": "false"
},
{
"command": "raspberry-pi-pico.getSVDPath",
"title": "Get SVD Path (rust only)",
"category": "Raspberry Pi Pico",
"enablement": "false"
},
{
"command": "raspberry-pi-pico.compileProject",
"title": "Compile Pico Project",
Expand Down Expand Up @@ -185,13 +204,13 @@
"command": "raspberry-pi-pico.configureCmake",
"title": "Configure CMake",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject"
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.switchBuildType",
"title": "Switch Build Type",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject"
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.importProject",
Expand All @@ -217,13 +236,19 @@
"command": "raspberry-pi-pico.flashProject",
"title": "Flash Pico Project (SWD)",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject"
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.cleanCmake",
"title": "Clean CMake",
"category": "Raspberry Pi Pico",
"enablement": "raspberry-pi-pico.isPicoProject && !raspberry-pi-pico.isRustProject"
},
{
"command": "raspberry-pi-pico.getRTTDecoderPath",
"title": "Get RTT Decoder module path",
"category": "Raspberry Pi Pico",
"enablement": "false"
}
],
"configuration": {
Expand Down Expand Up @@ -331,6 +356,7 @@
"got": "^14.4.7",
"ini": "^5.0.0",
"rimraf": "^6.0.1",
"toml": "^3.0.0",
"undici": "^6.21.0",
"uuid": "^11.1.0",
"which": "^5.0.0"
Expand Down
8 changes: 8 additions & 0 deletions src/commands/compileProject.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { EventEmitter } from "events";
import { CommandWithResult } from "./command.mjs";
import Logger from "../logger.mjs";
import Settings, { SettingsKey } from "../settings.mjs";
import State from "../state.mjs";
import { cmakeToolsForcePicoKit } from "../utils/cmakeToolsUtil.mjs";

export default class CompileProjectCommand extends CommandWithResult<boolean> {
private _logger: Logger = new Logger("CompileProjectCommand");

Expand All @@ -18,9 +20,15 @@ export default class CompileProjectCommand extends CommandWithResult<boolean> {
const task = (await tasks.fetchTasks()).find(
task => task.name === "Compile Project"
);
/*const isRustProject = await commands.executeCommand(
"getContext",
ContextKeys.isRustProject
);*/
const isRustProject = State.getInstance().isRustProject;

const settings = Settings.getInstance();
if (
!isRustProject &&
settings !== undefined &&
settings.getBoolean(SettingsKey.useCmakeTools)
) {
Expand Down
23 changes: 21 additions & 2 deletions src/commands/conditionalDebugging.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Command } from "./command.mjs";
import { Command, extensionName } from "./command.mjs";
import Logger from "../logger.mjs";
import { commands } from "vscode";
import { commands, window, workspace, debug } from "vscode";
import State from "../state.mjs";
import DebugLayoutCommand from "./debugLayout.mjs";

/**
* Relay command for the default buildin debug select and start command.
Expand All @@ -16,6 +18,23 @@ export default class ConditionalDebuggingCommand extends Command {
}

async execute(): Promise<void> {
const isRustProject = State.getInstance().isRustProject;

if (isRustProject) {
const wsFolder = workspace.workspaceFolders?.[0];
if (!wsFolder) {
this._logger.error("No workspace folder found.");
void window.showErrorMessage("No workspace folder found.");

return;
}

void commands.executeCommand(`${extensionName}.${DebugLayoutCommand.id}`);
void debug.startDebugging(wsFolder, "Pico Debug (probe-rs)");

return;
}

await commands.executeCommand("workbench.action.debug.selectandstart");
}
}
Loading
Loading