refactor: Simplified edit tool (#242)

refactor: Re-work edit file tool
This commit is contained in:
Petr Mironychev
2025-10-26 11:47:16 +01:00
committed by GitHub
parent 608103b92e
commit 43b64b9166
29 changed files with 739 additions and 817 deletions

View File

@ -226,11 +226,11 @@ GeneralSettings::GeneralSettings()
Tr::tr("Allow tools to write and modify files on disk (WARNING: Use with caution!)"));
allowFileSystemWrite.setDefaultValue(false);
allowReadOutsideProject.setSettingsKey(Constants::CA_ALLOW_READ_OUTSIDE_PROJECT);
allowReadOutsideProject.setLabelText(Tr::tr("Allow reading files outside project"));
allowReadOutsideProject.setToolTip(
Tr::tr("Allow tools to read files outside the project scope (system headers, Qt files, external libraries)"));
allowReadOutsideProject.setDefaultValue(true);
allowAccessOutsideProject.setSettingsKey(Constants::CA_ALLOW_ACCESS_OUTSIDE_PROJECT);
allowAccessOutsideProject.setLabelText(Tr::tr("Allow file access outside project"));
allowAccessOutsideProject.setToolTip(
Tr::tr("Allow tools to access (read/write) files outside the project scope (system headers, Qt files, external libraries)"));
allowAccessOutsideProject.setDefaultValue(true);
autoApplyFileEdits.setSettingsKey(Constants::CA_AUTO_APPLY_FILE_EDITS);
autoApplyFileEdits.setLabelText(Tr::tr("Automatically apply file edits"));
@ -285,7 +285,7 @@ GeneralSettings::GeneralSettings()
auto caGroup = Group{
title(TrConstants::CHAT_ASSISTANT),
Column{caGrid,
Column{useTools, allowFileSystemRead, allowFileSystemWrite, allowReadOutsideProject, autoApplyFileEdits},
Column{useTools, allowFileSystemRead, allowFileSystemWrite, allowAccessOutsideProject, autoApplyFileEdits},
caTemplateDescription}};
auto rootLayout = Column{
@ -533,7 +533,7 @@ void GeneralSettings::resetPageToDefaults()
resetAspect(useTools);
resetAspect(allowFileSystemRead);
resetAspect(allowFileSystemWrite);
resetAspect(allowReadOutsideProject);
resetAspect(allowAccessOutsideProject);
resetAspect(autoApplyFileEdits);
writeSettings();
}

View File

@ -103,7 +103,7 @@ public:
Utils::BoolAspect useTools{this};
Utils::BoolAspect allowFileSystemRead{this};
Utils::BoolAspect allowFileSystemWrite{this};
Utils::BoolAspect allowReadOutsideProject{this};
Utils::BoolAspect allowAccessOutsideProject{this};
Utils::BoolAspect autoApplyFileEdits{this};
Utils::StringAspect caTemplateDescription{this};

View File

@ -88,7 +88,7 @@ const char CA_ENABLE_CHAT_IN_NAVIGATION_PANEL[] = "QodeAssist.caEnableChatInNavi
const char CA_USE_TOOLS[] = "QodeAssist.caUseTools";
const char CA_ALLOW_FILE_SYSTEM_READ[] = "QodeAssist.caAllowFileSystemRead";
const char CA_ALLOW_FILE_SYSTEM_WRITE[] = "QodeAssist.caAllowFileSystemWrite";
const char CA_ALLOW_READ_OUTSIDE_PROJECT[] = "QodeAssist.caAllowReadOutsideProject";
const char CA_ALLOW_ACCESS_OUTSIDE_PROJECT[] = "QodeAssist.caAllowAccessOutsideProject";
const char QODE_ASSIST_GENERAL_OPTIONS_ID[] = "QodeAssist.GeneralOptions";
const char QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID[] = "QodeAssist.1GeneralSettingsPageId";