Skip to content

Commit 1ca0821

Browse files
committed
docs(nvim): add subdir support for lazy.nvim installation
- Add subdir = "editors/nvim" to all lazy.nvim examples in README - Fix tree-sitter parser registration with location field - Add CHANGELOG.md for version tracking - Add RELEASING.md with complete release process documentation - Update lazy.lua bundled spec with subdir option Users can now install from GitHub with: { "MadAppGang/dingo", subdir = "editors/nvim" }
1 parent 86a0e88 commit 1ca0821

5 files changed

Lines changed: 275 additions & 6 deletions

File tree

editors/nvim/CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Changelog
2+
3+
All notable changes to the dingo.nvim plugin will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Nothing yet
12+
13+
## [0.5.1] - 2026-01-06
14+
15+
### Added
16+
- Full LSP integration via `dingo-lsp` with gopls source map translation
17+
- Tree-sitter grammar for Dingo-specific syntax highlighting
18+
- Format on save with `dingo fmt`
19+
- Lint integration with real-time diagnostics
20+
- Build commands: `:DingoBuild`, `:DingoRun`, `:DingoTranspile`
21+
- Health checks via `:checkhealth dingo`
22+
- Mason support for automatic gopls installation
23+
- Bundled lazy.nvim spec (`require("dingo.lazy")`)
24+
- Comprehensive query files: highlights, folds, indents
25+
26+
### Tree-sitter Highlights
27+
- Dingo keywords: `enum`, `match`, `let`
28+
- Special operators: `?` (error propagation), `?.` (safe navigation), `??` (null coalesce)
29+
- Lambda syntax: `|x| expr` and `(x) => expr`
30+
- Enum variants and match patterns
31+
- Full Go syntax support as base
32+
33+
## [0.1.0] - 2024-12-10
34+
35+
### Added
36+
- Initial release
37+
- Basic filetype detection for `.dingo` files
38+
- Tree-sitter grammar foundation
39+
- LSP client configuration
40+
- Format and lint command structure
41+
42+
---
43+
44+
## Version Compatibility
45+
46+
| Plugin Version | Dingo CLI | dingo-lsp | Neovim |
47+
|---------------|-----------|-----------|--------|
48+
| 0.5.x | 0.5.x | 0.5.x | 0.8+ |
49+
| 0.1.x | 0.4.x | 0.4.x | 0.8+ |
50+
51+
[Unreleased]: https://github.com/MadAppGang/dingo/compare/v0.5.1...HEAD
52+
[0.5.1]: https://github.com/MadAppGang/dingo/compare/v0.1.0...v0.5.1
53+
[0.1.0]: https://github.com/MadAppGang/dingo/releases/tag/v0.1.0

