Skip to content

feat: Ability to add KeyBindings using a ConfigMap#754

Open
RomanNikitenko wants to merge 4 commits into
che-incubator:mainfrom
RomanNikitenko:keybindings_IndexedDB
Open

feat: Ability to add KeyBindings using a ConfigMap#754
RomanNikitenko wants to merge 4 commits into
che-incubator:mainfrom
RomanNikitenko:keybindings_IndexedDB

Conversation

@RomanNikitenko

@RomanNikitenko RomanNikitenko commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

TODO:

What does this PR do?

Adds ability to provide keybindings via the vscode-editor-configurations ConfigMap.

  • Server reads keybindings.json from the ConfigMap mount path and passes content to the browser
  • CheKeybindingsInitializer merges ConfigMap keybindings into IndexedDB on every workspace start
  • Admin entries are tagged with "_source": "configmap" and appended at the end of the array — VS Code gives them priority (later entries win)
  • On next start, old admin entries are replaced with current ConfigMap content; user entries are preserved

What issues does this PR fix?

https://redhat.atlassian.net/browse/CRW-9166

How to test this PR?

  1. Add keybindings.json to the vscode-editor-configurations ConfigMap, see https://eclipse.dev/che/docs/stable/administration-guide/editor-configurations-for-microsoft-visual-studio-code/
    keybindings.json: |
     [
       {
         "key": "ctrl+shift+t",
         "command": "workbench.action.terminal.new"
       },
       {
         "key": "ctrl+shift+k",
         "command": "workbench.action.terminal.kill"
       },
       { 
         "key": "alt+cmd+n",
         "command": "-workbench.action.files.newUntitledFile"
       }
     ]
    
  2. Start a workspace — verify:
  • ctrl+shift+t opens a terminal
  • ctrl+shift+k kills a terminal
  • alt+cmd+n does not create a new file anymore: there is - before the command
  1. Add a custom keybinding via UI, restart — verify it's preserved
  2. Update ConfigMap with a new keybinding, restart — verify it appears

Does this PR contain changes that override default upstream Code-OSS behavior?

  • the PR contains changes in the code folder (you can skip it if your changes are placed in a che extension )
  • the corresponding items were added to the CHANGELOG.md file
  • rules for automatic git rebase were added to the .rebase folder

Summary by CodeRabbit

  • New Features

    • Added support for loading initial CodePilot/CHE keybindings from a mounted configuration file.
    • Initial keybindings are merged into the user profile each time a workspace starts.
    • Existing administrator-provided keybindings are replaced cleanly while preserving user-defined keybindings.
    • Added support for improved web client redirect handling.
  • Bug Fixes

    • Added validation and fallback handling for invalid or unavailable keybinding configuration.

@tolusha

tolusha commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm che-ai-assistant — I help with your pull requests.

Available commands:

  • /che-ai-assistant generate-che-doc — Generate a documentation PR based on this PR's changes
  • /che-ai-assistant ok-pr-review — Run a comprehensive PR review (summary, code review, deep review, impact analysis)
  • /che-ai-assistant check-pr-test-failures — Analyze failing CI checks, identify root causes, and suggest fixes
  • /che-ai-assistant update-che-e2e-tests — Update Eclipse Che e2e tests
  • /che-ai-assistant help — Show this help message

@github-actions

Copy link
Copy Markdown
Contributor

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
@RomanNikitenko
RomanNikitenko force-pushed the keybindings_IndexedDB branch from 0ea8496 to 0d1984c Compare July 19, 2026 17:51
@github-actions

Copy link
Copy Markdown
Contributor

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

@RomanNikitenko
RomanNikitenko marked this pull request as ready for review July 20, 2026 11:24
@RomanNikitenko RomanNikitenko changed the title Ability to add KeyBindings using a ConfigMap feat: Ability to add KeyBindings using a ConfigMap Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change loads optional keybindings.json content from a mounted CHE ConfigMap, adds it to the server-delivered workbench configuration, and exposes it through IWorkbenchConstructionOptions. When configured, CheKeybindingsInitializer parses and merges the entries into the default profile’s IndexedDB keybindings resource, removing earlier ConfigMap entries first. Rebase replacement and conflict handling are updated for the affected files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ConfigMap
  participant WebClientServer
  participant WebMain
  participant CheKeybindingsInitializer
  participant IndexedDB

  ConfigMap->>WebClientServer: provide keybindings.json
  WebClientServer->>WebMain: send cheInitialKeybindings
  WebMain->>CheKeybindingsInitializer: initialize configured keybindings
  CheKeybindingsInitializer->>IndexedDB: read existing entries
  CheKeybindingsInitializer->>IndexedDB: write merged entries
Loading

Suggested reviewers: azatsarynnyy, rgrunber, vitaliy-guliy


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Title check ❌ Error The title is concise and relevant, but it uses a non-imperative phrase instead of the required imperative mood. Change it to an imperative title like "Add keybindings support from ConfigMap" or "Add ConfigMap keybindings support".
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Rebase Rules For Upstream Changes ✅ Passed PASS: the PR has .rebase/replace rules for all upstream code files, a .rebase/CHANGELOG.md entry for PR #754, and rebase.sh routes those conflicts; checklist boxes are checked.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/src/vs/server/node/che/webClientServer.ts`:
- Around line 22-27: Update getCheInitialKeybindings to be async and replace
existsSync/readFileSync with fs.promises.readFile, returning undefined when the
configuration file is unavailable. In _handleRoot within webClientServer.ts,
await getCheInitialKeybindings and preserve the existing response behavior.

In `@code/src/vs/workbench/browser/che/web.ts`:
- Around line 76-85: Update the existing keybindings parsing flow around
JSON.parse so parse failures abort initialization instead of continuing with the
default empty userEntries and overwriting the file. Either parse the content
with VS Code’s JSONC parser to support comments and trailing commas, or
return/propagate from the enclosing initialization method inside the catch while
preserving ConfigMap entries safely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 195468f5-a341-4f7c-b3a9-09b47b0301ff

📥 Commits

Reviewing files that changed from the base of the PR and between 505423c and 0d1984c.

📒 Files selected for processing (10)
  • .rebase/CHANGELOG.md
  • .rebase/replace/code/src/vs/server/node/webClientServer.ts.json
  • .rebase/replace/code/src/vs/workbench/browser/web.api.ts.json
  • .rebase/replace/code/src/vs/workbench/browser/web.main.ts.json
  • code/src/vs/server/node/che/webClientServer.ts
  • code/src/vs/server/node/webClientServer.ts
  • code/src/vs/workbench/browser/che/web.ts
  • code/src/vs/workbench/browser/web.api.ts
  • code/src/vs/workbench/browser/web.main.ts
  • rebase.sh

Comment thread code/src/vs/server/node/che/webClientServer.ts Outdated
Comment thread code/src/vs/workbench/browser/che/web.ts
…revent data loss

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Assisted-by: Cursor AI
@github-actions

Copy link
Copy Markdown
Contributor

@RomanNikitenko

RomanNikitenko commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

/che-ai-assistant generate-che-doc

Task completed.

@tolusha

tolusha commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Documentation PR created: eclipse-che/che-docs#3166

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.

3 participants