repo_id stringclasses 46
values | file_path stringlengths 36 118 | content stringlengths 7 1.68M | __index_level_0__ int64 0 0 |
|---|---|---|---|
devchat_public_repos | devchat_public_repos/devchat-vscode/.mocharc.json | {
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": "ts-node/register",
"project": "tsconfig.test.json"
} | 0 |
devchat_public_repos | devchat_public_repos/devchat-vscode/tsconfig.json | {
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"lib": [
"ES2020",
"es6",
"dom"
],
"outDir": "./dist",
"sourceMap": true,
"rootDir": "src",
"strict": true,
"jsx": "react",
"esModuleInterop": true,
"noImplicitAny": false,
"paths": {
"@/*": [
"./src/*"
]
}
}... | 0 |
devchat_public_repos | devchat_public_repos/devchat-vscode/vsc-extension-quickstart.md | # Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your extension and command.
* The sample plugin registers a command and defines its title and command name. With this in... | 0 |
devchat_public_repos | devchat_public_repos/devchat-vscode/.eslintrc.json | {
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
... | 0 |
devchat_public_repos/devchat-vscode/instructions | devchat_public_repos/devchat-vscode/instructions/default/instCode.txt | As a software developer assistant, your tasks are to:
- Provide a clear and concise response to address the user's <request>.
- Write code and give advice based on given code or information in the <context> if provided.
- Follow language-specific best practices and coding standards.
When responding:
1. Summarize and... | 0 |
devchat_public_repos/devchat-vscode/instructions | devchat_public_repos/devchat-vscode/instructions/default/instLangPython.txt | When writing Python code, include type hints where appropriate and maintain compliance with PEP-8 guidelines, such as providing docstrings for modules, classes, and functions. | 0 |
devchat_public_repos/devchat-vscode/instructions | devchat_public_repos/devchat-vscode/instructions/commit_message/instCommitMessage.txt | As a software developer assistant, your task is to provide clear and concise responses and write commit messages based on given code, requirements, or conversations. Follow these guidelines:
1. A commit message should include a title and multiple body lines.
2. Adhere to best practices, such as keeping titles under 50... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/mocks/vscode.js | // test/mocks/vscode.js
// 定义一个模拟的openTextDocument函数
function openTextDocumentMock() {
return new Promise(resolve => {
// 模拟异步返回一个文档对象
resolve({
// 根据需要模拟文档对象的属性和方法
getText: () => "模拟文档内容",
// 其他需要模拟的方法和属性
});
});
}
// 定义一个模拟的showTextDocument函数
funct... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/handler/codeBlockHandler.test.ts | import { expect } from 'chai';
import sinon from 'sinon';
import vscodeMock from '../mocks/vscode';
import * as proxyquire from 'proxyquire';
const proxy = proxyquire.noCallThru();
// 使用 proxyquire 加载业务代码,并替换 'vscode' 模块
const { createAndOpenFile } = proxy('../../src/handler/codeBlockHandler', { 'vscode': vscodeMock ... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/handler/sendMessageBase.test.ts | import { expect } from 'chai';
// import { describe, it } from 'mocha';
import sinon from 'sinon';
import * as path from 'path';
import { parseMessage, parseMessageAndSetOptions, processChatResponse, sendMessageBase, stopDevChatBase } from '../../src/handler/sendMessageBase';
import { ChatResponse } from '../../src/too... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/context/loadContexts.test.ts | import { expect } from 'chai';
// import { describe, it } from 'mocha';
import '../../src/context/loadContexts';
import { ChatContextManager } from '../../src/context/contextManager';
import { gitDiffCachedContext } from '../../src/context/contextGitDiffCached';
import { gitDiffContext } from '../../src/context/context... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/context/contextCodeSelected.test.ts | import { expect } from 'chai';
// import { describe, it, afterEach, beforeEach } from 'mocha';
import { handleCodeSelected } from '../../src/context/contextCodeSelected';
import * as path from 'path';
import { UiUtilWrapper } from '../../src/util/uiUtil';
import sinon from 'sinon';
describe('handleCodeSelected', () =>... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/context/customContext.test.ts | import { expect } from 'chai';
import CustomContexts from '../../src/context/customContext';
import fs from 'fs';
import path from 'path';
describe('CustomContexts', () => {
const workflowsDir = path.join(__dirname, 'test-workflows');
beforeEach(() => {
// Create a test workflows directory with a samp... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/utils.test.ts | import { expect } from 'chai';
import { describe, it } from 'mocha';
describe('yourFunction', () => {
it('should return the correct result for input 1', () => {
const input = 1;
const expectedResult = 'expectedResult';
const result = 'expectedResult';
expect(result).to.equal(expectedResult);
});
... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/commonUtil.test.ts | // test/commonUtil.test.ts
import { expect } from 'chai';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import {
createTempSubdirectory,
CommandRun,
runCommandAndWriteOutput,
runCommandStringAndWriteOutput,
getLanguageIdByFileName,
} from '../../src/util/commonUtil';
import { U... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/messageHistory.test.ts | import { expect } from 'chai';
import { describe, it } from 'mocha';
import { MessageHistory } from '../../src/util/messageHistory';
describe('MessageHistory', () => {
let messageHistory: MessageHistory;
beforeEach(() => {
messageHistory = new MessageHistory();
});
it('add message', () => {
const mes... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/filePairManager.test.ts | import { expect } from 'chai';
import { describe, it } from 'mocha';
import { FilePairManager } from '../../src/util/diffFilePairs';
describe('FilePairManager', () => {
let filePairManager: FilePairManager;
beforeEach(() => {
filePairManager = FilePairManager.getInstance();
});
afterEach(() => {
// C... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/config.test.ts | import { expect } from 'chai';
import { describe, it, beforeEach, afterEach } from 'mocha';
import fs from 'fs';
import yaml from 'yaml';
import { DevChatConfig } from '../../src/util/config'; // 调整路径以指向config.ts的实际位置
import sinon from 'sinon';
import { logger } from '../../src/util/logger'; // 调整路径以指向logger的实际位置
desc... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/util/logger.test.ts | // test/util/logger.test.ts
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { logger, LogChannel } from '../../src/util/logger';
class MockLogChannel implements LogChannel {
logs: string[] = [];
info(message: string, ...args: any[]): void {
this.logs.push(`[INFO] ${message} ${args... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/workflows/ui_parser.py |
"""
checkbox:
```chatmark type=form
Which files would you like to commit? I've suggested a few.
> [x](file1) devchat/engine/prompter.py
> [x](file2) devchat/prompt.py
> [](file3) tests/test_cli_prompt.py
```
radio:
```chatmark type=form
How would you like to make the change?
> - (insert) Insert the new code.
> - (new... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/workflows/commit_cases.py |
import subprocess
import re
import shutil
import os
import json
import ui_parser
import yaml
import openai
# Extract the repository URL and commit hash from the GitHub link
def extract_repo_info(github_link):
match = re.match(r'https://github\.com/(.+)/(.+)/commit/(.+)', github_link)
if not match:
rai... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/workflows/workflow_test.py |
import os
import subprocess
import sys
import threading
import commit_cases
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def run_devchat_command(model, commit_command, input_mock):
timeout = 300 # 超时时间,单位为秒
# 构建命令
command = [
sys.executable, '-m', 'devchat', 'route', '-m', 'gpt-3.5-tu... | 0 |
devchat_public_repos/devchat-vscode/test | devchat_public_repos/devchat-vscode/test/toolwrapper/devchat.test.ts | import { expect } from 'chai';
// import { describe, it } from 'mocha';
import sinon from 'sinon';
import DevChat, { ChatOptions } from '../../src/toolwrapper/devchat';
import { CommandRun } from '../../src/util/commonUtil';
import { UiUtilWrapper } from '../../src/util/uiUtil';
import { ApiKeyManager } from '../../src... | 0 |
devchat_public_repos/devchat-vscode/workflows/default/context | devchat_public_repos/devchat-vscode/workflows/default/context/git_log_for_releasenote/_setting_.json | {
"name": "git log for release note",
"description": "formatted commit history since the specified commit",
"edit": true,
"command": ["git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:\"%h - %B\""]
} | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/docs/publish.md | # Automated Publishing Process for DevChat VSCode Extension
This document aims to explain the automated publishing process for our DevChat VSCode Extension.
We use CircleCI for continuous integration and deployment to streamline the development and release process.
## Tagging Triggers Publishing
Every time we are re... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/.vscode/extensions.json | {
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
}
| 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/.vscode/launch.json | // A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/.vscode/tasks.json | // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$ts-webpack-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/assets/devchat_icon.svg | <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.13976 17.8052C6.45142 17.5415 6.77505 17.3085 7.10466 17.105C7.17345 17.0628 7.14713 16.956 7.06697 16.9511C6.81752 16.9366 6.56388 16.9342 6.30666 16.9439C6.21154 16.9475 6.13139 16.872 6.13139 16.7755V16.3113C6... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/assets/devchat_apply.svg | <svg width="240" height="240" viewBox="0 0 240 240" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M163 200.375L188.4 226L230 184" stroke="#E8471C" stroke-width="19" stroke-linecap="round" stroke-linejoin="round"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M49.2577 175.031C45.7672 177.204 42.3402 179.6... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/.circleci/config.yml | version: 2.1
executors:
node-executor:
docker:
- image: cimg/node:20.2.0
jobs:
build:
executor: node-executor
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- run: npm install
- run: npm run build
- persist_to_workspace:
... | 0 |
devchat_public_repos/devchat-vscode | devchat_public_repos/devchat-vscode/src/extension.ts | import * as vscode from "vscode";
import {
registerOpenChatPanelCommand,
registerAddContextCommand,
registerAskForCodeCommand,
registerAskForFileCommand,
regApplyDiffResultCommand,
registerStatusBarItemClickCommand,
regPythonPathCommand,
registerInstallCommandsCommand,
registerDevChatChat... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/chatHandler.ts | import { UiUtilWrapper } from '../util/uiUtil';
import { MessageHandler } from './messageHandler';
import { isSending } from './sendMessage';
export async function chatWithDevChat(panel, message: string) {
if (isSending()) {
// already sending, show error
UiUtilWrapper.showErrorMessage("DevChat: A command is alr... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/contextHandler.ts | import * as vscode from 'vscode';
import * as fs from "fs";
import { ChatContextManager } from '../context/contextManager';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { logger } from "../util/logger";
regInMessage({command: 'addContex... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/historyMessagesBase.ts |
import DevChat, { LogEntry, LogOptions } from '../toolwrapper/devchat';
import messageHistory from '../util/messageHistory';
import { ApiKeyManager } from '../util/apiKey';
export interface LoadHistoryMessages {
command: string;
entries: Array<LogEntry>;
}
function welcomeMessage(): LogEntry {
// create default... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/handlerRegister.ts | import { messageHandler } from './messageHandler';
import { insertCodeBlockToFile } from './codeBlockHandler';
import { replaceCodeBlockToFile } from './codeBlockHandler';
import { doCommit } from './commitHandler';
import { getHistoryMessages } from './historyMessagesHandler';
import { getWorkflowCommandList } from '.... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/messageHandler.ts | // messageHandler.ts
import * as vscode from 'vscode';
import '../context/loadContexts';
import { logger } from '../util/logger';
export class MessageHandler {
private handlers: { [command: string]: (message: any, panel: vscode.WebviewPanel|vscode.WebviewView) => Promise<void> } = {};
constructor() {
}
regist... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/sendMessageBase.ts | import DevChat, { ChatOptions, ChatResponse } from '../toolwrapper/devchat';
import { logger } from '../util/logger';
import messageHistory from '../util/messageHistory';
import { assertValue } from '../util/check';
/**
* Class to handle user interaction stop events.
*/
class UserStopHandler {
/**
* Flag to indi... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/featureToggleHandler.ts | /*
check whether some feature is enabled
*/
import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { logger } from '../util/logger';
import { FT, FTs } from '../util/feature_flags/feature_toggles';
import { MessageHandler } from './messageHandler';
regInMessage({c... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/topicHandler.ts | import * as vscode from 'vscode';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { MessageHandler } from './messageHandler';
import DevChat, { TopicEntry } from '../toolwrapper/devchat';
import { UiUtilWrapper ... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/listMessages.ts | import * as vscode from 'vscode';
import { getInMessages, getOutMessages } from '../util/reg_messages';
import { MessageHandler } from './messageHandler';
export async function listAllMessages(message: any, panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> {
const inMessages = getInMessages();
const outM... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/removehandler.ts |
import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { ApiKeyManager } from '../util/apiKey';
import { UiUtilWrapper } from '../util/uiUtil';
regInMessage({command: 'regModelList'});
regOutMessage({command: 're... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/configHandler.ts | /*
Commands for handling configuration read and write
*/
import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { MessageHandler } from './messageHandler';
import { DevChatConfig } from '../util/config';
regInMessage({command: 'readConfig', key: ['A','B']}); // wh... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/workflowCommandHandler.ts | import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { ApiKeyManager } from '../util/apiKey';
import DevChat from '../toolwrapper/devchat';
export interface Command {
name: string;
pattern: string;
descriptio... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/diffHandler.ts | import * as vscode from 'vscode';
import * as path from 'path';
import { createTempSubdirectory } from '../util/commonUtil';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { applyCodeChanges, isValidActionString } from '../util/appyDiff';
import { logger } from '../util/logger';
import { Fi... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/codeBlockHandler.ts | import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
export async function applyCode(text: string) {
const validVisibleTextEditors = vscode.window.visibleTextEditors.filter(editor => editor.viewColumn !== undefined);
if (validVisibleTextEditors.length > 1) {
vscod... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/commitHandler.ts | import * as vscode from 'vscode';
import DtmWrapper from '../toolwrapper/dtm';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { runCommandAndWriteOutput } from '../util/commonUtil';
regInMessage({command: 'doCommit', content: ''});
export async function doCommit(message: any, panel: vscode.... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/historyMessagesHandler.ts | import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { historyMessagesBase, LoadHistoryMessages, loadTopicHistoryFromCurrentMessageHistory } from './historyMessagesBase';
import { UiUtilWrapper } from '../util/uiU... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/vscodeCommandHandler.ts | /*
execute vscode command
*/
import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { logger } from '../util/logger';
regInMessage({command: 'doCommand', content: ['command', 'arg1', 'arg2']});
export async function doVscodeCommand(message: any, panel: vscode.Webv... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/focusHandler.ts | import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
export async function focusDevChatInput(panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> {
const inputFocusMessage = {"command": "focusDevChatInput"};
if (panel) {
MessageHandler.sendMessage(panel, inputF... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/workflowContextHandler.ts | import * as vscode from 'vscode';
import { ChatContextManager } from '../context/contextManager';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
regInMessage({command: 'regContextList'});
regOutMessage({command: 'regContextList', result: [{name:... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/contextDetail.ts | import { regInMessage, regOutMessage } from '../util/reg_messages';
| 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/fileHandler.ts | import * as vscode from 'vscode';
import * as fs from "fs";
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { logger } from "../util/logger";
// New: writeFile message handler
regInMessage({ command: 'writeFile', file: '', content: '' });
... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/handler/sendMessage.ts |
import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import {
stopDevChatBase,
sendMessageBase,
deleteChatMessageBase,
sendTextToDevChat
} from './sendMessageBase';
import { UiUtilWrapper } from '../util/ui... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/init/chatConfig.ts | import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
import { logger } from '../util/logger';
import { UiUtilWrapper } from '../util/uiUtil';
function copyFileSync(source: string, target: string) {
const data = fs.readFileSync(source);
if (!fs.existsSync(target)) {
fs.writeFi... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/types/globle.d.ts | declare global {
interface Window {
[key: string]: any;
}
}
export {};
| 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextCodeSelected.ts |
import * as path from 'path';
import { createTempSubdirectory, getLanguageIdByFileName } from '../util/commonUtil';
import { UiUtilWrapper } from '../util/uiUtil';
export async function handleCodeSelected(fileSelected: string, codeSelected: string, startLine: number) {
// get file name from fileSelected
const... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/loadContexts.ts | import { ChatContextManager } from './contextManager';
import { gitDiffCachedContext } from './contextGitDiffCached';
import { gitDiffContext } from './contextGitDiff';
import { customCommandContext } from './contextCustomCommand';
// import { refDefsContext } from './contextRefDefs';
// import { defRefsContext } from ... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextFileSelected.ts |
import * as path from 'path';
import * as fs from 'fs';
import { createTempSubdirectory, getLanguageIdByFileName } from '../util/commonUtil';
import { UiUtilWrapper } from '../util/uiUtil';
export async function handleFileSelected(fileSelected: string) {
// get file name from fileSelected
const fileName = pat... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/customContext.ts | import fs from 'fs';
import path from 'path';
import { logger } from '../util/logger';
import { runCommandStringArrayAndWriteOutput, runCommandStringAndWriteOutputSync, CommandResult } from '../util/commonUtil';
import { UiUtilWrapper } from '../util/uiUtil';
export interface CustomContext {
name: string;
descript... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextGitDiffCached.ts | import * as path from 'path';
import { ChatContext } from './contextManager';
import { createTempSubdirectory, runCommandStringAndWriteOutput } from '../util/commonUtil';
import { logger } from '../util/logger';
export const gitDiffCachedContext: ChatContext = {
name: 'git diff --cached',
description: 'the stage... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextCustomCommand.ts | import * as path from 'path';
import { ChatContext } from './contextManager';
import { createTempSubdirectory, runCommandStringAndWriteOutput } from '../util/commonUtil';
import { logger } from '../util/logger';
import { UiUtilWrapper } from '../util/uiUtil';
export const customCommandContext: ChatContext = {
nam... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextRefDefs.ts | import * as vscode from 'vscode';
import * as path from 'path';
import { ChatContext } from './contextManager';
import { logger } from '../util/logger';
import { handleCodeSelected } from './contextCodeSelected';
import DevChat, { ChatOptions } from '../toolwrapper/devchat';
import { UiUtilWrapper } from '../util/uiU... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextManager.ts | import * as path from 'path';
import { logger } from '../util/logger';
import { createTempSubdirectory } from '../util/commonUtil';
import CustomContexts from './customContext';
import { UiUtilWrapper } from '../util/uiUtil';
export interface ChatContext {
name: string;
description: string;
handler: () =... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextGitDiff.ts | import * as path from 'path';
import { ChatContext } from './contextManager';
import { createTempSubdirectory, runCommandStringAndWriteOutput } from '../util/commonUtil';
import { logger } from '../util/logger';
export const gitDiffContext: ChatContext = {
name: 'git diff HEAD',
description: 'all changes since t... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/context/contextDefRefs.ts | import * as path from 'path';
import * as vscode from 'vscode';
import { ChatContext } from './contextManager';
import { logger } from '../util/logger';
import { handleCodeSelected } from './contextCodeSelected';
import { log } from 'console';
async function getSelectedSymbol(): Promise<vscode.DocumentSymbol | und... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/panel/statusBarView.ts | import * as vscode from 'vscode';
import { dependencyCheck } from './statusBarViewBase';
import { ProgressBar } from '../util/progressBar';
import { logger } from '../util/logger';
import { DevChatConfig } from '../util/config';
export function createStatusBarItem(context: vscode.ExtensionContext): vscode.StatusBarI... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/panel/codeLens.ts | import * as vscode from "vscode";
import * as fs from "fs";
import * as path from "path";
import { logger } from "../util/logger";
import { log } from "console";
interface FunctionDefinition {
name: string;
containerName: string | null;
containerRange: vscode.Range | null;
range: vscode.Range;
}
type CodeLens... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/panel/webviewManager.ts | import * as vscode from 'vscode';
import * as path from 'path';
import * as fs from 'fs';
export default class WebviewManager {
private _webview: vscode.Webview;
private _extensionUri: vscode.Uri;
constructor(webview: vscode.Webview, extensionUri: vscode.Uri) {
this._webview = webview;
this._extensionUri = ext... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/panel/statusBarViewBase.ts | import * as fs from 'fs';
import * as path from 'path';
import { logger } from "../util/logger";
import { UiUtilWrapper } from "../util/uiUtil";
import { ApiKeyManager } from '../util/apiKey';
import { installDevchat } from '../util/python_installer/install_devchat';
let devchatStatus = '';
let apiKeyStatus = '';
l... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/panel/devchatView.ts | import * as vscode from 'vscode';
import * as path from 'path';
import WebviewManager from './webviewManager';
import '../handler/handlerRegister';
import handleMessage from '../handler/messageHandler';
import { createChatDirectoryAndCopyInstructionsSync } from '../init/chatConfig';
import { ExtensionContextHolder } f... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/uiUtil_vscode.ts | import * as vscode from 'vscode';
import { ExtensionContextHolder } from './extensionContext';
import { UiUtil } from './uiUtil';
import { logger } from './logger';
export class UiUtilVscode implements UiUtil {
public async languageId(uri: string): Promise<string> {
const document = await vscode.workspace.openTex... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/askCodeUtil.ts | /*
Util for askCode
*/
import * as fs from 'fs';
import * as path from 'path';
import { UiUtilWrapper } from './uiUtil';
let indexingStatus = 'stopped'; // 'started' | 'indexing' | 'stopped'
export function updateLastModifyTime() {
const workspaceFolder = UiUtilWrapper.workspaceFoldersFirstPath();
if (!workspaceFo... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/apiKey.ts | // src/apiKey.ts
import DevChat from '@/toolwrapper/devchat';
import { UiUtilWrapper } from './uiUtil';
import { DevChatConfig } from './config';
import { logger } from './logger';
export class ApiKeyManager {
static async llmModel() {
const devchatConfig = DevChatConfig.getInstance();
const defaultModel = devch... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/appyDiff.ts | import { logger } from "./logger";
type Action = {
action: "delete" | "insert" | "modify";
content?: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
insert_after?: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
insert_before?: string;
// eslint-disable-next-li... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/progressBar.ts |
import * as vscode from 'vscode';
export class ProgressBar {
private message: string;
private error: string | undefined;
private finish: boolean | undefined;
constructor() {
this.message = "";
}
init() {
vscode.window.withProgress({
location: vscode.ProgressLocation.Not... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/logger.ts |
export interface LogChannel {
info(message: string, ...args: any[]): void;
warn(message: string, ...args: any[]): void;
error(message: string | Error, ...args: any[]): void;
debug(message: string, ...args: any[]): void;
show(): void;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
export class... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/logger_vscode.ts | import { LogChannel } from "./logger";
import * as vscode from 'vscode';
export class LoggerChannelVscode implements LogChannel {
_channel: vscode.LogOutputChannel;
private static _instance: LoggerChannelVscode;
private constructor() {
this._channel = vscode.window.createOutputChannel('DevChat', { log: tru... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/uiUtil.ts |
export interface UiUtil {
languageId(uri: string): Promise<string>;
workspaceFoldersFirstPath(): string | undefined;
secretStorageGet(key: string): Promise<string | undefined>;
writeFile(uri: string, content: string): Promise<void>;
showInputBox(option: object): Promise<string | undefined>;
storeSecret(key: stri... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/config.ts | import fs from 'fs';
import yaml from 'yaml';
import path from 'path';
import { logger } from './logger';
export class DevChatConfig {
private static instance: DevChatConfig;
// 配置文件路径,根据操作系统的差异,可能需要调整
private configFilePath: string;
private data: any;
// last modify timestamp of the config file
... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/check.ts |
export function assertValue(value: any, message: string) {
if (value) {
throw new Error(message);
}
} | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/reg_messages.ts |
let inMessages: object[] = [];
let outMessages: object[] = [];
export function regInMessage(message: object) {
inMessages.push(message);
}
export function regOutMessage(message: object) {
outMessages.push(message);
}
export function getInMessages(): object[] {
return inMessages;
}
export function getOutMessages... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/extensionContext.ts | import * as vscode from 'vscode';
import { DevChatViewProvider } from '../panel/devchatView';
export class ExtensionContextHolder {
private static _context: vscode.ExtensionContext | undefined;
private static _provider: DevChatViewProvider | undefined;
static set context(context: vscode.ExtensionContext | undef... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/commonUtil.ts | /* eslint-disable @typescript-eslint/naming-convention */
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as yaml from 'yaml';
import * as util from 'util';
import * as childProcess from 'child_process';
import { parseArgsStringToArgv } from 'string-argv';
import { logger } ... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/messageHistory.ts |
export class MessageHistory {
private history: any[];
private lastmessage: any | null;
private topic: string | null;
constructor() {
this.history = [];
this.lastmessage = null;
this.topic = null;
}
setTopic(topic: string) {
this.topic = topic;
}
getTopic() {
return this.topic;
}
add(message: an... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/util/diffFilePairs.ts |
export class FilePairManager {
private static instance: FilePairManager;
private filePairs: Map<string, [string, string]>;
private constructor() {
this.filePairs = new Map<string, [string, string]>();
}
static getInstance(): FilePairManager {
if (!FilePairManager.instance) {
FilePairManager.i... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/feature_flags/feature_toggles.ts | import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
import { DevChatConfig } from '../config';
const featureTogglesJson = `
{
"ask-code-summary": false,
"ask-code": true,
"ask-code-dfs": false
}`;
const featureToggles = JSON.parse(featureTogglesJson);
// eslint-disable-next-l... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/feature_flags/readme.txt |
总结如下:
在VSCode插件开发中,我们讨论了如何实现内测功能的激活控制。主要有以下几种方式:
1. **使用特定的配置项**:在插件的配置项中添加一个特定的字段,例如`enableBetaFeatures`,根据这个配置项的值来决定是否启用内测功能。
2. **使用特定的命令**:在插件中添加一个特定的命令,例如`activateBetaFeatures`,只有当用户执行了这个命令,才启用内测功能。
3. **使用许可证**:在插件中添加一个许可证验证功能,只有当用户输入了有效的许可证,才启用内测功能。
4. **使用特定的版本**:在插件的版本号中添加一个特定的标识,例如`1.0.0-beta`,只有当插件的版本号... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/conda_url.ts | /*
Get conda download url
*/
import os from 'os';
import { logger } from '../logger';
import { UiUtilVscode } from '../uiUtil_vscode';
import { UiUtilWrapper } from '../uiUtil';
import path from 'path';
function getDownloadFileName(): string {
const platform = os.platform();
const arch = os.arch();
logger.chan... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/app_install.ts | /*
Install devchat
*/
import { logger } from "../logger";
import { installConda } from "./conda_install";
import { getMicromambaUrl } from "./conda_url";
import { installPackage } from "./package_install";
import { installPython, installPythonMicromamba } from "./python_install";
// step 1. install conda
// step 2.... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/conda_install.ts | /*
Install conda command
Install file from https://repo.anaconda.com/miniconda/
*/
import { logger } from "../logger";
import { getCondaDownloadUrl } from "./conda_url";
import { downloadFile } from "./https_download";
import { exec, spawn } from 'child_process';
const fs = require('fs');
const path = require('pat... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/readme.md | # Why conda?
Devchat-vscode support custom extension. Different extension may need different python version.
pyenv is also a python version manager, but it always download source of python, then build it to binary.
conda is a package manager, it can download binary of python, and install packages.
# Where to install... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/install_devchat.ts | /*
Install DevChat with python=3.11.4
*/
import { logger } from "../logger";
import { appInstall, createEnvByConda, createEnvByMamba } from "./app_install";
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import { UiUtilWrapper } from "../uiUtil";
import { DevChatConfig } from "../... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/https_download.ts | import * as fs from 'fs';
import * as https from 'https';
import * as os from 'os';
import * as path from 'path';
import { logger } from '../logger';
// download url to tmp directory
// return: local file path or empty string
export async function downloadFile(url: string): Promise<string> {
const os = process.platfo... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/pip_package_version.ts | import { execSync } from 'child_process';
export function getPackageVersion(pythonPath: string, packageName: string): string | undefined {
try {
const stdout = execSync(`${pythonPath} -m pip show ${packageName}`).toString();
const versionLine = stdout.split('\n').find(line => line.startsWith('Versi... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/python_install.ts | import { exec, spawn } from 'child_process';
import * as path from 'path';
import * as os from 'os';
import { logger } from '../logger';
const fs = require('fs');
// Check if the environment already exists
export async function checkEnvExists(condaCommandPath: string, envName: string): Promise<boolean> {
return new ... | 0 |
devchat_public_repos/devchat-vscode/src/util | devchat_public_repos/devchat-vscode/src/util/python_installer/package_install.ts | /*
Install specific version of package. e.g. devchat
*/
import { spawn } from 'child_process';
import { logger } from '../logger';
// install specific version of package
// pythonCommand -m install pkgName
// if install success, return true
// else return false
export async function installPackage(pythonCommand: s... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/contributes/quickFixProvider.ts | import * as vscode from "vscode";
import { collapseFileExculdeSelectRange } from "./codecomplete/ast/collapseBlock";
class DevChatQuickFixProvider implements vscode.CodeActionProvider {
public static readonly providedCodeActionKinds = [
vscode.CodeActionKind.QuickFix,
];
provideCodeActions(
... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/contributes/views.ts | import * as vscode from 'vscode';
import { DevChatViewProvider } from '../panel/devchatView';
import { ExtensionContextHolder } from '../util/extensionContext';
export function regDevChatView(context: vscode.ExtensionContext) {
ExtensionContextHolder.provider = new DevChatViewProvider(context);
context.subscription... | 0 |
devchat_public_repos/devchat-vscode/src | devchat_public_repos/devchat-vscode/src/contributes/commands.ts | import * as vscode from "vscode";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import * as util from "util";
import { sendFileSelectMessage, sendCodeSelectMessage } from "./util";
import { ExtensionContextHolder } from "../util/extensionContext";
import { FilePairManager } from "../... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.