editors/nvim/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ Neovim plugin for the [Dingo](https://github.com/MadAppGang/dingo) programming l
2121
```lua
2222
{
2323
"MadAppGang/dingo",
24+
subdir = "editors/nvim", -- Required: plugin is in subdirectory
2425
ft = "dingo",
2526
config = function()
2627
require("dingo").setup()
2728
end,
2829
}
2930
```
3031

32+
> **Note**: The `subdir` option is required because the Neovim plugin lives in `editors/nvim/` within the main Dingo repository.
33+
3134
#### With Mason for Automatic Tool Installation
3235

3336
```lua
@@ -47,6 +50,7 @@ Neovim plugin for the [Dingo](https://github.com/MadAppGang/dingo) programming l
4750
-- Then the Dingo plugin
4851
{
4952
"MadAppGang/dingo",
53+
subdir = "editors/nvim",
5054
ft = "dingo",
5155
dependencies = {
5256
"williamboman/mason.nvim",
@@ -80,6 +84,7 @@ return {
8084
-- Dingo language support
8185
{
8286
"MadAppGang/dingo",
87+
subdir = "editors/nvim",
8388
ft = "dingo",
8489
dependencies = {
8590
"williamboman/mason.nvim",
@@ -128,7 +133,11 @@ The plugin includes a ready-to-use lazy.nvim spec with full configuration:
128133
```lua
129134
-- In your lazy.nvim setup (init.lua or lua/config/lazy.lua)
130135
require("lazy").setup({
131-
{ import = "dingo.lazy" }, -- Full spec with keybindings and Mason
136+
{
137+
"MadAppGang/dingo",
138+
subdir = "editors/nvim",
139+
import = "dingo.lazy", -- Import full spec with keybindings and Mason
140+
},
132141
-- your other plugins...
133142
})
134143
```
@@ -148,6 +157,7 @@ If you're using [LazyVim](https://www.lazyvim.org/), add this to your plugins:
148157
return {
149158
{
150159
"MadAppGang/dingo",
160+
subdir = "editors/nvim",
151161
ft = "dingo",
152162
opts = {
153163
lsp = { enabled = true },
@@ -177,6 +187,7 @@ return {
177187
```lua
178188
use {
179189
"MadAppGang/dingo",
190+
rtp = "editors/nvim", -- Required: plugin is in subdirectory
180191
ft = "dingo",
181192
requires = {
182193
"williamboman/mason.nvim",
@@ -190,10 +201,12 @@ use {
190201

191202
### Using vim-plug
192203

204+
vim-plug doesn't support subdirectory plugins well. Use the `rtp` option:
205+
193206
```vim
194207
Plug 'williamboman/mason.nvim'
195208
Plug 'williamboman/mason-lspconfig.nvim'
196-
Plug 'MadAppGang/dingo', { 'for': 'dingo' }
209+
Plug 'MadAppGang/dingo', { 'for': 'dingo', 'rtp': 'editors/nvim' }
197210
198211
lua << EOF
199212
require("mason").setup()
@@ -204,6 +217,8 @@ require("dingo").setup()
204217
EOF
205218
```
206219

220+
> **Note**: If `rtp` doesn't work, consider using lazy.nvim which has better subdirectory support.
221+
207222
### Local Development Installation
208223

209224
For contributing or testing local changes:

editors/nvim/RELEASING.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Releasing dingo.nvim
2+
3+
This document describes how to release new versions of the Neovim plugin.
4+
5+
## Distribution Model
6+
7+
The dingo.nvim plugin is distributed as part of the main Dingo repository at `editors/nvim/`. Users can install it in two ways:
8+
9+
### 1. From GitHub (Recommended for Users)
10+
11+
```lua
12+
-- lazy.nvim with subdir
13+
{
14+
"MadAppGang/dingo",
15+
subdir = "editors/nvim",
16+
ft = "dingo",
17+
config = function()
18+
require("dingo").setup()
19+
end,
20+
}
21+
```
22+
23+
### 2. Local Development
24+
25+
```lua
26+
-- For contributors/testing
27+
{
28+
dir = "~/path/to/dingo/editors/nvim",
29+
ft = "dingo",
30+
config = function()
31+
require("dingo").setup()
32+
end,
33+
}
34+
```
35+
36+
## Release Checklist
37+
38+
### Before Release
39+
40+
1. **Update version** in `pkg/version/version.go`:
41+
```go
42+
const Version = "0.X.Y"
43+
```
44+
45+
2. **Update CHANGELOG.md**:
46+
- Move items from `[Unreleased]` to new version section
47+
- Add release date
48+
- Update comparison links at bottom
49+
50+
3. **Test the plugin**:
51+
```bash
52+
# Test tree-sitter grammar
53+
cd editors/nvim/tree-sitter-dingo
54+
npm install
55+
npm test
56+
57+
# Test in Neovim
58+
nvim --clean -u test_init.lua some_file.dingo
59+
```
60+
61+
4. **Verify health checks**:
62+
```vim
63+
:checkhealth dingo
64+
```
65+
66+
5. **Rebuild tree-sitter parser** (if grammar changed):
67+
```bash
68+
cd editors/nvim/tree-sitter-dingo
69+
npm run build
70+
```
71+
72+
### Release Steps
73+
74+
1. **Commit all changes**:
75+
```bash
76+
git add .
77+
git commit -m "chore(nvim): prepare release v0.X.Y"
78+
```
79+
80+
2. **Create and push tag**:
81+
```bash
82+
git tag v0.X.Y
83+
git push origin main
84+
git push origin v0.X.Y
85+
```
86+
87+
3. **Create GitHub Release** (optional but recommended):
88+
- Go to https://github.com/MadAppGang/dingo/releases
89+
- Click "Draft a new release"
90+
- Select the tag
91+
- Copy relevant CHANGELOG section to release notes
92+
- Publish
93+
94+
### Post-Release
95+
96+
1. **Verify installation works**:
97+
```lua
98+
-- Test with fresh install
99+
{ "MadAppGang/dingo", subdir = "editors/nvim", tag = "v0.X.Y" }
100+
```
101+
102+
2. **Update CHANGELOG.md** with `[Unreleased]` section for next cycle
103+
104+
## Tree-sitter Parser Updates
105+
106+
If the grammar changes:
107+
108+
1. **Regenerate parser**:
109+
```bash
110+
cd editors/nvim/tree-sitter-dingo
111+
npm install
112+
npx tree-sitter generate
113+
npm run build
114+
```
115+
116+
2. **Test parsing**:
117+
```bash
118+
npx tree-sitter parse ../../examples/01_error_propagation/http_handler.dingo
119+
```
120+
121+
3. **Rebuild .so file**:
122+
```bash
123+
# The .so is needed for local testing
124+
cc -shared -o dingo.so -fPIC src/parser.c -I src
125+
```
126+
127+
4. **Commit generated files**:
128+
```bash
129+
git add src/parser.c src/tree_sitter/parser.h dingo.so
130+
git commit -m "chore(tree-sitter): regenerate parser"
131+
```
132+
133+
## nvim-treesitter Registry (Future)
134+
135+
To get `dingo` into the official nvim-treesitter registry:
136+
137+
1. **Ensure grammar is stable** and well-tested
138+
139+
2. **Create PR to nvim-treesitter**:
140+
- Fork https://github.com/nvim-treesitter/nvim-treesitter
141+
- Add dingo to `lua/nvim-treesitter/parsers.lua`
142+
- Add query files to `queries/dingo/`
143+
- Submit PR
144+
145+
3. **Parser config format**:
146+
```lua
147+
dingo = {
148+
install_info = {
149+
url = "https://github.com/MadAppGang/dingo",
150+
location = "editors/nvim/tree-sitter-dingo",
151+
files = { "src/parser.c" },
152+
branch = "main",
153+
},
154+
filetype = "dingo",
155+
maintainers = { "@YourGitHubUsername" },
156+
}
157+
```
158+
159+
4. **Required queries** (copy from `editors/nvim/queries/dingo/`):
160+
- `highlights.scm` - Syntax highlighting
161+
- `folds.scm` - Code folding
162+
- `indents.scm` - Auto-indentation
163+
164+
## Version Numbering
165+
166+
Follow semver aligned with Dingo CLI:
167+
168+
- **MAJOR**: Breaking changes to plugin API or config
169+
- **MINOR**: New features (commands, LSP capabilities)
170+
- **PATCH**: Bug fixes, query improvements
171+
172+
The nvim plugin version matches Dingo CLI version for simplicity.
173+
174+
## Testing Configurations
175+
176+
### Minimal test config (`test_init.lua`)
177+
178+
```lua
179+
vim.opt.rtp:prepend("~/path/to/dingo/editors/nvim")
180+
181+
require("dingo").setup({
182+
lsp = { enabled = true, log_level = "debug" },
183+
format = { on_save = true },
184+
lint = { on_save = true },
185+
})
186+
```
187+
188+
### Test with:
189+
```bash
190+
nvim --clean -u test_init.lua examples/01_error_propagation/http_handler.dingo
191+
```

editors/nvim/lua/dingo/lazy.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
-- lazy.nvim plugin spec for dingo.nvim
2-
-- This file can be used directly as a lazy.nvim plugin spec
2+
-- This file provides the complete plugin specification for lazy.nvim
33
--
44
-- Usage in your lazy.nvim config:
55
-- require("lazy").setup({
6-
-- { import = "dingo.lazy" },
6+
-- {
7+
-- "MadAppGang/dingo",
8+
-- subdir = "editors/nvim",
9+
-- import = "dingo.lazy", -- Import this spec for keybindings and integration
10+
-- },
711
-- -- your other plugins...
812
-- })
913

1014
return {
11-
-- Dingo language support
15+
-- Main Dingo plugin configuration
16+
-- Note: The plugin itself should be specified with subdir in user config
1217
{
1318
"MadAppGang/dingo",
19+
subdir = "editors/nvim",
1420
name = "dingo.nvim",
1521
ft = "dingo",
1622
dependencies = {

editors/nvim/lua/dingo/treesitter.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ function M.register()
1212
parser_config.dingo = {
1313
install_info = {
1414
url = "https://github.com/MadAppGang/dingo",
15-
files = { "editors/nvim/tree-sitter-dingo/src/parser.c" },
15+
location = "editors/nvim/tree-sitter-dingo",
16+
files = { "src/parser.c" },
1617
branch = "main",
1718
generate_requires_npm = true,
1819
},
1920
filetype = "dingo",
2021
maintainers = { "@MadAppGang" },
2122
}
2223

24+
-- Register language mapping (parser name -> filetype)
25+
vim.treesitter.language.register("dingo", "dingo")
26+
2327
-- For local development, use:
2428
-- :TSInstallFromGrammar dingo
2529

0 commit comments

Comments
 (0)