Skip to content

Commit

Permalink
Merge pull request #174 from NotAShelf/nvim-docs-view
Browse files Browse the repository at this point in the history
modules/lsp: add nvim-docs-view
  • Loading branch information
NotAShelf authored Oct 27, 2023
2 parents 30552a9 + 111f6c1 commit 197de16
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 12 deletions.
1 change: 1 addition & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ inputs: let
trouble.enable = true;
lspSignature.enable = true;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal;
};

vim.debugger = {
Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/rl-0.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ https://github.com/notashelf[notashelf]:

* Disabled Lualine LSP status indicator for toggleterm buffer

* Added `nvim-docs-view`, a plugin to display lsp hover documentation in a side panel

https://github.com/jacekpoz[jacekpoz]:

* Fixed scrollOffset not being used
Expand Down
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.

29 changes: 17 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@
flake = false;
};

nvim-docs-view = {
url = "github:amrbashir/nvim-docs-view";
flake = false;
};

# language support
sqls-nvim = {
url = "github:nanotee/sqls.nvim";
flake = false;
Expand Down Expand Up @@ -146,6 +152,17 @@
flake = false;
};

glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;
};

# Tidal cycles
tidalcycles = {
url = "github:mitchmindtree/tidalcycles.nix";
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
};

# Copying/Registers
registers = {
url = "github:tversteeg/registers.nvim";
Expand Down Expand Up @@ -373,18 +390,6 @@
flake = false;
};

# Markdown
glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;
};

# Tidal cycles
tidalcycles = {
url = "github:mitchmindtree/tidalcycles.nix";
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
};

# Minimap
minimap-vim = {
url = "github:wfxr/minimap.vim";
Expand Down
1 change: 1 addition & 0 deletions lib/types/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ with lib; let
"lsp-lines"
"vim-dirtytalk"
"highlight-undo"
"nvim-docs-view"
];
# You can either use the name of the plugin or a package.
pluginType = with types;
Expand Down
1 change: 1 addition & 0 deletions modules/lsp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ _: {
./lightbulb
./lspkind
./lsplines
./nvim-docs-view
];
}
26 changes: 26 additions & 0 deletions modules/lsp/nvim-docs-view/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf nvim;
inherit (builtins) toString;

cfg = config.vim.lsp.nvim-docs-view;
in {
config = mkIf cfg.enable {
vim = {
lsp.enable = true;
startPlugins = ["nvim-docs-view"];

luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere ''
require("docs-view").setup {
position = "${cfg.position}",
width = ${toString cfg.width},
height = ${toString cfg.height},
update_mode = "${cfg.updateMode}",
}
'';
};
};
}
6 changes: 6 additions & 0 deletions modules/lsp/nvim-docs-view/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_: {
imports = [
./config.nix
./nvim-docs-view.nix
];
}
41 changes: 41 additions & 0 deletions modules/lsp/nvim-docs-view/nvim-docs-view.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types;
in {
options.vim.lsp.nvim-docs-view = {
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";

position = mkOption {
type = types.enum ["left" "right" "top" "bottom"];
default = "right";
description = ''
Where to open the docs view panel
'';
};

height = mkOption {
type = types.int;
default = 10;
description = ''
Height of the docs view panel if the position is set to either top or bottom
'';
};

width = mkOption {
type = types.int;
default = 60;
description = ''
Width of the docs view panel if the position is set to either left or right
'';
};

updateMode = mkOption {
type = types.enum ["auto" "manual"];
default = "auto";
description = ''
Determines the mechanism used to update the docs view panel content.
- If auto, the content will update upon cursor move.
- If manual, the content will only update once :DocsViewUpdate is called
'';
};
};
}

0 comments on commit 197de16

Please sign in to comment.