add setting for vscode
This commit is contained in:
parent
01cee687c1
commit
2f52d81036
5 changed files with 14 additions and 3 deletions
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -704,6 +704,7 @@ export interface IdeSettings {
|
|||
userToken: string;
|
||||
continueTestEnvironment: "none" | "production" | "staging" | "local";
|
||||
pauseCodebaseIndexOnStart: boolean;
|
||||
addFileContext: boolean
|
||||
}
|
||||
|
||||
export interface FileStats {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class FileSystemIde implements IDE {
|
|||
userToken: "",
|
||||
continueTestEnvironment: "none",
|
||||
pauseCodebaseIndexOnStart: false,
|
||||
addFileContext: false
|
||||
};
|
||||
}
|
||||
async getGitHubAuthToken(args: GetGhTokenArgs): Promise<string | undefined> {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,11 @@
|
|||
"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."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -774,6 +774,7 @@ class VsCodeIde implements IDE {
|
|||
"pauseCodebaseIndexOnStart",
|
||||
false,
|
||||
),
|
||||
addFileContext: settings.get<boolean>("addFileContext", false),
|
||||
};
|
||||
return ideSettings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { Editor } from "@tiptap/react";
|
||||
import { InputModifiers } from "core";
|
||||
import { rifWithContentsToContextItem } from "core/commands/util";
|
||||
import { MutableRefObject } from "react";
|
||||
import { MutableRefObject, useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useWebviewListener } from "../../../hooks/useWebviewListener";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { clearCodeToEdit } from "../../../redux/slices/editModeState";
|
||||
|
|
@ -185,12 +186,14 @@ export function useMainEditorWebviewListeners({
|
|||
(state) => state.config.config.contextProviders,
|
||||
);
|
||||
const mode = useAppSelector(state=>state.session.mode);
|
||||
const ideContext = useContext(IdeMessengerContext)
|
||||
|
||||
useWebviewListener(
|
||||
"newSession",
|
||||
async () => {
|
||||
// do not insert current file context mention if we are in edit mode
|
||||
if(!editor || mode === 'edit') return;
|
||||
// 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;
|
||||
insertCurrentFileContextMention(editor, activeContextProviders);
|
||||
},
|
||||
[editor, activeContextProviders, mode],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue