From 9ea9ee2c4b2849a62bd6c0a31086307c7892d803 Mon Sep 17 00:00:00 2001 From: ray-x Date: Fri, 5 Aug 2022 10:02:35 +1000 Subject: [PATCH] issue #192 coverage sign priority --- README.md | 2 ++ doc/go.txt | 2 +- lua/go/json2struct.lua | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7c6edae..f1bed26 100644 --- a/README.md +++ b/README.md @@ -643,6 +643,8 @@ require('go').setup({ }, gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" } gopls_remote_auto = true, -- add -remote=auto to gopls + gocoverage_sign = "█", + gocoverage_sign_priority = 5, -- change to a higher number to override other signs dap_debug = true, -- set to false to disable dap dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua -- false: do not use keymap in go/dap.lua. you must define your own. diff --git a/doc/go.txt b/doc/go.txt index e323cfa..092ae99 100644 --- a/doc/go.txt +++ b/doc/go.txt @@ -396,7 +396,7 @@ You can setup go.nvim with following options: }, gopls_remote_auto = true, gocoverage_sign = "█", - gocoverage_sign_priority = 5, + gocoverage_sign_priority = 7, dap_debug = true, dap_debug_gui = true, dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua diff --git a/lua/go/json2struct.lua b/lua/go/json2struct.lua index 7c99ce5..5991796 100644 --- a/lua/go/json2struct.lua +++ b/lua/go/json2struct.lua @@ -8,12 +8,12 @@ function M.run(opts) local args, bang = opts.args, opts.bang local register = opts.register local json + + local range = vim.lsp.util.make_given_range_params().range if register then json = vim.fn.getreg(register) else - local range = vim.lsp.util.make_given_range_params().range log(range) - json = vim.api.nvim_buf_get_lines(0, range.start.line, range['end'].line + 1, true) json[1] = json[1]:sub(range.start.character + 1) json[#json] = json[#json]:sub(1, range['end'].character + 1)