feat: Add settings for ignore space and tab in codecompletion char count

This commit is contained in:
Petr Mironychev
2025-11-20 17:37:00 +01:00
parent 1e3b1997cc
commit 90655cded4
4 changed files with 18 additions and 3 deletions

View File

@ -132,6 +132,15 @@ CodeCompletionSettings::CodeCompletionSettings()
"Space is recommended as least conflicting with context menu.\n"
"(Only for Hint-based trigger mode)"));
ignoreWhitespaceInCharCount.setSettingsKey(Constants::CC_IGNORE_WHITESPACE_IN_CHAR_COUNT);
ignoreWhitespaceInCharCount.setLabelText(
Tr::tr("Ignore spaces and tabs in character count"));
ignoreWhitespaceInCharCount.setDefaultValue(true);
ignoreWhitespaceInCharCount.setToolTip(
Tr::tr("When enabled, spaces and tabs are not counted towards the character threshold "
"for triggering completions. This helps trigger completions based on actual code "
"characters only."));
// General Parameters Settings
temperature.setSettingsKey(Constants::CC_TEMPERATURE);
temperature.setLabelText(Tr::tr("Temperature:"));
@ -364,7 +373,8 @@ CodeCompletionSettings::CodeCompletionSettings()
auto hintTriggerSettings = Column{
Row{hintCharThreshold, hintHideTimeout, Stretch{1}},
Row{hintTriggerKey, Stretch{1}}};
Row{hintTriggerKey, Stretch{1}},
ignoreWhitespaceInCharCount};
return Column{Row{Stretch{1}, resetToDefaults},
Space{8},
@ -461,6 +471,7 @@ void CodeCompletionSettings::resetSettingsToDefaults()
resetAspect(hintCharThreshold);
resetAspect(hintHideTimeout);
resetAspect(hintTriggerKey);
resetAspect(ignoreWhitespaceInCharCount);
resetAspect(abortAssistOnRequest);
writeSettings();
}

View File

@ -44,6 +44,7 @@ public:
Utils::IntegerAspect hintCharThreshold{this};
Utils::IntegerAspect hintHideTimeout{this};
Utils::SelectionAspect hintTriggerKey{this};
Utils::BoolAspect ignoreWhitespaceInCharCount{this};
Utils::StringListAspect customLanguages{this};

View File

@ -89,6 +89,7 @@ const char CC_HINT_CHAR_THRESHOLD[] = "QodeAssist.ccHintCharThreshold";
const char CC_HINT_HIDE_TIMEOUT[] = "QodeAssist.ccHintHideTimeout";
const char CC_HINT_TRIGGER_KEY[] = "QodeAssist.ccHintTriggerKey";
const char CC_ABORT_ASSIST_ON_REQUEST[] = "QodeAssist.ccAbortAssistOnRequest";
const char CC_IGNORE_WHITESPACE_IN_CHAR_COUNT[] = "QodeAssist.ccIgnoreWhitespaceInCharCount";
const char MAX_FILE_THRESHOLD[] = "QodeAssist.maxFileThreshold";
const char CC_MULTILINE_COMPLETION[] = "QodeAssist.ccMultilineCompletion";
const char CC_MODEL_OUTPUT_HANDLER[] = "QodeAssist.ccModelOutputHandler";