Skip to content

Commit

Permalink
refactor: make message about missing dap clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
ckipp01 committed Mar 20, 2022
1 parent cda68eb commit 9cde6fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lua/metals/messages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ You have `useGlobalExecutable` set to true, so nvim-metals can't install or
update your Metals executable. If you'd like nvim-metals to handle this for
you, remove the `useGlobalExecutable` setting and try again.]]

M.setup_dap_without_nvim_dap = [[
You can call require("metals").setup_dap() without `nvim-dap` being installed.
Please make sure `mfussenegger/nvim-dap` is installed.]]

return M
4 changes: 2 additions & 2 deletions lua/metals/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local lsp = vim.lsp
local commands_table = require("metals.commands").commands_table
local conf = require("metals.config")
local log = require("metals.log")
local messages = require("metals.messages")
local util = require("metals.util")

local lsps = {}
Expand Down Expand Up @@ -111,13 +112,12 @@ end
local function setup_dap(execute_command)
local status, dap = pcall(require, "dap")
if not status then
log.error_and_show("Unable to find nvim-dap. Please make sure mfussenegger/nvim-dap is installed.")
log.error_and_show(messages.setup_dap_without_nvim_dap)
return
end

dap.adapters.scala = function(callback, config)
local uri = vim.uri_from_bufnr(0)
-- luacheck: ignore
local arguments = {}

if config.name == "from_lens" then
Expand Down

0 comments on commit 9cde6fe

Please sign in to comment.