explain by default

This commit is contained in:
Nate Sesti 2023-07-05 12:09:10 -07:00
parent c5cee3f4c4
commit dd5214994f
6 changed files with 24 additions and 13 deletions

View file

@ -33,11 +33,11 @@ DEFAULT_SLASH_COMMANDS = [
description="Edit code in the current file or the highlighted code",
step_name="EditHighlightedCodeStep",
),
SlashCommand(
name="explain",
description="Reply to instructions or a question with previous steps and the highlighted code or current file as context",
step_name="SimpleChatStep",
),
# SlashCommand(
# name="explain",
# description="Reply to instructions or a question with previous steps and the highlighted code or current file as context",
# step_name="SimpleChatStep",
# ),
SlashCommand(
name="config",
description="Open the config file to create new and edit existing slash commands",
@ -129,7 +129,7 @@ def load_global_config() -> ContinueConfig:
config_path = os.path.join(global_dir, 'config.json')
if not os.path.exists(config_path):
with open(config_path, 'w') as f:
json.dump(dict(ContinueConfig()), f)
json.dump(ContinueConfig().dict(), f)
with open(config_path, 'r') as f:
try:
config_dict = json.load(f)

View file

@ -74,14 +74,14 @@ class DemoPolicy(Policy):
# This could be defined with ObservationTypePolicy. Ergonomics not right though.
user_input = observation.user_input
slash_command = parse_slash_command(user_input)
slash_command = parse_slash_command(user_input, config)
if slash_command is not None:
return slash_command
custom_command = parse_custom_command(user_input)
custom_command = parse_custom_command(user_input, config)
if custom_command is not None:
return custom_command
return ChatWithFunctions(user_input=user_input)
return SimpleChatStep(user_input=user_input)
return None

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.0.110",
"version": "0.0.111",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.0.110",
"version": "0.0.111",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "The open-source coding autopilot",
"version": "0.0.110",
"version": "0.0.111",
"publisher": "Continue",
"engines": {
"vscode": "^1.67.0"

View file

@ -195,6 +195,11 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
) {
// Prevent Downshift's default 'Enter' behavior.
(event.nativeEvent as any).preventDownshiftDefault = true;
// cmd+enter to /edit
if (event.metaKey) {
event.currentTarget.value = `/edit ${event.currentTarget}`;
}
if (props.onEnter) props.onEnter(event);
setInputValue("");
const value = event.currentTarget.value;

View file

@ -16,7 +16,7 @@ class DiffManager {
// Doing this because virtual files are read-only
private diffs: Map<string, DiffInfo> = new Map();
constructor() {
private setupDirectory() {
// Make sure the diff directory exists
if (!fs.existsSync(DIFF_DIRECTORY)) {
fs.mkdirSync(DIFF_DIRECTORY, {
@ -25,6 +25,10 @@ class DiffManager {
}
}
constructor() {
this.setupDirectory();
}
private escapeFilepath(filepath: string): string {
return filepath.replace(/\\/g, "_").replace(/\//g, "_");
}
@ -47,6 +51,8 @@ class DiffManager {
}
writeDiff(originalFilepath: string, newContent: string): string {
this.setupDirectory();
// Create or update existing diff
const newFilepath = path.join(
DIFF_DIRECTORY,