fix(vscode-ide-companion): fix bugs & support terminal mode operation

This commit is contained in:
yiliang114
2025-12-06 00:30:22 +08:00
parent be44e7af56
commit 96b275a756
27 changed files with 515 additions and 626 deletions

View File

@@ -0,0 +1,30 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*
* Shared utilities for handling diff operations in the webview
*/
import type { WebviewApi } from 'vscode-webview';
/**
* Handle opening a diff view for a file
* @param vscode Webview API instance
* @param path File path
* @param oldText Original content (left side)
* @param newText New content (right side)
*/
export const handleOpenDiff = (
vscode: WebviewApi<unknown>,
path: string | undefined,
oldText: string | null | undefined,
newText: string | undefined,
): void => {
if (path) {
vscode.postMessage({
type: 'openDiff',
data: { path, oldText: oldText || '', newText: newText || '' },
});
}
};

View File

@@ -1,15 +0,0 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
export function isDevelopmentMode(): boolean {
// TODO: 调试用
// return false;
return (
process.env.NODE_ENV === 'development' ||
process.env.DEBUG === 'true' ||
process.env.NODE_ENV !== 'production'
);
}