mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-02-16 12:03:09 -05:00
fix: Remove unusing variables from settings
This commit is contained in:
@ -362,7 +362,7 @@ LLMCore::ContextData QuickRefactorHandler::prepareContext(
|
|||||||
"\n- Preserve the original code structure when possible"
|
"\n- Preserve the original code structure when possible"
|
||||||
"\n- Only change what is necessary to fulfill the user's request";
|
"\n- Only change what is necessary to fulfill the user's request";
|
||||||
|
|
||||||
if (Settings::codeCompletionSettings().useOpenFilesInQuickRefactor()) {
|
if (Settings::quickRefactorSettings().useOpenFilesInQuickRefactor()) {
|
||||||
systemPrompt += "\n\n" + m_contextManager.openedFilesContext({documentInfo.filePath});
|
systemPrompt += "\n\n" + m_contextManager.openedFilesContext({documentInfo.filePath});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -287,18 +287,6 @@ CodeCompletionSettings::CodeCompletionSettings()
|
|||||||
maxChangesCacheSize.setRange(2, 1000);
|
maxChangesCacheSize.setRange(2, 1000);
|
||||||
maxChangesCacheSize.setDefaultValue(10);
|
maxChangesCacheSize.setDefaultValue(10);
|
||||||
|
|
||||||
// Quick refactor command settings
|
|
||||||
useOpenFilesInQuickRefactor.setSettingsKey(Constants::CC_USE_OPEN_FILES_IN_QUICK_REFACTOR);
|
|
||||||
useOpenFilesInQuickRefactor.setLabelText(
|
|
||||||
Tr::tr("Include context from open files in quick refactor"));
|
|
||||||
useOpenFilesInQuickRefactor.setDefaultValue(false);
|
|
||||||
quickRefactorSystemPrompt.setSettingsKey(Constants::CC_QUICK_REFACTOR_SYSTEM_PROMPT);
|
|
||||||
quickRefactorSystemPrompt.setDisplayStyle(Utils::StringAspect::TextEditDisplay);
|
|
||||||
quickRefactorSystemPrompt.setDefaultValue(
|
|
||||||
"You are an expert C++, Qt, and QML code completion assistant. Your task is to provide"
|
|
||||||
"precise and contextually appropriate code completions to insert depending on user "
|
|
||||||
"instructions.\n\n");
|
|
||||||
|
|
||||||
// Ollama Settings
|
// Ollama Settings
|
||||||
ollamaLivetime.setSettingsKey(Constants::CC_OLLAMA_LIVETIME);
|
ollamaLivetime.setSettingsKey(Constants::CC_OLLAMA_LIVETIME);
|
||||||
ollamaLivetime.setToolTip(
|
ollamaLivetime.setToolTip(
|
||||||
@ -417,9 +405,6 @@ CodeCompletionSettings::CodeCompletionSettings()
|
|||||||
Space{8},
|
Space{8},
|
||||||
Group{title(Tr::tr("Context Settings")), contextItem},
|
Group{title(Tr::tr("Context Settings")), contextItem},
|
||||||
Space{8},
|
Space{8},
|
||||||
Group{title(Tr::tr("Quick Refactor Settings")),
|
|
||||||
Column{useOpenFilesInQuickRefactor, quickRefactorSystemPrompt}},
|
|
||||||
Space{8},
|
|
||||||
Group{title(Tr::tr("OpenAI Responses API")), Column{Row{openAIResponsesGrid, Stretch{1}}}},
|
Group{title(Tr::tr("OpenAI Responses API")), Column{Row{openAIResponsesGrid, Stretch{1}}}},
|
||||||
Space{8},
|
Space{8},
|
||||||
Group{title(Tr::tr("Ollama Settings")), Column{Row{ollamaGrid, Stretch{1}}}},
|
Group{title(Tr::tr("Ollama Settings")), Column{Row{ollamaGrid, Stretch{1}}}},
|
||||||
@ -489,8 +474,6 @@ void CodeCompletionSettings::resetSettingsToDefaults()
|
|||||||
resetAspect(customLanguages);
|
resetAspect(customLanguages);
|
||||||
resetAspect(showProgressWidget);
|
resetAspect(showProgressWidget);
|
||||||
resetAspect(useOpenFilesContext);
|
resetAspect(useOpenFilesContext);
|
||||||
resetAspect(useOpenFilesInQuickRefactor);
|
|
||||||
resetAspect(quickRefactorSystemPrompt);
|
|
||||||
resetAspect(modelOutputHandler);
|
resetAspect(modelOutputHandler);
|
||||||
resetAspect(completionTriggerMode);
|
resetAspect(completionTriggerMode);
|
||||||
resetAspect(hintCharThreshold);
|
resetAspect(hintCharThreshold);
|
||||||
|
|||||||
@ -82,10 +82,6 @@ public:
|
|||||||
Utils::BoolAspect useProjectChangesCache{this};
|
Utils::BoolAspect useProjectChangesCache{this};
|
||||||
Utils::IntegerAspect maxChangesCacheSize{this};
|
Utils::IntegerAspect maxChangesCacheSize{this};
|
||||||
|
|
||||||
// Quick refactor command settings
|
|
||||||
Utils::BoolAspect useOpenFilesInQuickRefactor{this};
|
|
||||||
Utils::StringAspect quickRefactorSystemPrompt{this};
|
|
||||||
|
|
||||||
// Ollama Settings
|
// Ollama Settings
|
||||||
Utils::StringAspect ollamaLivetime{this};
|
Utils::StringAspect ollamaLivetime{this};
|
||||||
Utils::IntegerAspect contextWindow{this};
|
Utils::IntegerAspect contextWindow{this};
|
||||||
|
|||||||
@ -93,8 +93,9 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
// Ollama Settings
|
// Ollama Settings
|
||||||
ollamaLivetime.setSettingsKey(Constants::QR_OLLAMA_LIVETIME);
|
ollamaLivetime.setSettingsKey(Constants::QR_OLLAMA_LIVETIME);
|
||||||
ollamaLivetime.setToolTip(
|
ollamaLivetime.setToolTip(
|
||||||
Tr::tr("Time to suspend Ollama after completion request (in minutes), "
|
Tr::tr(
|
||||||
"Only Ollama, -1 to disable"));
|
"Time to suspend Ollama after completion request (in minutes), "
|
||||||
|
"Only Ollama, -1 to disable"));
|
||||||
ollamaLivetime.setLabelText("Livetime:");
|
ollamaLivetime.setLabelText("Livetime:");
|
||||||
ollamaLivetime.setDefaultValue("5m");
|
ollamaLivetime.setDefaultValue("5m");
|
||||||
ollamaLivetime.setDisplayStyle(Utils::StringAspect::LineEditDisplay);
|
ollamaLivetime.setDisplayStyle(Utils::StringAspect::LineEditDisplay);
|
||||||
@ -107,29 +108,33 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
useTools.setSettingsKey(Constants::QR_USE_TOOLS);
|
useTools.setSettingsKey(Constants::QR_USE_TOOLS);
|
||||||
useTools.setLabelText(Tr::tr("Enable Tools"));
|
useTools.setLabelText(Tr::tr("Enable Tools"));
|
||||||
useTools.setToolTip(
|
useTools.setToolTip(
|
||||||
Tr::tr("Enable AI tools/functions for quick refactoring (allows reading project files, "
|
Tr::tr(
|
||||||
"searching code, etc.)"));
|
"Enable AI tools/functions for quick refactoring (allows reading project files, "
|
||||||
|
"searching code, etc.)"));
|
||||||
useTools.setDefaultValue(false);
|
useTools.setDefaultValue(false);
|
||||||
|
|
||||||
useThinking.setSettingsKey(Constants::QR_USE_THINKING);
|
useThinking.setSettingsKey(Constants::QR_USE_THINKING);
|
||||||
useThinking.setLabelText(Tr::tr("Enable Thinking Mode"));
|
useThinking.setLabelText(Tr::tr("Enable Thinking Mode"));
|
||||||
useThinking.setToolTip(
|
useThinking.setToolTip(
|
||||||
Tr::tr("Enable extended thinking mode for complex refactoring tasks (supported by "
|
Tr::tr(
|
||||||
"compatible models like Claude and Google AI)"));
|
"Enable extended thinking mode for complex refactoring tasks (supported by "
|
||||||
|
"compatible models like Claude and Google AI)"));
|
||||||
useThinking.setDefaultValue(false);
|
useThinking.setDefaultValue(false);
|
||||||
|
|
||||||
thinkingBudgetTokens.setSettingsKey(Constants::QR_THINKING_BUDGET_TOKENS);
|
thinkingBudgetTokens.setSettingsKey(Constants::QR_THINKING_BUDGET_TOKENS);
|
||||||
thinkingBudgetTokens.setLabelText(Tr::tr("Thinking Budget Tokens:"));
|
thinkingBudgetTokens.setLabelText(Tr::tr("Thinking Budget Tokens:"));
|
||||||
thinkingBudgetTokens.setToolTip(
|
thinkingBudgetTokens.setToolTip(
|
||||||
Tr::tr("Number of tokens allocated for thinking process. Use -1 for dynamic thinking "
|
Tr::tr(
|
||||||
"(model decides), 0 to disable, or positive value for custom budget"));
|
"Number of tokens allocated for thinking process. Use -1 for dynamic thinking "
|
||||||
|
"(model decides), 0 to disable, or positive value for custom budget"));
|
||||||
thinkingBudgetTokens.setRange(-1, 100000);
|
thinkingBudgetTokens.setRange(-1, 100000);
|
||||||
thinkingBudgetTokens.setDefaultValue(10000);
|
thinkingBudgetTokens.setDefaultValue(10000);
|
||||||
|
|
||||||
thinkingMaxTokens.setSettingsKey(Constants::QR_THINKING_MAX_TOKENS);
|
thinkingMaxTokens.setSettingsKey(Constants::QR_THINKING_MAX_TOKENS);
|
||||||
thinkingMaxTokens.setLabelText(Tr::tr("Thinking Max Output Tokens:"));
|
thinkingMaxTokens.setLabelText(Tr::tr("Thinking Max Output Tokens:"));
|
||||||
thinkingMaxTokens.setToolTip(
|
thinkingMaxTokens.setToolTip(
|
||||||
Tr::tr("Maximum output tokens when thinking mode is enabled (includes thinking + response)"));
|
Tr::tr(
|
||||||
|
"Maximum output tokens when thinking mode is enabled (includes thinking + response)"));
|
||||||
thinkingMaxTokens.setRange(1000, 200000);
|
thinkingMaxTokens.setRange(1000, 200000);
|
||||||
thinkingMaxTokens.setDefaultValue(16000);
|
thinkingMaxTokens.setDefaultValue(16000);
|
||||||
|
|
||||||
@ -144,13 +149,14 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
openAIResponsesReasoningEffort.addOption("High");
|
openAIResponsesReasoningEffort.addOption("High");
|
||||||
openAIResponsesReasoningEffort.setDefaultValue("Medium");
|
openAIResponsesReasoningEffort.setDefaultValue("Medium");
|
||||||
openAIResponsesReasoningEffort.setToolTip(
|
openAIResponsesReasoningEffort.setToolTip(
|
||||||
Tr::tr("Constrains effort on reasoning for OpenAI gpt-5 and o-series models:\n\n"
|
Tr::tr(
|
||||||
"None: No reasoning (gpt-5.1 only)\n"
|
"Constrains effort on reasoning for OpenAI gpt-5 and o-series models:\n\n"
|
||||||
"Minimal: Minimal reasoning effort (o-series only)\n"
|
"None: No reasoning (gpt-5.1 only)\n"
|
||||||
"Low: Low reasoning effort\n"
|
"Minimal: Minimal reasoning effort (o-series only)\n"
|
||||||
"Medium: Balanced reasoning (default for most models)\n"
|
"Low: Low reasoning effort\n"
|
||||||
"High: Maximum reasoning effort (gpt-5-pro only supports this)\n\n"
|
"Medium: Balanced reasoning (default for most models)\n"
|
||||||
"Note: Reducing effort = faster responses + fewer tokens"));
|
"High: Maximum reasoning effort (gpt-5-pro only supports this)\n\n"
|
||||||
|
"Note: Reducing effort = faster responses + fewer tokens"));
|
||||||
|
|
||||||
// Context Settings
|
// Context Settings
|
||||||
readFullFile.setSettingsKey(Constants::QR_READ_FULL_FILE);
|
readFullFile.setSettingsKey(Constants::QR_READ_FULL_FILE);
|
||||||
@ -177,9 +183,11 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
displayMode.setSettingsKey(Constants::QR_DISPLAY_MODE);
|
displayMode.setSettingsKey(Constants::QR_DISPLAY_MODE);
|
||||||
displayMode.setLabelText(Tr::tr("Display Mode:"));
|
displayMode.setLabelText(Tr::tr("Display Mode:"));
|
||||||
displayMode.setToolTip(
|
displayMode.setToolTip(
|
||||||
Tr::tr("Choose how to display refactoring suggestions:\n"
|
Tr::tr(
|
||||||
"- Inline Widget: Shows refactor in a widget overlay with Apply/Decline buttons (default)\n"
|
"Choose how to display refactoring suggestions:\n"
|
||||||
"- Qt Creator Suggestion: Uses Qt Creator's built-in suggestion system"));
|
"- Inline Widget: Shows refactor in a widget overlay with Apply/Decline buttons "
|
||||||
|
"(default)\n"
|
||||||
|
"- Qt Creator Suggestion: Uses Qt Creator's built-in suggestion system"));
|
||||||
displayMode.addOption(Tr::tr("Inline Widget"));
|
displayMode.addOption(Tr::tr("Inline Widget"));
|
||||||
displayMode.addOption(Tr::tr("Qt Creator Suggestion"));
|
displayMode.addOption(Tr::tr("Qt Creator Suggestion"));
|
||||||
displayMode.setDefaultValue(0);
|
displayMode.setDefaultValue(0);
|
||||||
@ -187,9 +195,10 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
widgetOrientation.setSettingsKey(Constants::QR_WIDGET_ORIENTATION);
|
widgetOrientation.setSettingsKey(Constants::QR_WIDGET_ORIENTATION);
|
||||||
widgetOrientation.setLabelText(Tr::tr("Widget Orientation:"));
|
widgetOrientation.setLabelText(Tr::tr("Widget Orientation:"));
|
||||||
widgetOrientation.setToolTip(
|
widgetOrientation.setToolTip(
|
||||||
Tr::tr("Choose default orientation for refactor widget:\n"
|
Tr::tr(
|
||||||
"- Horizontal: Original and refactored code side by side (default)\n"
|
"Choose default orientation for refactor widget:\n"
|
||||||
"- Vertical: Original and refactored code stacked vertically"));
|
"- Horizontal: Original and refactored code side by side (default)\n"
|
||||||
|
"- Vertical: Original and refactored code stacked vertically"));
|
||||||
widgetOrientation.addOption(Tr::tr("Horizontal"));
|
widgetOrientation.addOption(Tr::tr("Horizontal"));
|
||||||
widgetOrientation.addOption(Tr::tr("Vertical"));
|
widgetOrientation.addOption(Tr::tr("Vertical"));
|
||||||
widgetOrientation.setDefaultValue(0);
|
widgetOrientation.setDefaultValue(0);
|
||||||
@ -226,6 +235,11 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
"precise and contextually appropriate code completions to insert depending on user "
|
"precise and contextually appropriate code completions to insert depending on user "
|
||||||
"instructions.\n\n");
|
"instructions.\n\n");
|
||||||
|
|
||||||
|
useOpenFilesInQuickRefactor.setSettingsKey(Constants::QR_USE_OPEN_FILES_IN_QUICK_REFACTOR);
|
||||||
|
useOpenFilesInQuickRefactor.setLabelText(
|
||||||
|
Tr::tr("Include context from open files in quick refactor"));
|
||||||
|
useOpenFilesInQuickRefactor.setDefaultValue(false);
|
||||||
|
|
||||||
resetToDefaults.m_buttonText = TrConstants::RESET_TO_DEFAULTS;
|
resetToDefaults.m_buttonText = TrConstants::RESET_TO_DEFAULTS;
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
@ -262,7 +276,10 @@ QuickRefactorSettings::QuickRefactorSettings()
|
|||||||
|
|
||||||
auto contextGrid = Grid{};
|
auto contextGrid = Grid{};
|
||||||
contextGrid.addRow({Row{readFullFile}});
|
contextGrid.addRow({Row{readFullFile}});
|
||||||
contextGrid.addRow({Row{readFileParts, readStringsBeforeCursor, readStringsAfterCursor}});
|
contextGrid.addRow({
|
||||||
|
Row{readFileParts, readStringsBeforeCursor, readStringsAfterCursor},
|
||||||
|
});
|
||||||
|
contextGrid.addRow({Row{useOpenFilesInQuickRefactor}});
|
||||||
|
|
||||||
auto displayGrid = Grid{};
|
auto displayGrid = Grid{};
|
||||||
displayGrid.addRow({Row{displayMode}});
|
displayGrid.addRow({Row{displayMode}});
|
||||||
@ -323,10 +340,13 @@ void QuickRefactorSettings::setupConnections()
|
|||||||
bool isInlineWidget = (displayMode.volatileValue() == 0);
|
bool isInlineWidget = (displayMode.volatileValue() == 0);
|
||||||
widgetOrientation.setEnabled(isInlineWidget);
|
widgetOrientation.setEnabled(isInlineWidget);
|
||||||
};
|
};
|
||||||
|
|
||||||
connect(&displayMode, &Utils::SelectionAspect::volatileValueChanged,
|
connect(
|
||||||
this, updateWidgetOrientationEnabled);
|
&displayMode,
|
||||||
|
&Utils::SelectionAspect::volatileValueChanged,
|
||||||
|
this,
|
||||||
|
updateWidgetOrientationEnabled);
|
||||||
|
|
||||||
updateWidgetOrientationEnabled();
|
updateWidgetOrientationEnabled();
|
||||||
|
|
||||||
auto validateWidgetSizes = [this]() {
|
auto validateWidgetSizes = [this]() {
|
||||||
@ -382,6 +402,7 @@ void QuickRefactorSettings::resetSettingsToDefaults()
|
|||||||
resetAspect(widgetMinHeight);
|
resetAspect(widgetMinHeight);
|
||||||
resetAspect(widgetMaxHeight);
|
resetAspect(widgetMaxHeight);
|
||||||
resetAspect(systemPrompt);
|
resetAspect(systemPrompt);
|
||||||
|
resetAspect(useOpenFilesInQuickRefactor);
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,4 +422,3 @@ public:
|
|||||||
const QuickRefactorSettingsPage quickRefactorSettingsPage;
|
const QuickRefactorSettingsPage quickRefactorSettingsPage;
|
||||||
|
|
||||||
} // namespace QodeAssist::Settings
|
} // namespace QodeAssist::Settings
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,7 @@ public:
|
|||||||
|
|
||||||
// Prompt Settings
|
// Prompt Settings
|
||||||
Utils::StringAspect systemPrompt{this};
|
Utils::StringAspect systemPrompt{this};
|
||||||
|
Utils::BoolAspect useOpenFilesInQuickRefactor{this};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|||||||
@ -165,10 +165,6 @@ const char CC_MAX_CHANGES_CACHE_SIZE[] = "QodeAssist.ccMaxChangesCacheSize";
|
|||||||
const char CA_USE_SYSTEM_PROMPT[] = "QodeAssist.useChatSystemPrompt";
|
const char CA_USE_SYSTEM_PROMPT[] = "QodeAssist.useChatSystemPrompt";
|
||||||
const char CA_SYSTEM_PROMPT[] = "QodeAssist.chatSystemPrompt";
|
const char CA_SYSTEM_PROMPT[] = "QodeAssist.chatSystemPrompt";
|
||||||
|
|
||||||
// quick refactor command settings
|
|
||||||
const char CC_QUICK_REFACTOR_SYSTEM_PROMPT[] = "QodeAssist.ccQuickRefactorSystemPrompt";
|
|
||||||
const char CC_USE_OPEN_FILES_IN_QUICK_REFACTOR[] = "QodeAssist.ccUseOpenFilesInQuickRefactor";
|
|
||||||
|
|
||||||
// preset prompt settings
|
// preset prompt settings
|
||||||
const char CC_TEMPERATURE[] = "QodeAssist.ccTemperature";
|
const char CC_TEMPERATURE[] = "QodeAssist.ccTemperature";
|
||||||
const char CC_MAX_TOKENS[] = "QodeAssist.ccMaxTokens";
|
const char CC_MAX_TOKENS[] = "QodeAssist.ccMaxTokens";
|
||||||
@ -237,6 +233,7 @@ const char QR_READ_FULL_FILE[] = "QodeAssist.qrReadFullFile";
|
|||||||
const char QR_READ_STRINGS_BEFORE_CURSOR[] = "QodeAssist.qrReadStringsBeforeCursor";
|
const char QR_READ_STRINGS_BEFORE_CURSOR[] = "QodeAssist.qrReadStringsBeforeCursor";
|
||||||
const char QR_READ_STRINGS_AFTER_CURSOR[] = "QodeAssist.qrReadStringsAfterCursor";
|
const char QR_READ_STRINGS_AFTER_CURSOR[] = "QodeAssist.qrReadStringsAfterCursor";
|
||||||
const char QR_SYSTEM_PROMPT[] = "QodeAssist.qrSystemPrompt";
|
const char QR_SYSTEM_PROMPT[] = "QodeAssist.qrSystemPrompt";
|
||||||
|
const char QR_USE_OPEN_FILES_IN_QUICK_REFACTOR[] = "QodeAssist.qrUseOpenFilesInQuickRefactor";
|
||||||
const char QR_DISPLAY_MODE[] = "QodeAssist.qrDisplayMode";
|
const char QR_DISPLAY_MODE[] = "QodeAssist.qrDisplayMode";
|
||||||
const char QR_WIDGET_ORIENTATION[] = "QodeAssist.qrWidgetOrientation";
|
const char QR_WIDGET_ORIENTATION[] = "QodeAssist.qrWidgetOrientation";
|
||||||
const char QR_WIDGET_MIN_WIDTH[] = "QodeAssist.qrWidgetMinWidth";
|
const char QR_WIDGET_MIN_WIDTH[] = "QodeAssist.qrWidgetMinWidth";
|
||||||
|
|||||||
Reference in New Issue
Block a user