README updates; log cleanup

This commit is contained in:
ray-x 2023-12-02 19:33:56 +11:00
parent 7b7c20029a
commit ae6a1025f9
3 changed files with 15 additions and 11 deletions

View File

@ -37,6 +37,9 @@ The plugin covers most features required for a gopher.
- Inlay hints: gopls (version 0.9.x or greater) inlay hints; version 0.10.x inlay hints are enabled by default. - Inlay hints: gopls (version 0.9.x or greater) inlay hints; version 0.10.x inlay hints are enabled by default.
- luasnip: go.nvim included a feature rich luasnips you definitally need to try. - luasnip: go.nvim included a feature rich luasnips you definitally need to try.
- Treesitter highlight injection: go.nvim included a treesitter highlight injection for SQL and JSON. - Treesitter highlight injection: go.nvim included a treesitter highlight injection for SQL and JSON.
- Generate return value for current function
- Geneerate go file with template
- Generate go struct from json
## Installation ## Installation

View File

@ -7,7 +7,7 @@ local getopt = require('go.alt_getopt')
local is_windows = util.is_windows() local is_windows = util.is_windows()
local is_git_shell = is_windows local is_git_shell = is_windows
and (vim.fn.exists('$SHELL') and vim.fn.expand('$SHELL'):find('bash.exe') ~= nil) and (vim.fn.exists('$SHELL') and vim.fn.expand('$SHELL'):find('bash.exe') ~= nil)
local function compile_efm() local function compile_efm()
local efm = [[%-G#\ %.%#]] local efm = [[%-G#\ %.%#]]
@ -292,7 +292,9 @@ M.runjob = function(cmd, runner, args, efm)
else else
local p, n = extract_filepath(value) local p, n = extract_filepath(value)
log(p, n, #lines) if p or n then
log(p, n, #lines)
end
if p == true then if p == true then
failed = true failed = true
value = vim.fs.dirname(n) .. '/' .. util.ltrim(value) value = vim.fs.dirname(n) .. '/' .. util.ltrim(value)
@ -301,7 +303,7 @@ M.runjob = function(cmd, runner, args, efm)
end end
end end
table.insert(lines, value) table.insert(lines, value)
log(value, #lines) log('output: ', value, #lines)
if itemn == 1 and failed and changed then if itemn == 1 and failed and changed then
itemn = #lines itemn = #lines
end end
@ -322,7 +324,7 @@ M.runjob = function(cmd, runner, args, efm)
end end
if next(errorlines) ~= nil and runner == 'golangci-lint' then if next(errorlines) ~= nil and runner == 'golangci-lint' then
efm = efm =
[[level=%tarning\ msg="%m:\ [%f:%l:%c:\ %.%#]",level=%tarning\ msg="%m",level=%trror\ msg="%m:\ [%f:%l:%c:\ %.%#]",level=%trror\ msg="%m",%f:%l:%c:\ %m,%f:%l:\ %m,%f:%l\ %m]] [[level=%tarning\ msg="%m:\ [%f:%l:%c:\ %.%#]",level=%tarning\ msg="%m",level=%trror\ msg="%m:\ [%f:%l:%c:\ %.%#]",level=%trror\ msg="%m",%f:%l:%c:\ %m,%f:%l:\ %m,%f:%l\ %m]]
end end
sprite.on_close() sprite.on_close()
@ -331,7 +333,7 @@ M.runjob = function(cmd, runner, args, efm)
end end
if event == 'exit' then if event == 'exit' then
log('exit') log(cmdstr .. 'exit with code: ', tostring(vim.v.shell_error))
sprite.on_close() sprite.on_close()
local info = cmdstr local info = cmdstr
local level = vim.log.levels.INFO local level = vim.log.levels.INFO
@ -346,7 +348,7 @@ M.runjob = function(cmd, runner, args, efm)
efm = efm, efm = efm,
}) })
failed = true failed = true
log(errorlines[1], job_id) log('exit with errorlines: ', errorlines[1], job_id)
vim.schedule(function() vim.schedule(function()
vim.cmd([[echo v:shell_error]]) vim.cmd([[echo v:shell_error]])
end) end)
@ -371,7 +373,8 @@ M.runjob = function(cmd, runner, args, efm)
if tonumber(data) ~= 0 then if tonumber(data) ~= 0 then
failed = true failed = true
info = info .. ' exited with code: ' .. tostring(data) .. vim.inspect(errorlines) -- stylua: ignore
info = info .. ' exited with code: ' .. tostring(data) .. ' error lines: ' .. vim.inspect(errorlines)
level = vim.log.levels.ERROR level = vim.log.levels.ERROR
end end
_GO_NVIM_CFG.job_id = nil _GO_NVIM_CFG.job_id = nil

View File

@ -99,9 +99,7 @@ local M = {
package: (package_identifier) @_param_package package: (package_identifier) @_param_package
name: (type_identifier) @_param_name)))) name: (type_identifier) @_param_name))))
) @testfunc ) @testfunc
(#contains? @test_name "Test") (#contains? @test_name "Test"))]],
(#match? @_param_package "testing")
(#match? @_param_name "T"))]],
query_tbl_testcase_node = [[ ( literal_value ( query_tbl_testcase_node = [[ ( literal_value (
literal_element ( literal_element (
literal_value .( literal_value .(
@ -112,7 +110,7 @@ local M = {
) @test.block ) @test.block
)) ))
]], ]],
query_sub_testcase_node = [[ (call_expression query_sub_testcase_node = [[ (call_expression
(selector_expression (selector_expression
(field_identifier) @method.name) (field_identifier) @method.name)
(argument_list (argument_list