Skip to content

Commit

Permalink
Merge pull request #356 from ckipp01/dapMessage
Browse files Browse the repository at this point in the history
refactor: make message about missing dap clearer
  • Loading branch information
ckipp01 authored Mar 20, 2022
2 parents cda68eb + 9cde6fe commit 3312490
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 3312490

Please sign in to comment.