Copilot: Register settings aspects more directly

Also simplify a search.

Change-Id: I2ba511ca3250c624fb7dbc2b44f845a5757e72ce
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-05-26 10:14:35 +02:00
parent 0e60643430
commit b47df2a304
2 changed files with 4 additions and 9 deletions

View File

@@ -32,11 +32,8 @@ CopilotSettings::CopilotSettings()
FilePath::fromUserInput(
"~/AppData/Local/nvim/pack/github/start/copilot.vim/copilot/dist/agent.js")};
const FilePath distFromVim = Utils::findOrDefault(searchDirs, [](const FilePath &fp) {
return fp.exists();
});
const FilePath distFromVim = Utils::findOrDefault(searchDirs, &FilePath::exists);
registerAspect(&nodeJsPath);
nodeJsPath.setExpectedKind(PathChooser::ExistingCommand);
nodeJsPath.setDefaultFilePath(nodeFromPath);
nodeJsPath.setSettingsKey("Copilot.NodeJsPath");
@@ -47,7 +44,6 @@ CopilotSettings::CopilotSettings()
Tr::tr("Select path to node.js executable. See https://nodejs.org/de/download/"
"for installation instructions."));
registerAspect(&distPath);
distPath.setExpectedKind(PathChooser::File);
distPath.setDefaultFilePath(distFromVim);
distPath.setSettingsKey("Copilot.DistPath");
@@ -58,7 +54,6 @@ CopilotSettings::CopilotSettings()
"Select path to agent.js in copilot neovim plugin. See "
"https://github.com/github/copilot.vim#getting-started for installation instructions."));
registerAspect(&autoComplete);
autoComplete.setDisplayName(Tr::tr("Auto Complete"));
autoComplete.setLabelText(Tr::tr("Request completions automatically"));
autoComplete.setDefaultValue(true);