diff options
| author | William Boman <william@redwill.se> | 2023-04-18 01:05:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 01:05:09 +0200 |
| commit | 7034065099c1665143091c7282b3b1b8f0b23783 (patch) | |
| tree | 7769b0637506273d8e83594ce167e289ba56b67c /tests | |
| parent | feat: notify if mason has not been set up (#195) (diff) | |
| download | mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar.gz mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar.bz2 mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar.lz mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar.xz mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.tar.zst mason-lspconfig-7034065099c1665143091c7282b3b1b8f0b23783.zip | |
refactor: only notify bad setup order if it impacts functionality (#196)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-lspconfig/setup_spec.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/mason-lspconfig/setup_spec.lua b/tests/mason-lspconfig/setup_spec.lua index eb5e1c0..e9ebf40 100644 --- a/tests/mason-lspconfig/setup_spec.lua +++ b/tests/mason-lspconfig/setup_spec.lua @@ -328,4 +328,41 @@ describe("mason-lspconfig setup_handlers", function() ) end) ) + + it("should notify if mason.nvim has not been set up and using ensure_installed feature", function() + package.loaded["mason"] = nil + spy.on(vim, "notify") + + mason_lspconfig.setup { ensure_installed = { "dummylsp" } } + assert.spy(vim.notify).was_called(1) + assert.spy(vim.notify).was_called_with( + [[mason.nvim has not been set up. Make sure to set up 'mason' before 'mason-lspconfig'. :h mason-lspconfig-quickstart]], + vim.log.levels.WARN, + { title = "mason-lspconfig.nvim" } + ) + end) + + it("should not notify if mason.nvim has not been set up and not using ensure_installed feature", function() + package.loaded["mason"] = nil + spy.on(vim, "notify") + + mason_lspconfig.setup() + assert.spy(vim.notify).was_called(0) + end) + + it("should notify is server is set up before mason.nvim", function() + package.loaded["mason"] = nil + local lspconfig = require "lspconfig" + spy.on(vim, "notify") + + mason_lspconfig.setup() + lspconfig.dummylsp.setup {} + + assert.spy(vim.notify).was_called(1) + assert.spy(vim.notify).was_called_with( + [[Server "dummylsp" is being set up before mason.nvim is set up. :h mason-lspconfig-quickstart]], + vim.log.levels.WARN, + { title = "mason-lspconfig.nvim" } + ) + end) end) |
