User utf8 as file code. Copy .chat .
This commit is contained in:
parent
5c7c273b20
commit
da89e38ffa
@ -1,6 +1,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { createTempSubdirectory, getLanguageIdByFileName } from '../util/commonUtil';
|
||||
|
||||
export async function handleFileSelected(fileSelected: string) {
|
||||
@ -12,8 +13,7 @@ export async function handleFileSelected(fileSelected: string) {
|
||||
const tempFile = path.join(tempDir, fileName);
|
||||
|
||||
// load content in fileSelected
|
||||
const fileContent = await vscode.workspace.fs.readFile(vscode.Uri.file(fileSelected));
|
||||
|
||||
const fileContent = fs.readFileSync(fileSelected, 'utf-8');
|
||||
// get the language from fileSelected
|
||||
const languageId = await getLanguageIdByFileName(fileSelected);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { createChatDirectoryAndCopyInstructionsSync } from './init/chatConfig';
|
||||
|
||||
import {
|
||||
registerOpenChatPanelCommand,
|
||||
registerAddContextCommand,
|
||||
@ -16,9 +16,6 @@ function activate(context: vscode.ExtensionContext) {
|
||||
ExtensionContextHolder.context = context;
|
||||
logger.init(context);
|
||||
|
||||
// 创建 .chat 目录并复制 workflows
|
||||
createChatDirectoryAndCopyInstructionsSync(context.extensionUri);
|
||||
|
||||
registerOpenChatPanelCommand(context);
|
||||
registerAddContextCommand(context);
|
||||
registerAskForCodeCommand(context);
|
||||
|
@ -9,6 +9,7 @@ import WebviewManager from './webviewManager';
|
||||
import messageHistory from '../util/messageHistory';
|
||||
import CustomCommands from '../command/customCommand';
|
||||
import CommandManager from '../command/commandManager';
|
||||
import { createChatDirectoryAndCopyInstructionsSync } from '../init/chatConfig';
|
||||
|
||||
export default class ChatPanel {
|
||||
private static _instance: ChatPanel | undefined;
|
||||
@ -17,6 +18,9 @@ export default class ChatPanel {
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
public static createOrShow(extensionUri: vscode.Uri) {
|
||||
// 创建 .chat 目录并复制 workflows
|
||||
createChatDirectoryAndCopyInstructionsSync(extensionUri);
|
||||
|
||||
const workspaceDir = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
|
||||
if (workspaceDir) {
|
||||
const workflowsDir = path.join(workspaceDir!, '.chat', 'workflows');
|
||||
|
Loading…
x
Reference in New Issue
Block a user