Skip to content

Enable Ctrl+S keyboard shortcut in CMake Cache Editor UI#4696

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-ctrl-s-shortcut-issue
Open

Enable Ctrl+S keyboard shortcut in CMake Cache Editor UI#4696
Copilot wants to merge 4 commits intomainfrom
copilot/fix-ctrl-s-shortcut-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

This change addresses item #4000

This changes visible behavior

The following changes are proposed:

  • Implement CustomTextEditorProvider to replace the standalone WebviewPanel for the CMake Cache Editor
  • Register custom editor for CMakeCache.txt files with priority: "option" so users can choose between text and UI views
  • Update editCacheUI() command to open the cache file with the new custom editor via vscode.openWith
  • Remove unused cacheEditorWebview property and related refresh logic from cmakeProject.ts

The purpose of this change

The CMake Cache Editor UI used a regular WebviewPanel which doesn't integrate with VS Code's document save system. Standard save shortcuts (Ctrl+S, File > Save) had no effect—only the Save button in the webview worked.

By implementing vscode.CustomTextEditorProvider, edits in the webview are applied to the underlying TextDocument, enabling native save functionality. The document dirty state indicator and auto-save also work correctly.

Other Notes/Information

Files changed:

  • src/ui/cmakeCacheEditorProvider.ts — New CustomTextEditorProvider implementation
  • src/extension.ts — Register the provider after extensionManager init
  • src/cmakeProject.ts — Simplified editCacheUI() to use vscode.openWith
  • package.json — Added customEditors contribution and activation event
  • package.nls.json — Added display name localization

Manual test steps:

  1. Configure a CMake project
  2. Run CMake: Edit CMake Cache (UI)
  3. Modify a value → Press Ctrl+S
  4. Verify save message appears and reconfigure triggers

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 0psvsblobprodwus2145.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install --prefer-offline (dns block)
  • 2wrvsblobprodwus2180.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • 40vvsblobprodwus2135.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install --prefer-offline (dns block)
  • 5bdvsblobprodwus2128.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
  • b15vsblobprodwus2164.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • b53vsblobprodwus2154.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • d94vsblobprodwus2119.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • ezcvsblobprodwus2170.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install --prefer-offline (dns block)
  • k4pvsblobprodwus2140.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)
  • n6wvsblobprodwus2123.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • p2tvsblobprodwus2189.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • v41vsblobprodwus2175.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>ctrl+s not working in CMake Cache Editor (UI)</issue_title>
<issue_description>### Brief Issue Summary

The shortcut Ctrl+S (or whatever binding is set) does not work in the UI CMake Cache Editor.

Reproduce:

  1. Open a CMake project
  2. Press F1
  3. CMake: Configure
  4. CMake: Edit Cmake Cache UI
  5. Change anything
  6. Press Ctrl+S or Menu -> File -> Save

Nothing happens. I was expecting the document to be saved.

Only the Save button at the top of the document works.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.92.2",
  "cmtVersion": "1.18.44",
  "configurations": [
    {
      "folder": "c:\\TechnoTeam\\develop\\src\\TT_CodeBase",
      "cmakeVersion": "3.29.3",
      "configured": true,
      "generator": "Ninja Multi-Config",
      "usesPresets": true,
      "compilers": {
        "C": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe",
        "CXX": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug",
      "Release"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 94,
    "executablesCount": 5,
    "librariesCount": 21,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

No response

Additional Information

Version: 1.92.2 (user setup)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631</issue_description>

<agent_instructions>You are Copilot coding agent acting as a senior maintainer/contributor for the VS Code extension repository microsoft/vscode-cmake-tools.
You are deeply familiar with CMake, CMake Presets, CTest, kit/toolchain selection, VS Code extension APIs, and the architecture of this repo (TypeScript-heavy).
Your job is to resolve the GitHub issue provided below safely and in a maintainable way, matching existing patterns and UX.

SOURCE OF TRUTH

NON-NEGOTIABLE PROCESS

  1. Triage & understanding (issue-first)
  • Read the entire issue thread.
  • Extract and write down:
    • expected behavior
    • actual behavior
    • repro steps (or minimal repro you infer)
    • affected OS/toolchains/generators/presets
    • whether it is a regression and from which version/commit (if indicated)
  • Identify which CMake Tools feature area is involved (configure/build/test/debug, presets, kits, status bar, tasks, command palette, IntelliSense).
  1. Orient yourself in the repo (implementation map)
  • Identify the relevant user-facing workflows impacted (configure/build/test/debug, presets, kits, status bar, tasks, command palette).
  • Locate the existing implementation areas (commands, configuration/presets handling, test integration, UI, telemetry/logging).
  • Identify existing tests and how they are run in CI; prefer extending existing suites over inventing a new harness.
  1. Changelog discipline (required)
  • Find the project’s changelog / release notes mechanism (e.g., CHANGELOG.md, docs/changelog, “Unreleased” section, or a dedicated changes/ folder).
  • Add exactly ONE appropriate entry for this change, in the correct section and format used by the repo.
  • The entry must describe user-visible behavior (not internal refactors).
  • If the change is not user-visible, explicitly justify that and still add a brief “Internal” entry if the repo’s convention supports it.
  • Ensure the changelog entry matches wording/tense/category conventions already used by the repo.
  1. Implementation standards
  • Follow existing code style, naming, and patterns in this repository.
  • Prefer small, readable changes; avoid broad refactors unless clearly necessary to fix the issue correctly.
  • Preserve backward compatibility for settings/presets when possible; be careful with defaults and precedence rules.
  • Update docs/settings schema/messages if user-facing behavior or configuration changes.
  • Logging: use the extension’s existing logging utilities; avoid noisy output and avoid logging secrets/paths unnecessarily.
  1. Testing:
  • Create a unit test if possible AND practical to validate and test out fix, and e...

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 3, 2026 22:42
Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
…gistration

Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Ctrl+S shortcut not working in CMake Cache Editor Enable Ctrl+S keyboard shortcut in CMake Cache Editor UI Feb 3, 2026
Copilot AI requested a review from hanniavalera February 3, 2026 22:49
@hanniavalera hanniavalera marked this pull request as ready for review February 9, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctrl+s not working in CMake Cache Editor (UI)

2 participants