|
1 | | -# Neovim Setup Guide for Allium |
| 1 | +# Neovim |
2 | 2 |
|
3 | | -This guide explains how to set up Allium language support in Neovim using `allium-lsp` and `nvim-allium`. |
| 3 | +The Neovim plugin has moved to its own repository: [juxt/nvim-allium](https://github.com/juxt/nvim-allium). |
4 | 4 |
|
5 | | -## Prerequisites |
6 | | - |
7 | | -- **Neovim** >= 0.9.0 |
8 | | -- **lazy.nvim** (recommended plugin manager) |
9 | | -- **nvim-lspconfig** (LSP client configuration) |
10 | | -- **nvim-treesitter** (Syntax highlighting) |
11 | | - |
12 | | -## 1. Install Allium LSP Server |
13 | | - |
14 | | -The LSP server must be available in your system path as `allium-lsp`. |
15 | | - |
16 | | -### From Release Artifacts |
17 | | - |
18 | | -1. Download the `allium-lsp-<version>.tar.gz` for your platform from [GitHub Releases](https://github.com/juxt/allium-tools/releases). |
19 | | -2. Extract the archive and move the `allium-lsp` binary to a directory in your `$PATH` (e.g., `/usr/local/bin`). |
20 | | - |
21 | | -### From Source |
22 | | - |
23 | | -If you have the repository cloned: |
24 | | - |
25 | | -```bash |
26 | | -cd packages/allium-lsp |
27 | | -npm install |
28 | | -npm run build |
29 | | -# The binary is in dist/bin.js. You can link it: |
30 | | -ln -s $(pwd)/dist/bin.js /usr/local/bin/allium-lsp |
31 | | -``` |
32 | | - |
33 | | -## 2. Install nvim-allium Plugin |
34 | | - |
35 | | -Add `nvim-allium` to your Neovim configuration. Below is an example using `lazy.nvim`: |
36 | | - |
37 | | -```lua |
38 | | --- Example init.lua configuration |
39 | | -require("lazy").setup({ |
40 | | - { |
41 | | - "juxt/allium-tools", |
42 | | - -- Note: During pre-release, you may need to point to the specific subdirectory |
43 | | - -- or install from a local checkout. |
44 | | - config = function() |
45 | | - require("allium").setup({ |
46 | | - -- Custom LSP options |
47 | | - lsp = { |
48 | | - cmd = { "allium-lsp", "--stdio" }, |
49 | | - } |
50 | | - }) |
51 | | - end, |
52 | | - dependencies = { |
53 | | - "neovim/nvim-lspconfig", |
54 | | - "nvim-treesitter/nvim-treesitter", |
55 | | - }, |
56 | | - } |
57 | | -}) |
58 | | -``` |
59 | | - |
60 | | -## 3. Install Tree-sitter Parser |
61 | | - |
62 | | -`nvim-allium` handles the registration of the Allium parser with `nvim-treesitter`. After installing the plugin, you can install the parser by running: |
63 | | - |
64 | | -```vim |
65 | | -:TSInstall allium |
66 | | -``` |
67 | | - |
68 | | -Ensure that you have enabled `highlight` in your `nvim-treesitter` configuration: |
69 | | - |
70 | | -```lua |
71 | | -require('nvim-treesitter.configs').setup { |
72 | | - highlight = { |
73 | | - enable = true, |
74 | | - }, |
75 | | -} |
76 | | -``` |
77 | | - |
78 | | -## 4. Verify Setup |
79 | | - |
80 | | -Run the following command in Neovim to check the health of the Allium integration: |
81 | | - |
82 | | -```vim |
83 | | -:checkhealth allium |
84 | | -``` |
85 | | - |
86 | | -This will verify that the `allium-lsp` binary is found and that the Tree-sitter parser is correctly installed. |
87 | | - |
88 | | -## Quick Isolated Demo |
89 | | - |
90 | | -From the monorepo root, you can launch a repo-local Neovim demo session that |
91 | | -does not use your normal Neovim config/state: |
92 | | - |
93 | | -```bash |
94 | | -npm run demo:nvim-allium |
95 | | -``` |
96 | | - |
97 | | -Tree-sitter variant: |
98 | | - |
99 | | -```bash |
100 | | -npm run demo:nvim-allium:ts |
101 | | -``` |
102 | | - |
103 | | -The demo stores runtime data in `.nvim-demo/`. |
104 | | - |
105 | | -## Plugin Tests |
106 | | - |
107 | | -Run repo-local Neovim plugin tests in headless mode: |
108 | | - |
109 | | -```bash |
110 | | -npm run test:nvim |
111 | | -``` |
112 | | - |
113 | | -The test suite uses `nvim -u NONE` and stubs external dependencies for fast, deterministic checks. |
114 | | - |
115 | | -Install repo-local integration test dependencies once: |
116 | | - |
117 | | -```bash |
118 | | -npm run test:nvim:install |
119 | | -``` |
120 | | - |
121 | | -Run integration tests with real `nvim-lspconfig`, real `nvim-treesitter`, and real `allium-lsp`: |
122 | | - |
123 | | -```bash |
124 | | -npm run test:nvim:integration |
125 | | -``` |
126 | | - |
127 | | -## Feature Reference |
128 | | - |
129 | | -| Feature | Description | Standard Keymap | |
130 | | -| :--- | :--- | :--- | |
131 | | -| **Hover** | Show documentation for symbol | `K` | |
132 | | -| **Go to Definition** | Jump to declaration | `gd` | |
133 | | -| **Find References** | List all usages | `gr` | |
134 | | -| **Rename** | Rename symbol across files | `<leader>rn` | |
135 | | -| **Code Actions** | Apply quick fixes / refactors | `<leader>ca` | |
136 | | -| **Formatting** | Format current buffer | `<leader>f` | |
137 | | -| **Diagnostics** | Show inline errors and warnings | `[d` / `]d` | |
138 | | - |
139 | | -## What Is Available Today |
140 | | - |
141 | | -`nvim-allium` currently provides: |
142 | | - |
143 | | -- Filetype + LSP client wiring for `allium` buffers. |
144 | | -- Default LSP keymaps on attach. |
145 | | -- Tree-sitter parser registration for `allium` (local grammar path in this repo). |
146 | | -- Health checks via `:checkhealth allium`. |
147 | | - |
148 | | -To access functionality in a buffer: |
149 | | - |
150 | | -1. Open an `.allium` file. |
151 | | -2. Confirm filetype: `:set filetype?` should show `filetype=allium`. |
152 | | -3. Confirm LSP attached: `:LspInfo`. |
153 | | -4. Use default keymaps or standard LSP commands: |
154 | | - - Hover: `K` or `:lua vim.lsp.buf.hover()` |
155 | | - - Definition: `gd` or `:lua vim.lsp.buf.definition()` |
156 | | - - References: `gr` or `:lua vim.lsp.buf.references()` |
157 | | - - Rename: `<leader>rn` or `:lua vim.lsp.buf.rename()` |
158 | | - - Code actions: `<leader>ca` or `:lua vim.lsp.buf.code_action()` |
159 | | - - Format: `<leader>f` or `:lua vim.lsp.buf.format({ async = true })` |
160 | | - - Diagnostics nav: `[d` / `]d`, list via `<leader>q` |
161 | | - |
162 | | -There are no extra user commands defined by `nvim-allium` at the moment; functionality is exposed through built-in Neovim LSP and diagnostic APIs plus configured keymaps. |
163 | | - |
164 | | -## Troubleshooting |
165 | | - |
166 | | -- **LSP not starting**: Ensure `allium-lsp` is in your `$PATH`. You can test this by running `allium-lsp --version` in your terminal. |
167 | | -- **No syntax highlighting**: Ensure `nvim-treesitter` is installed and you've run `:TSInstall allium`. Check that the filetype is correctly detected as `allium` with `:set filetype?`. |
168 | | -- **Logs**: Check LSP logs with `:LspLog` for detailed error messages from the server. |
| 5 | +It provides LSP client configuration, tree-sitter syntax highlighting, diagnostics and standard LSP keymaps. Supports native LSP on Neovim 0.11+ and lspconfig on 0.9+. |
0 commit comments