From a08c13dff3abaafc77a247455855769c3b5eff0b Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sun, 9 Feb 2025 21:51:05 +0100 Subject: [PATCH] fix(repl): use termopen if available --- lua/haskell-tools/repl/builtin.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/haskell-tools/repl/builtin.lua b/lua/haskell-tools/repl/builtin.lua index 8a78fb6..fbdbb85 100644 --- a/lua/haskell-tools/repl/builtin.lua +++ b/lua/haskell-tools/repl/builtin.lua @@ -71,8 +71,19 @@ local function buf_create_repl(bufnr, cmd, opts) opts.on_stderr = repl_log(log.warn) opts.on_stdin = repl_log(log.debug) end - opts.term = true log.debug { 'repl.builtin: Opening terminal', cmd, opts } + + -- TODO(0.11): Replace with vim.fn.jobstart(full_command, { term = true }) + -- run the command + ---@diagnostic disable-next-line: deprecated + if type(vim.fn.termopen) == 'function' then + ---@diagnostic disable-next-line: deprecated + vim.fn.termopen(cmd, opts) + else + opts.term = true + vim.fn.jobstart(cmd, opts) + end + local job_id = vim.fn.jobstart(cmd, opts) if not job_id then log.error('repl.builtin: Failed to open a terminal')