Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.4.3] - 2022-12-06
### Fixed
- Error message shown if hoogle is installed, but telescope is missing

## [1.4.2] - 2022-11-19
### Fixed
- Bug causing hls to always use default settings
Expand Down
94 changes: 75 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@
in
{
formatting = pre-commit-check-for system;
inherit (checkPkgs) haskell-tools-test;
inherit (checkPkgs)
haskell-tools-test
haskell-tools-test-no-telescope
haskell-tools-test-no-telescope-with-hoogle;
});
};
}
2 changes: 1 addition & 1 deletion lua/haskell-tools/deps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function M.require_or_err(modname, plugin_name)
return M.if_available(modname, function(mod)
return mod
end, function()
error('haskell-tools: This plugin requires the ' .. plugin_name .. ' plugin.')
vim.notify_once('haskell-tools: This plugin requires the ' .. plugin_name .. ' plugin.', vim.log.levels.ERROR)
end)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/haskell-tools/hoogle/local.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ local function setup_telescope_search()
end

function M.setup()
if M.has_hoogle() then
if M.has_hoogle() and deps.has_telescope() then
setup_telescope_search()
end
end
Expand Down
12 changes: 9 additions & 3 deletions nix/test-overlay.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{ packer-nvim, plenary-nvim, nvim-lspconfig, telescope-nvim }:
final: prev:
with final.lib;
with final.lib.strings;
with final.stdenv;

let
mkPlenaryTest = { nvim ? final.neovim, name }: mkDerivation {
mkPlenaryTest = { name, nvim ? final.neovim, withTelescope ? true, extraPkgs ? [ ] }: mkDerivation {
inherit name;

phases = [
Expand All @@ -17,22 +18,23 @@ let
buildInputs = with final; [
nvim
makeWrapper
];
] ++ extraPkgs;

buildPhase = ''
mkdir -p $out
mkdir -p $out/.config/nvim/site/pack/packer/start
ln -s ${packer-nvim} $out/.config/nvim/site/pack/packer/start/packer.nvim
ln -s ${plenary-nvim} $out/.config/nvim/site/pack/packer/start/plenary.nvim
ln -s ${nvim-lspconfig} $out/.config/nvim/site/pack/packer/start/nvim-lspconfig
ln -s ${telescope-nvim} $out/.config/nvim/site/pack/packer/start/telescope.nvim
${optionalString withTelescope "ln -s ${telescope-nvim} $out/.config/nvim/site/pack/packer/start/telescope.nvim"}
ln -s ${./..} $out/.config/nvim/site/pack/packer/start/${name}
'';

checkPhase = ''
export NVIM_DATA_MINIMAL=$(realpath $out/.config/nvim)
export HOME=$(realpath .)
cd ${./..}
# TODO: split test directories by environment
nvim --headless --noplugin -u ${../tests/minimal.lua} -c "PlenaryBustedDirectory tests {minimal_init = '${../tests/minimal.lua}'}"
'';
};
Expand All @@ -42,4 +44,8 @@ in

haskell-tools-test = mkPlenaryTest { name = "haskell-tools.nvim"; };

haskell-tools-test-no-telescope = mkPlenaryTest { name = "haskell-tools.nvim"; withTelescope = false; };

haskell-tools-test-no-telescope-with-hoogle = mkPlenaryTest { name = "haskell-tools.nvim"; withTelescope = false; extraPkgs = [ final.pkgs.haskellPackages.hoogle ]; };

}
1 change: 0 additions & 1 deletion tests/minimal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ packer.startup(function(use)
requires = {
'neovim/nvim-lspconfig',
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
},
config = function()
-- Paste setup here
Expand Down
7 changes: 7 additions & 0 deletions tests/setup_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
local ht = require('haskell-tools')
local stub = require('luassert.stub')
describe('Can call setup with default configs.', function()
local notify_once = stub(vim, 'notify_once')
local notify = stub(vim, 'notify')
ht.setup()
it('Public API is available after setup.', function()
assert(ht.config ~= nil)
Expand All @@ -9,4 +12,8 @@ describe('Can call setup with default configs.', function()
assert(ht.project ~= nil)
assert(ht.tags ~= nil)
end)
it('No notifications at startup.', function()
assert.stub(notify_once).was_not_called()
assert.stub(notify).was_not_called()
end)
end)