shift from vscode settings to ui settings
- rename to `addFileContext` to `useCurrentFileAsContext`
This commit is contained in:
parent
c04d3c0d92
commit
d9bef31829
7 changed files with 39 additions and 20 deletions
|
|
@ -18,6 +18,7 @@ export const sharedConfigSchema = z
|
|||
useChromiumForDocsCrawling: z.boolean(),
|
||||
readResponseTTS: z.boolean(),
|
||||
promptPath: z.string(),
|
||||
useCurrentFileAsContext: z.boolean(),
|
||||
|
||||
// `ui` in `ContinueConfig`
|
||||
showSessionTabs: z.boolean(),
|
||||
|
|
@ -106,8 +107,7 @@ export function modifyAnyConfigWithSharedConfig<
|
|||
sharedConfig.disableAutocompleteInFiles;
|
||||
}
|
||||
if (sharedConfig.modelTimeout !== undefined) {
|
||||
configCopy.tabAutocompleteOptions.modelTimeout =
|
||||
sharedConfig.modelTimeout;
|
||||
configCopy.tabAutocompleteOptions.modelTimeout = sharedConfig.modelTimeout;
|
||||
}
|
||||
if (sharedConfig.debounceDelay !== undefined) {
|
||||
configCopy.tabAutocompleteOptions.debounceDelay =
|
||||
|
|
@ -162,6 +162,10 @@ export function modifyAnyConfigWithSharedConfig<
|
|||
if (sharedConfig.readResponseTTS !== undefined) {
|
||||
configCopy.experimental.readResponseTTS = sharedConfig.readResponseTTS;
|
||||
}
|
||||
if (sharedConfig.useCurrentFileAsContext !== undefined) {
|
||||
configCopy.experimental.useCurrentFileAsContext =
|
||||
sharedConfig.useCurrentFileAsContext;
|
||||
}
|
||||
|
||||
return configCopy;
|
||||
}
|
||||
|
|
|
|||
6
core/index.d.ts
vendored
6
core/index.d.ts
vendored
|
|
@ -704,7 +704,6 @@ export interface IdeSettings {
|
|||
userToken: string;
|
||||
continueTestEnvironment: "none" | "production" | "staging" | "local";
|
||||
pauseCodebaseIndexOnStart: boolean;
|
||||
addFileContext: boolean
|
||||
}
|
||||
|
||||
export interface FileStats {
|
||||
|
|
@ -1316,6 +1315,11 @@ export interface ExperimentalConfig {
|
|||
*/
|
||||
useChromiumForDocsCrawling?: boolean;
|
||||
modelContextProtocolServers?: ExperimentalMCPOptions[];
|
||||
|
||||
/**
|
||||
* If enabled, will add the current file as context.
|
||||
*/
|
||||
useCurrentFileAsContext?: boolean;
|
||||
}
|
||||
|
||||
export interface AnalyticsConfig {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ class FileSystemIde implements IDE {
|
|||
userToken: "",
|
||||
continueTestEnvironment: "none",
|
||||
pauseCodebaseIndexOnStart: false,
|
||||
addFileContext: false
|
||||
};
|
||||
}
|
||||
async getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined> {
|
||||
|
|
|
|||
|
|
@ -141,11 +141,6 @@
|
|||
"type": "number",
|
||||
"default": 60,
|
||||
"description": "The period of time in minutes between automatic syncs."
|
||||
},
|
||||
"continue.addFileContext": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Adds the current file context when you start a chat."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -335,7 +335,10 @@ class VsCodeIde implements IDE {
|
|||
const pathToLastModified: FileStatsMap = {};
|
||||
await Promise.all(
|
||||
files.map(async (file) => {
|
||||
const stat = await this.ideUtils.stat(vscode.Uri.parse(file), false /* No need to catch ENOPRO exceptions */);
|
||||
const stat = await this.ideUtils.stat(
|
||||
vscode.Uri.parse(file),
|
||||
false /* No need to catch ENOPRO exceptions */,
|
||||
);
|
||||
pathToLastModified[file] = {
|
||||
lastModified: stat!.mtime,
|
||||
size: stat!.size,
|
||||
|
|
@ -401,7 +404,8 @@ class VsCodeIde implements IDE {
|
|||
const configs: ContinueRcJson[] = [];
|
||||
for (const workspaceDir of workspaceDirs) {
|
||||
const files = await this.ideUtils.readDirectory(workspaceDir);
|
||||
if (files === null) {//Unlikely, but just in case...
|
||||
if (files === null) {
|
||||
//Unlikely, but just in case...
|
||||
continue;
|
||||
}
|
||||
for (const [filename, type] of files) {
|
||||
|
|
@ -753,7 +757,7 @@ class VsCodeIde implements IDE {
|
|||
|
||||
async listDir(dir: string): Promise<[string, FileType][]> {
|
||||
const entries = await this.ideUtils.readDirectory(vscode.Uri.parse(dir));
|
||||
return entries === null? [] : entries as any;
|
||||
return entries === null ? [] : (entries as any);
|
||||
}
|
||||
|
||||
private getIdeSettingsSync(): IdeSettings {
|
||||
|
|
@ -774,7 +778,6 @@ class VsCodeIde implements IDE {
|
|||
"pauseCodebaseIndexOnStart",
|
||||
false,
|
||||
),
|
||||
addFileContext: settings.get<boolean>("addFileContext", false),
|
||||
};
|
||||
return ideSettings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { Editor } from "@tiptap/react";
|
||||
import { InputModifiers } from "core";
|
||||
import { rifWithContentsToContextItem } from "core/commands/util";
|
||||
import { MutableRefObject, useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { MutableRefObject } from "react";
|
||||
import { useWebviewListener } from "../../../hooks/useWebviewListener";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { clearCodeToEdit } from "../../../redux/slices/editModeState";
|
||||
|
|
@ -185,17 +184,20 @@ export function useMainEditorWebviewListeners({
|
|||
const activeContextProviders = useAppSelector(
|
||||
(state) => state.config.config.contextProviders,
|
||||
);
|
||||
const mode = useAppSelector(state=>state.session.mode);
|
||||
const ideContext = useContext(IdeMessengerContext)
|
||||
const useCurrentFileAsContext = useAppSelector(
|
||||
(state) => state.config.config.experimental?.useCurrentFileAsContext,
|
||||
);
|
||||
const mode = useAppSelector((state) => state.session.mode);
|
||||
|
||||
console.log("debug1 current file", useCurrentFileAsContext);
|
||||
|
||||
useWebviewListener(
|
||||
"newSession",
|
||||
async () => {
|
||||
// do not insert current file context mention if we are in edit mode or if addFileContext is disabled
|
||||
const settings = await ideContext.ide.getIdeSettings()
|
||||
if(!editor || mode === 'edit' || !settings.addFileContext) return;
|
||||
if (!editor || mode === "edit" || !useCurrentFileAsContext) return;
|
||||
insertCurrentFileContextMention(editor, activeContextProviders);
|
||||
},
|
||||
[editor, activeContextProviders, mode],
|
||||
[editor, activeContextProviders, mode, useCurrentFileAsContext],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ export function UserSettingsForm() {
|
|||
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
|
||||
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
|
||||
const disableSessionTitles = config.disableSessionTitles ?? false;
|
||||
const useCurrentFileAsContext =
|
||||
config.experimental?.useCurrentFileAsContext ?? false;
|
||||
|
||||
const allowAnonymousTelemetry = config.allowAnonymousTelemetry ?? true;
|
||||
const disableIndexing = config.disableIndexing ?? false;
|
||||
|
|
@ -211,6 +213,16 @@ export function UserSettingsForm() {
|
|||
text="Enable Indexing"
|
||||
/>
|
||||
|
||||
<ToggleSwitch
|
||||
isToggled={useCurrentFileAsContext}
|
||||
onToggle={() =>
|
||||
handleUpdate({
|
||||
useCurrentFileAsContext: !useCurrentFileAsContext,
|
||||
})
|
||||
}
|
||||
text="Add Current File by Default"
|
||||
/>
|
||||
|
||||
{/* <ToggleSwitch
|
||||
isToggled={useAutocompleteCache}
|
||||
onToggle={() =>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue