Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp/otter: init #385

Merged
merged 21 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 18 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
3 changes: 2 additions & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ isMaximal: {
lspsaga.enable = false;
trouble.enable = true;
lspSignature.enable = true;
otter.enable = isMaximal;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal;
};
Expand Down Expand Up @@ -155,7 +156,7 @@ isMaximal: {
};

utility = {
ccc.enable = isMaximal;
ccc.enable = false;
vim-wakatime.enable = false;
icon-picker.enable = isMaximal;
surround.enable = isMaximal;
Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/rl-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,5 @@ everyone.
[Soliprem](https://github.com/Soliprem)

- Add LSP and Treesitter support for R under `vim.languages.R`.
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
ccc
17 changes: 17 additions & 0 deletions flake.lock

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

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
flake = false;
};

plugin-otter-nvim = {
url = "github:jmbuhr/otter.nvim";
flake = false;
};

# Language support
plugin-sqls-nvim = {
url = "github:nanotee/sqls.nvim";
Expand Down
2 changes: 1 addition & 1 deletion modules/plugins/languages/ts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ in {
{
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
message = ''
As of a recent lspconfig update, he `tsserver` configuration has been renamed
As of a recent lspconfig update, the `tsserver` configuration has been renamed
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
to `"ts_ls"` instead of to `${cfg.lsp.server}`
Expand Down
1 change: 1 addition & 0 deletions modules/plugins/lsp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
./trouble
./lsp-signature
./lightbulb
./otter
./lspkind
./lsplines
./nvim-docs-view
Expand Down
38 changes: 38 additions & 0 deletions modules/plugins/lsp/otter/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;

cfg = config.vim.lsp;

self = import ./otter.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.otter.mappings;
mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.otter.enable) {
assertions = [
{
assertion = !config.vim.utility.ccc.enable;
message = ''
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
'';
}
];
vim = {
startPlugins = ["otter-nvim"];

maps.normal = mkMerge [
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
];

pluginRC.otter = entryAnywhere ''
-- Enable otter diagnostics viewer
require("otter").setup()
Soliprem marked this conversation as resolved.
Show resolved Hide resolved
'';
};
};
}
6 changes: 6 additions & 0 deletions modules/plugins/lsp/otter/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
imports = [
./otter.nix
./config.nix
];
}
13 changes: 13 additions & 0 deletions modules/plugins/lsp/otter/otter.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.lsp = {
otter = {
Soliprem marked this conversation as resolved.
Show resolved Hide resolved
enable = mkEnableOption "Otter LSP Injector";
Soliprem marked this conversation as resolved.
Show resolved Hide resolved
mappings = {
toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "<leader>lo";
};
};
};
}