Skip to content

Commit

Permalink
small bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdsk committed Oct 14, 2021
1 parent c43b139 commit c822898
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
6 changes: 3 additions & 3 deletions lua/prosesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ function M:setup(user_cfg)
return
end

-- if cfg.langtool_bin ~= nil then
-- langtool.start_server(on_event, cfg.langtool_bin)
-- end
if cfg.langtool_bin ~= nil then
langtool.start_server(on_event, cfg.langtool_bin)
end

if cfg.default_cmds then
config.add_cmds()
Expand Down
2 changes: 1 addition & 1 deletion lua/prosesitter/actions/hover.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function M.popup()
return false
end

local id = mark[1][1]
local id = mark[1]
local issues = shared.issues:for_id(id)

vim.lsp.util.open_floating_preview(format(issues), "markdown", {})
Expand Down
1 change: 0 additions & 1 deletion lua/prosesitter/backend/langtool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ local function mark_rdy_if_responding(on_event)
if text ~= nil then
if string.starts(text, '{"software":{"name":"LanguageTool"') then
shared.langtool_running = true
log.info("Language tool started")
for buf, _ in pairs(shared.buf_query) do
on_event:lint_everything(buf)
end
Expand Down
16 changes: 8 additions & 8 deletions lua/prosesitter/on_event/check/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ local function do_check()
M.schedualled = false
local req = M.lintreq:build()

-- if shared.langtool_running then
-- local function post_langtool(json)
-- local results = langtool.add_spans(json)
-- marks.mark_results(results, req.areas, "langool", langtool.to_meta)
-- end
-- local curl_args = { "--no-progress-meter", "--data", "@-", "http://localhost:8081/v2/check" }
-- async.dispatch_with_stdin(langtool_query(req.text), "curl", curl_args, post_langtool)
-- end
if shared.langtool_running then
local function post_langtool(json)
local results = langtool.add_spans(json)
marks.mark_results(results, req.areas, "langtool", langtool.to_meta)
end
local curl_args = { "--no-progress-meter", "--data", "@-", "http://localhost:8081/v2/check" }
async.dispatch_with_stdin(langtool_query(req.text), "curl", curl_args, post_langtool)
end

if cfg.vale_bin ~= nil then
local function post_vale(json)
Expand Down
8 changes: 8 additions & 0 deletions lua/prosesitter/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ local M = {}
M.langtool_running = false
M.buf_query = {}

function M:attached_buffers()
local list = {}
for bufnr, _ in pairs(self.buf_query) do
list[#list+1] = bufnr
end
return list
end

M.cfg = "should be set in prosesitter.setup"
M.issues = "should be set in prosesitter.setup"

Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/_extensions/prosesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ return require("telescope").register_extension({
pick_lint(opts, {curr_buf})
end,
all = function(opts)
local buffers = shared.mark_to_meta:buffers()
local buffers = shared:attached_buffers()
pick_lint(opts, buffers)
end,
}
Expand Down

0 comments on commit c822898

Please sign in to comment.