Copilot: Add more search paths for agent.js

Fixes: QTCREATORBUG-29750
Change-Id: I19c5ad41705daf00ae08fec88bd9ed40b8a34d12
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-10-13 08:54:03 +02:00
parent 9f0068a4e1
commit 7cd63a597e

View File

@@ -43,15 +43,27 @@ CopilotSettings::CopilotSettings()
const FilePath nodeFromPath = FilePath("node").searchInPath(); const FilePath nodeFromPath = FilePath("node").searchInPath();
const FilePaths searchDirs // clang-format off
= {FilePath::fromUserInput("~/.vim/pack/github/start/copilot.vim/dist/agent.js"),
// From: https://github.com/github/copilot.vim/blob/release/README.md#getting-started
const FilePaths searchDirs = {
// Vim, Linux/macOS:
FilePath::fromUserInput("~/.vim/pack/github/start/copilot.vim/dist/agent.js"),
FilePath::fromUserInput("~/.vim/pack/github/start/copilot.vim/copilot/dist/agent.js"), FilePath::fromUserInput("~/.vim/pack/github/start/copilot.vim/copilot/dist/agent.js"),
FilePath::fromUserInput(
"~/.config/nvim/pack/github/start/copilot.vim/copilot/dist/agent.js"), // Neovim, Linux/macOS:
FilePath::fromUserInput( FilePath::fromUserInput("~/.config/nvim/pack/github/start/copilot.vim/dist/agent.js"),
"~/vimfiles/pack/github/start/copilot.vim/copilot/dist/agent.js"), FilePath::fromUserInput("~/.config/nvim/pack/github/start/copilot.vim/copilot/dist/agent.js"),
FilePath::fromUserInput(
"~/AppData/Local/nvim/pack/github/start/copilot.vim/copilot/dist/agent.js")}; // Vim, Windows (PowerShell command):
FilePath::fromUserInput("~/vimfiles/pack/github/start/copilot.vim/dist/agent.js"),
FilePath::fromUserInput("~/vimfiles/pack/github/start/copilot.vim/copilot/dist/agent.js"),
// Neovim, Windows (PowerShell command):
FilePath::fromUserInput("~/AppData/Local/nvim/pack/github/start/copilot.vim/dist/agent.js"),
FilePath::fromUserInput("~/AppData/Local/nvim/pack/github/start/copilot.vim/copilot/dist/agent.js")
};
// clang-format on
const FilePath distFromVim = findOrDefault(searchDirs, &FilePath::exists); const FilePath distFromVim = findOrDefault(searchDirs, &FilePath::exists);