Skip to content

Commit

Permalink
feat(health): check for conflicting lspconfig.hls configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Sep 13, 2023
1 parent 87e1275 commit b8eaf4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ body:
required: true
- type: input
attributes:
label: "Output of `haskell-language-server-wrapper --version`"
placeholder: "2.1.0.0 (GHC: 9.2.8)"
label: "Output of `:checkhealth haskell-tools`"
validations:
required: true
- type: textarea
attributes:
label: "How to reproduce the issue"
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Health: Check for conflicting `lspconfig.hls` configuration.

## [2.2.0] - 2023-09-12
### Added
- Automatically add `foldingRange` LSP client capabilities if [`nvim-ufo`](https://github.com/kevinhwang91/nvim-ufo)
Expand Down Expand Up @@ -139,7 +143,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Only show definition/typeDefinition hover actions if they are in different locations.
### Added
- Rockspec for automatic dependency management by LuaRocks-compatible plugin managers.
- LuaRocks tag release worflow.
- LuaRocks tag release workflow.
- `HlsStart`, `HlsStop` and `HlsRestart` commands.
- Dynamically load `haskell-language-server` settings JSON from project root, if available.
- Health checks, runnable with `:checkhealth haskell-tools`.
Expand Down
12 changes: 12 additions & 0 deletions lua/haskell-tools/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ local function check_config()
end
end

local function check_for_conflicts()
start('Checking for conflicting plugins')
for _, autocmd in ipairs(vim.api.nvim_get_autocmds { event = 'FileType', pattern = 'haskell' }) do
if autocmd.group_name and autocmd.group_name == 'lspconfig' then
error('lspconfig.hls has been setup. This will likely lead to conflicts with the haskell-tools LSP client.')
return
end
end
ok('No conflicting plugins detected.')
end

function health.check()
start('Checking for Lua dependencies')
for _, dep in ipairs(lua_dependencies) do
Expand All @@ -241,6 +252,7 @@ function health.check()
check_external_dependency(dep)
end
check_config()
check_for_conflicts()
end

return health

0 comments on commit b8eaf4f

Please sign in to comment.