-
Notifications
You must be signed in to change notification settings - Fork 50
Feast manage key bindings in vscode devspace #747
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
base: main
Are you sure you want to change the base?
Changes from all commits
62dcb3f
77c2c87
d04ab02
95d936e
cc04a8f
db19d84
d716fde
605582f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| build/** | ||
| src/** | ||
| tests/** | ||
| coverage/** | ||
| out/** | ||
| tsconfig.json | ||
| extension.webpack.config.js | ||
| yarn.lock |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Che Workspace Key Bindings for Visual Studio Code | ||
|
|
||
| **Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled. | ||
|
|
||
| ## Features | ||
|
|
||
| This extension handles Key Bindings of Che workspace on Visual Studio Code |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /********************************************************************** | ||
| * Copyright (c) 2026 Red Hat, Inc. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| ***********************************************************************/ | ||
| /* | ||
| * This file was generated using AI assistance (Cursor AI) | ||
| * and reviewed by the maintainers. | ||
| */ | ||
| import * as path from 'node:path'; | ||
| import { run } from '../esbuild-extension-common.mts'; | ||
|
|
||
| const srcDir = path.join(import.meta.dirname, 'src'); | ||
| const outDir = path.join(import.meta.dirname, 'dist'); | ||
|
|
||
| run({ | ||
| platform: 'node', | ||
| entryPoints: { | ||
| 'extension': path.join(srcDir, 'extension.ts'), | ||
| }, | ||
| srcDir, | ||
| outdir: outDir, | ||
| additionalOptions: { | ||
| external: ['vscode', 'bufferutil', 'utf-8-validate'], | ||
| }, | ||
| }, process.argv); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "name": "keybindings", | ||
| "displayName": "%displayName%", | ||
| "description": "%description%", | ||
| "publisher": "eclipse-che", | ||
| "license": "EPL-2.0", | ||
| "version": "0.0.1", | ||
| "engines": { | ||
| "vscode": "^1.88.0" | ||
| }, | ||
| "icon": "images/eclipse-che-logo.png", | ||
| "categories": [ | ||
| "Other" | ||
| ], | ||
| "activationEvents": [ | ||
| "*" | ||
| ], | ||
| "capabilities": { | ||
| "virtualWorkspaces": true, | ||
| "untrustedWorkspaces": { | ||
| "supported": true | ||
| } | ||
| }, | ||
| "main": "./out/extension.js", | ||
| "scripts": { | ||
| "compile": "gulp compile-extension:che-keybindings", | ||
| "watch": "gulp watch-extension:che-keybindings", | ||
| "vscode:prepublish": "npm run compile", | ||
| "lint:fix": "eslint --fix --cache=true --no-error-on-unmatched-pattern=true \"{src,tests}/**/*.{ts,tsx}\"", | ||
| "license:generate": "podman run --rm -t -v $PWD:/workspace/project quay.io/che-incubator/dash-licenses:next" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/che-incubator/che-code.git" | ||
| }, | ||
| "extensionDependencies": [ | ||
| "eclipse-che.api", | ||
| "eclipse-che.terminal" | ||
| ], | ||
| "dependencies": { | ||
| "node-fetch": "^3.3.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^20.10.5", | ||
| "typescript": "^5.3.3", | ||
| "@types/vscode": "^1.85.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "displayName": "Eclipse Che Keybindings", | ||
| "description": "Provides Keybindings support" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /********************************************************************** | ||
| * Copyright (c) 2025 Red Hat, Inc. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| ***********************************************************************/ | ||
|
|
||
| /* eslint-disable header/header */ | ||
| import * as vscode from "vscode"; | ||
|
|
||
| export interface KeybindingsResponse { | ||
| keybindingsJson: string; | ||
|
|
||
| meta?: { | ||
| clientId?: string; | ||
| resourceVersion?: string; | ||
| }; | ||
| } | ||
|
|
||
| const API = "/api"; | ||
|
|
||
| export async function getKeybindings( | ||
| namespace: string, | ||
| output?: vscode.OutputChannel, | ||
| ): Promise<KeybindingsResponse | null> { | ||
| output?.appendLine(`[API] GET ${API}/namespace/${namespace}/keybindings`); | ||
|
|
||
| const res = await fetch(`${API}/namespace/${namespace}/keybindings`, { | ||
| credentials: "include", | ||
| }); | ||
|
|
||
| output?.appendLine(`[API] GET Status: ${res.status}`); | ||
|
|
||
| if (!res.ok) { | ||
| output?.appendLine(`[API] GET Failed: ${await res.text()}`); | ||
| return null; | ||
| } | ||
|
|
||
| const data = (await res.json()) as KeybindingsResponse; | ||
|
|
||
| output?.appendLine( | ||
| `[API] GET Success - Received ${data.keybindingsJson.length} bytes`, | ||
| ); | ||
|
|
||
| if (data.meta) { | ||
| output?.appendLine( | ||
| `[API] Meta => clientId=${data.meta.clientId ?? "N/A"}, resourceVersion=${data.meta.resourceVersion ?? "N/A"}`, | ||
| ); | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
|
Comment on lines
+25
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Files:\n'
git ls-files | rg '(^|/)code/extensions/che-keybindings/src/(cheAPi|syncManager|.*types.*|.*api.*)\.(ts|tsx|js|jsx)$|(^|/)code/extensions/che-keybindings/src/'
printf '\nOutline cheAPi.ts:\n'
ast-grep outline code/extensions/che-keybindings/src/cheAPi.ts --view expanded || true
printf '\nOutline syncManager.ts:\n'
ast-grep outline code/extensions/che-keybindings/src/syncManager.ts --view expanded || true
printf '\nRelevant type/search hits:\n'
rg -n "resourceVersion|AbortSignal\.timeout|fetch\(" code/extensions/che-keybindings/src -SRepository: che-incubator/che-code Length of output: 1629 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- cheAPi.ts (1-140) ---'
cat -n code/extensions/che-keybindings/src/cheAPi.ts | sed -n '1,140p'
echo
echo '--- syncManager.ts (1-220) ---'
cat -n code/extensions/che-keybindings/src/syncManager.ts | sed -n '1,220p'Repository: che-incubator/che-code Length of output: 8701 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Search for resourceVersion and keybindings API server:\n'
rg -n "resourceVersion|namespace/.*/keybindings|keybindingsJson|clientId" . -S
printf '\nPotential server-side files:\n'
git ls-files | rg '(^|/)(server|backend|api|routes|handlers|controllers|services|src)/.*\.(ts|js|tsx|jsx)$' | head -n 200Repository: che-incubator/che-code Length of output: 50378 Add a timeout to both keybinding API calls. 🤖 Prompt for AI Agents |
||
|
|
||
| export async function patchKeybindings( | ||
| namespace: string, | ||
| keybindingsJson: string, | ||
| clientId: string, | ||
| output?: vscode.OutputChannel, | ||
| ): Promise<void> { | ||
| output?.appendLine(`[API] PATCH ${API}/namespace/${namespace}/keybindings`); | ||
| output?.appendLine(`[API] Payload Size: ${keybindingsJson.length} bytes`); | ||
| output?.appendLine(`[API] Client ID: ${clientId}`); | ||
|
|
||
| const res = await fetch(`${API}/namespace/${namespace}/keybindings`, { | ||
| method: "PATCH", | ||
| credentials: "include", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ | ||
| keybindingsJson, | ||
| meta: { | ||
| clientId, | ||
| }, | ||
| }), | ||
| }); | ||
|
|
||
| output?.appendLine(`[API] PATCH Status: ${res.status}`); | ||
|
|
||
| if (!res.ok) { | ||
| const error = await res.text(); | ||
| output?.appendLine(`[API] PATCH Failed: ${error}`); | ||
| throw new Error(error); | ||
| } | ||
|
|
||
| output?.appendLine("[API] PATCH Successful."); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 4834
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 50380
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 7234
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 50378
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 50380
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 2036
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 2847
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 4071
🏁 Script executed:
Repository: che-incubator/che-code
Length of output: 160
Thread
resourceVersionthrough PATCH to prevent stale overwrites.clientIdonly suppresses self-echoes on pull; it does not detect concurrent edits. A second client can still overwrite newer keybindings without any conflict signal.🤖 Prompt for AI Agents