mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-22 02:22:44 -05:00
fear: Add hint-trigger for call code completion (#266)
This commit is contained in:
@ -65,8 +65,21 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
"as comments\n"
|
||||
"Raw Text: Shows unprocessed text without any formatting"));
|
||||
|
||||
completionTriggerMode.setLabelText(Tr::tr("Completion trigger mode:"));
|
||||
completionTriggerMode.setSettingsKey(Constants::CC_COMPLETION_TRIGGER_MODE);
|
||||
completionTriggerMode.setDisplayStyle(Utils::SelectionAspect::DisplayStyle::ComboBox);
|
||||
completionTriggerMode.addOption("Hint-based (Tab to trigger)");
|
||||
completionTriggerMode.addOption("Automatic");
|
||||
completionTriggerMode.setDefaultValue("Hint-based (Tab to trigger)");
|
||||
completionTriggerMode.setToolTip(
|
||||
Tr::tr("Hint-based: Shows a hint when typing, press Tab to request completion\n"
|
||||
"Automatic: Automatically requests completion after typing threshold"));
|
||||
|
||||
startSuggestionTimer.setSettingsKey(Constants::СС_START_SUGGESTION_TIMER);
|
||||
startSuggestionTimer.setLabelText(Tr::tr("with delay(ms)"));
|
||||
startSuggestionTimer.setToolTip(
|
||||
Tr::tr("Delay before sending the completion request.\n"
|
||||
"(Only for Automatic trigger mode)"));
|
||||
startSuggestionTimer.setRange(10, 10000);
|
||||
startSuggestionTimer.setDefaultValue(350);
|
||||
|
||||
@ -74,7 +87,8 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
autoCompletionCharThreshold.setLabelText(Tr::tr("AI suggestion triggers after typing"));
|
||||
autoCompletionCharThreshold.setToolTip(
|
||||
Tr::tr("The number of characters that need to be typed within the typing interval "
|
||||
"before an AI suggestion request is sent."));
|
||||
"before an AI suggestion request is sent automatically.\n"
|
||||
"(Only for Automatic trigger mode)"));
|
||||
autoCompletionCharThreshold.setRange(0, 10);
|
||||
autoCompletionCharThreshold.setDefaultValue(1);
|
||||
|
||||
@ -82,10 +96,42 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
autoCompletionTypingInterval.setLabelText(Tr::tr("character(s) within(ms)"));
|
||||
autoCompletionTypingInterval.setToolTip(
|
||||
Tr::tr("The time window (in milliseconds) during which the character threshold "
|
||||
"must be met to trigger an AI suggestion request."));
|
||||
"must be met to trigger an AI suggestion request automatically.\n"
|
||||
"(Only for Automatic trigger mode)"));
|
||||
autoCompletionTypingInterval.setRange(500, 5000);
|
||||
autoCompletionTypingInterval.setDefaultValue(1200);
|
||||
|
||||
hintCharThreshold.setSettingsKey(Constants::CC_HINT_CHAR_THRESHOLD);
|
||||
hintCharThreshold.setLabelText(Tr::tr("Hint shows after typing"));
|
||||
hintCharThreshold.setToolTip(
|
||||
Tr::tr("The number of characters that need to be typed before the hint widget appears "
|
||||
"(only for Hint-based trigger mode)."));
|
||||
hintCharThreshold.setRange(1, 10);
|
||||
hintCharThreshold.setDefaultValue(3);
|
||||
|
||||
hintHideTimeout.setSettingsKey(Constants::CC_HINT_HIDE_TIMEOUT);
|
||||
hintHideTimeout.setLabelText(Tr::tr("Hint auto-hide timeout (ms)"));
|
||||
hintHideTimeout.setToolTip(
|
||||
Tr::tr("Time in milliseconds after which the hint widget will automatically hide "
|
||||
"(only for Hint-based trigger mode)."));
|
||||
hintHideTimeout.setRange(500, 10000);
|
||||
hintHideTimeout.setDefaultValue(4000);
|
||||
|
||||
hintTriggerKey.setLabelText(Tr::tr("Trigger key:"));
|
||||
hintTriggerKey.setSettingsKey(Constants::CC_HINT_TRIGGER_KEY);
|
||||
hintTriggerKey.setDisplayStyle(Utils::SelectionAspect::DisplayStyle::ComboBox);
|
||||
hintTriggerKey.addOption("Space");
|
||||
hintTriggerKey.addOption("Ctrl+Space");
|
||||
hintTriggerKey.addOption("Alt+Space");
|
||||
hintTriggerKey.addOption("Ctrl+Enter");
|
||||
hintTriggerKey.addOption("Tab");
|
||||
hintTriggerKey.addOption("Enter");
|
||||
hintTriggerKey.setDefaultValue("Space");
|
||||
hintTriggerKey.setToolTip(
|
||||
Tr::tr("Key to press for requesting completion when hint is visible.\n"
|
||||
"Space is recommended as least conflicting with context menu.\n"
|
||||
"(Only for Hint-based trigger mode)"));
|
||||
|
||||
// General Parameters Settings
|
||||
temperature.setSettingsKey(Constants::CC_TEMPERATURE);
|
||||
temperature.setLabelText(Tr::tr("Temperature:"));
|
||||
@ -212,6 +258,14 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
showProgressWidget.setLabelText(Tr::tr("Show progress indicator during code completion"));
|
||||
showProgressWidget.setDefaultValue(true);
|
||||
|
||||
abortAssistOnRequest.setSettingsKey(Constants::CC_ABORT_ASSIST_ON_REQUEST);
|
||||
abortAssistOnRequest.setLabelText(Tr::tr("Abort existing assist on new completion request"));
|
||||
abortAssistOnRequest.setToolTip(
|
||||
Tr::tr("When enabled, cancels any active Qt Creator code assist popup "
|
||||
"before requesting LLM completion.\n"
|
||||
"(Only for Automatic trigger mode)"));
|
||||
abortAssistOnRequest.setDefaultValue(true);
|
||||
|
||||
useOpenFilesContext.setSettingsKey(Constants::CC_USE_OPEN_FILES_CONTEXT);
|
||||
useOpenFilesContext.setLabelText(Tr::tr("Include context from open files"));
|
||||
useOpenFilesContext.setDefaultValue(false);
|
||||
@ -293,19 +347,33 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
}},
|
||||
Row{useProjectChangesCache, maxChangesCacheSize, Stretch{1}}};
|
||||
|
||||
auto generalSettings = Column{
|
||||
autoCompletion,
|
||||
multiLineCompletion,
|
||||
Row{modelOutputHandler, Stretch{1}},
|
||||
Row{completionTriggerMode, Stretch{1}},
|
||||
showProgressWidget,
|
||||
useOpenFilesContext,
|
||||
abortAssistOnRequest};
|
||||
|
||||
auto autoTriggerSettings = Column{
|
||||
Row{autoCompletionCharThreshold,
|
||||
autoCompletionTypingInterval,
|
||||
startSuggestionTimer,
|
||||
Stretch{1}}};
|
||||
|
||||
auto hintTriggerSettings = Column{
|
||||
Row{hintCharThreshold, hintHideTimeout, Stretch{1}},
|
||||
Row{hintTriggerKey, Stretch{1}}};
|
||||
|
||||
return Column{Row{Stretch{1}, resetToDefaults},
|
||||
Space{8},
|
||||
Group{title(TrConstants::AUTO_COMPLETION_SETTINGS),
|
||||
Column{autoCompletion,
|
||||
Column{Group{title(Tr::tr("General Settings")), generalSettings},
|
||||
Space{8},
|
||||
multiLineCompletion,
|
||||
Row{modelOutputHandler, Stretch{1}},
|
||||
Row{autoCompletionCharThreshold,
|
||||
autoCompletionTypingInterval,
|
||||
startSuggestionTimer,
|
||||
Stretch{1}},
|
||||
showProgressWidget,
|
||||
useOpenFilesContext}},
|
||||
Group{title(Tr::tr("Automatic Trigger Mode")), autoTriggerSettings},
|
||||
Space{8},
|
||||
Group{title(Tr::tr("Hint-based Trigger Mode")), hintTriggerSettings}}},
|
||||
Space{8},
|
||||
Group{title(Tr::tr("General Parameters")),
|
||||
Column{
|
||||
@ -389,6 +457,11 @@ void CodeCompletionSettings::resetSettingsToDefaults()
|
||||
resetAspect(useOpenFilesInQuickRefactor);
|
||||
resetAspect(quickRefactorSystemPrompt);
|
||||
resetAspect(modelOutputHandler);
|
||||
resetAspect(completionTriggerMode);
|
||||
resetAspect(hintCharThreshold);
|
||||
resetAspect(hintHideTimeout);
|
||||
resetAspect(hintTriggerKey);
|
||||
resetAspect(abortAssistOnRequest);
|
||||
writeSettings();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user