diff --git a/lua/metals/messages.lua b/lua/metals/messages.lua index bbc984c..8a7e294 100644 --- a/lua/metals/messages.lua +++ b/lua/metals/messages.lua @@ -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 diff --git a/lua/metals/setup.lua b/lua/metals/setup.lua index 598a979..49d6543 100644 --- a/lua/metals/setup.lua +++ b/lua/metals/setup.lua @@ -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 = {} @@ -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