Ability to manually configure LSP for Haskell

Allow users who have HLS installed using `ghcup` to manually provide the path for the Haskell language server
This commit is contained in:
Pseudomata 2024-01-26 19:02:31 -05:00
parent faf7798577
commit 652ec6fb3e
No known key found for this signature in database
3 changed files with 89 additions and 112 deletions

View file

@ -7,7 +7,7 @@ use settings::Settings;
use std::{borrow::Cow, str, sync::Arc};
use util::{asset_str, paths::PLUGINS_DIR};
use self::{deno::DenoSettings, elixir::ElixirSettings};
use self::{deno::DenoSettings, elixir::ElixirSettings, haskell::HaskellSettings};
mod c;
mod css;
@ -55,6 +55,7 @@ pub fn init(
) {
ElixirSettings::register(cx);
DenoSettings::register(cx);
HaskellSettings::register(cx);
let language = |name, grammar, adapters| {
languages.register(name, load_config(name), grammar, adapters, load_queries)
@ -202,11 +203,21 @@ pub fn init(
);
}
}
language(
"haskell",
tree_sitter_haskell::language(),
vec![Arc::new(haskell::HaskellLspAdapter)],
);
match &HaskellSettings::get(None, cx).lsp {
haskell::HaskellLspSetting::None => {
language("haskell", tree_sitter_haskell::language(), vec![])
}
haskell::HaskellLspSetting::Local { path, arguments } => language(
"haskell",
tree_sitter_haskell::language(),
vec![Arc::new(haskell::LocalLspAdapter {
path: path.clone(),
arguments: arguments.clone(),
})],
),
}
language(
"html",
tree_sitter_html::language(),