From 576c7b17055afc0f930e6ddb0f8654ab17a194bf Mon Sep 17 00:00:00 2001 From: Georg von Zengen Date: Tue, 29 Apr 2025 00:27:58 +0200 Subject: [PATCH 1/2] make path of server binary configurable --- doc/gitlab.nvim.txt | 1 + lua/gitlab/init.lua | 2 +- lua/gitlab/server.lua | 7 ++++++- lua/gitlab/state.lua | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/gitlab.nvim.txt b/doc/gitlab.nvim.txt index e1c38bcc..abe4198c 100644 --- a/doc/gitlab.nvim.txt +++ b/doc/gitlab.nvim.txt @@ -147,6 +147,7 @@ you call this function with no values the defaults will be used: port = nil, -- The port of the Go server, which runs in the background, if omitted or `nil` the port will be chosen automatically log_path = vim.fn.stdpath("cache") .. "/gitlab.nvim.log", -- Log path for the Go server config_path = nil, -- Custom path for `.gitlab.nvim` file, please read the "Connecting to Gitlab" section + bin = nil, -- Custom path to Go server binary, if not set the internal one is used. Only change if really needed debug = { request = false, -- Requests to/from Go server response = false, diff --git a/lua/gitlab/init.lua b/lua/gitlab/init.lua index f17c6320..e503f568 100644 --- a/lua/gitlab/init.lua +++ b/lua/gitlab/init.lua @@ -36,8 +36,8 @@ local function setup(args) if args == nil then args = {} end - server.build() -- Builds the Go binary if it doesn't exist state.merge_settings(args) -- Merges user settings with default settings + server.build() -- Builds the Go binary if it doesn't exist state.set_global_keymaps() -- Sets keymaps that are not bound to a specific buffer require("gitlab.colors") -- Sets colors reviewer.init() diff --git a/lua/gitlab/server.lua b/lua/gitlab/server.lua index 094100a1..e819c13c 100644 --- a/lua/gitlab/server.lua +++ b/lua/gitlab/server.lua @@ -84,9 +84,14 @@ end M.build = function(override) local file_path = u.current_file_path() local parent_dir = vim.fn.fnamemodify(file_path, ":h:h:h:h") + state.settings.root_path = parent_dir + + if state.settings.bin ~= nil then + u.notify(string.format("skipping server intallation, using: %s", state.settings.bin), vim.log.levels.INFO) + return true + end local bin_name = u.is_windows() and "bin.exe" or "bin" - state.settings.root_path = parent_dir state.settings.bin = parent_dir .. u.path_separator .. "cmd" .. u.path_separator .. bin_name if not override then diff --git a/lua/gitlab/state.lua b/lua/gitlab/state.lua index 52627184..90920c80 100644 --- a/lua/gitlab/state.lua +++ b/lua/gitlab/state.lua @@ -46,6 +46,7 @@ M.settings = { auth_provider = M.default_auth_provider, file_separator = u.path_separator, port = nil, -- choose random port + bin = nil, -- use the plugins internal debug = { request = false, response = false, From 56d8a350d945f7de7ad008a699f2e577b6a87b3f Mon Sep 17 00:00:00 2001 From: Georg von Zengen Date: Wed, 7 May 2025 09:05:20 +0200 Subject: [PATCH 2/2] apply suggested log string changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub F. BortlĂ­k --- lua/gitlab/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/gitlab/server.lua b/lua/gitlab/server.lua index e819c13c..d6fa42f3 100644 --- a/lua/gitlab/server.lua +++ b/lua/gitlab/server.lua @@ -87,7 +87,7 @@ M.build = function(override) state.settings.root_path = parent_dir if state.settings.bin ~= nil then - u.notify(string.format("skipping server intallation, using: %s", state.settings.bin), vim.log.levels.INFO) + u.notify(string.format("Skipping server installation, using: %s", state.settings.bin), vim.log.levels.INFO) return true end