Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions media/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2709,6 +2709,27 @@ html.pi-viewport-recovering #pi-web-app {
background: var(--pi-bg);
}

.settings-open-vscode {
display: block;
width: 100%;
margin-top: 10px;
padding: 6px 10px;
border: 1px solid var(--pi-line);
border-radius: 2px;
background: transparent;
color: var(--pi-muted);
font: inherit;
font-size: 0.85em;
text-align: left;
cursor: pointer;
}

.settings-open-vscode:hover,
.settings-open-vscode:focus-visible {
border-color: var(--pi-lavender);
color: var(--pi-text);
}

.pi-dialog-btn,
.pi-dialog-input,
.pi-dialog-option {
Expand Down
6 changes: 4 additions & 2 deletions src/test/vscode-settings-entry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ suite("VS Code settings entry", () => {
assert.strictEqual(extensionSettingsQuery(" ", " "), "@ext:auchan.pion-code");
});

test("gear opens native settings and the panel executes the filtered command", () => {
test("gear opens the quick settings panel with a full VS Code settings link", () => {
const handlers = readFileSync(
new URL("../../src/webview/handlers/index.ts", import.meta.url),
"utf8",
);
assert.match(handlers, /pi-sb-settings/);
assert.match(handlers, /toggleSettingsPanel\(\);/);
assert.match(handlers, /settings-open-vscode/);
assert.match(handlers, /postMessage\(\{ type: "openVscodeSettings" \}\)/);

const panel = readFileSync(
Expand All @@ -27,6 +29,6 @@ suite("VS Code settings entry", () => {
assert.match(panel, /case "openVscodeSettings"/);
assert.match(panel, /extensionSettingsQuery\(pkg\.publisher, pkg\.name\)/);
assert.match(panel, /"workbench\.action\.openSettings"/);
assert.match(panel, /Open Pi on Code settings in VS Code/);
assert.match(panel, /Open Pi settings/);
});
});
2 changes: 1 addition & 1 deletion src/webview-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ export class PiWebviewPanel {
<div class="pi-sb-item spacer"></div>
<div class="pi-sb-item" id="pi-sb-capabilities" title="Manage capabilities for this session">capabilities: 0</div>
<div class="pi-sb-item" id="pi-sb-usage" title="Click to set context budget">0%</div>
<div class="pi-sb-item" id="pi-sb-settings" title="Open Pi on Code settings in VS Code">⚙</div>
<div class="pi-sb-item" id="pi-sb-settings" title="Open Pi settings">⚙</div>
</div>
</div>

Expand Down
17 changes: 15 additions & 2 deletions src/webview/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2213,8 +2213,9 @@ export function sendPrompt(modeOverride?: "steer" | "queue"): void {
let sbSettings = document.getElementById("pi-sb-settings");
if (sbSettings) {
sbSettings.addEventListener("click", function () {
// Gear opens the native VS Code Settings filtered to this extension.
window.__vscode.postMessage({ type: "openVscodeSettings" });
// Gear opens the in-chat quick settings panel first; the panel links to
// the full native VS Code settings filtered to this extension.
toggleSettingsPanel();
});
}

Expand Down Expand Up @@ -2672,6 +2673,10 @@ export function renderSettingsPanel() {
</div>`;
}

// Escalation path to every Pi on Code option in the native VS Code settings.
result += html`
<button type="button" class="settings-open-vscode">Open full VS Code settings…</button>`;

state.settingsOverlay.innerHTML = result;

// Wire toggle clicks
Expand All @@ -2689,6 +2694,14 @@ export function renderSettingsPanel() {
}
});
});

var openFull = state.settingsOverlay.querySelector(".settings-open-vscode");
if (openFull) {
openFull.addEventListener("click", function () {
closeAllOverlays();
window.__vscode.postMessage({ type: "openVscodeSettings" });
});
}
}

export function toggleSettingsPanel() {
Expand Down
Loading