Skip to content

Commit cbc4dda

Browse files
committed
Initial commit
0 parents  commit cbc4dda

File tree

4 files changed

+286
-0
lines changed

4 files changed

+286
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Arizona Framework Neovim Plugin
2+
3+
Language support for Arizona Framework template files (`.herl`).
4+
5+
## What it provides
6+
7+
- **Filetype detection**: `.herl` files automatically recognized as `arizona` filetype
8+
- **Syntax highlighting**: Tree-sitter parser for Arizona template syntax
9+
- **Language injection**: HTML and Erlang completion within template files
10+
11+
## Installation
12+
13+
### Using lazy.nvim
14+
15+
```lua
16+
{
17+
'arizona-framework/arizona.nvim',
18+
dependencies = {
19+
'nvim-treesitter/nvim-treesitter',
20+
'jmbuhr/otter.nvim', -- Optional: for HTML/Erlang completion
21+
},
22+
}
23+
```
24+
25+
### Using packer.nvim
26+
27+
```lua
28+
use {
29+
'arizona-framework/arizona.nvim',
30+
requires = {
31+
'nvim-treesitter/nvim-treesitter',
32+
'jmbuhr/otter.nvim', -- Optional
33+
},
34+
}
35+
```
36+
37+
## Setup
38+
39+
**No configuration needed!** The plugin auto-activates when installed.
40+
41+
## Getting full functionality
42+
43+
1. **Install the tree-sitter parser** (for syntax highlighting):
44+
```
45+
:TSInstall arizona
46+
```
47+
48+
2. **Install otter.nvim** (for HTML/Erlang completion in template files):
49+
```
50+
Already listed as dependency above
51+
```
52+
53+
3. **Check everything is working**:
54+
```
55+
:checkhealth arizona
56+
```
57+
58+
## Requirements
59+
60+
- Neovim 0.8+
61+
- nvim-treesitter (required dependency)
62+
- otter.nvim (optional, for language injection)
63+
64+
## LSP Setup
65+
66+
Configure your Erlang LSP separately. Example:
67+
68+
```lua
69+
require('lspconfig').elp.setup({
70+
-- Your ELP configuration
71+
})
72+
```
73+
74+
## Troubleshooting
75+
76+
Run `:checkhealth arizona` to see what's working and what needs setup.
77+
78+
## License
79+
80+
Apache-2.0

doc/arizona.txt

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
*arizona.txt* Arizona Framework Language Support for Neovim
2+
3+
ARIZONA FRAMEWORK PLUGIN
4+
For Neovim 0.8+
5+
6+
==============================================================================
7+
CONTENTS *arizona-contents*
8+
9+
1. Introduction |arizona-introduction|
10+
2. Installation |arizona-installation|
11+
3. Features |arizona-features|
12+
4. Setup |arizona-setup|
13+
5. Health Check |arizona-health-check|
14+
6. Troubleshooting |arizona-troubleshooting|
15+
16+
==============================================================================
17+
1. INTRODUCTION *arizona-introduction*
18+
19+
Arizona Framework is a template engine for Erlang that allows embedding
20+
Erlang code within HTML templates using {dynamic} syntax. This plugin
21+
provides Neovim language support for .herl Arizona template files.
22+
23+
Features provided:
24+
• Automatic filetype detection for .herl files
25+
• Tree-sitter parser integration for syntax highlighting
26+
• Language injection for HTML and Erlang code completion
27+
28+
==============================================================================
29+
2. INSTALLATION *arizona-installation*
30+
31+
Using lazy.nvim:
32+
>
33+
{
34+
'arizona-framework/arizona.nvim',
35+
dependencies = {
36+
'nvim-treesitter/nvim-treesitter',
37+
'jmbuhr/otter.nvim', -- Optional
38+
},
39+
}
40+
<
41+
42+
Using packer.nvim:
43+
>
44+
use {
45+
'arizona-framework/arizona.nvim',
46+
requires = {
47+
'nvim-treesitter/nvim-treesitter',
48+
'jmbuhr/otter.nvim', -- Optional
49+
},
50+
}
51+
<
52+
53+
==============================================================================
54+
3. FEATURES *arizona-features*
55+
56+
Filetype Detection *arizona-filetype*
57+
.herl files are automatically detected as 'arizona' filetype
58+
59+
Syntax Highlighting *arizona-syntax*
60+
Tree-sitter parser provides rich syntax highlighting for:
61+
• HTML tags and attributes
62+
• Erlang code within {dynamic} blocks
63+
• Arizona template structure
64+
65+
Language Injection *arizona-injection*
66+
With otter.nvim, enables:
67+
• HTML completion for static content
68+
• Erlang completion for dynamic blocks
69+
• Cross-language navigation
70+
71+
==============================================================================
72+
4. SETUP *arizona-setup*
73+
74+
No configuration required! The plugin auto-activates when installed.
75+
76+
For full functionality:
77+
1. Install tree-sitter parser: :TSInstall arizona
78+
2. Install otter.nvim (optional, for language injection)
79+
3. Configure your Erlang LSP server separately
80+
81+
==============================================================================
82+
5. HEALTH CHECK *arizona-health-check*
83+
84+
Run health check:
85+
>
86+
:checkhealth arizona
87+
<
88+
89+
Shows status of:
90+
• Filetype detection
91+
• Tree-sitter parser configuration
92+
• Language injection availability
93+
• Current buffer information
94+
95+
==============================================================================
96+
6. TROUBLESHOOTING *arizona-troubleshooting*
97+
98+
Q: Syntax highlighting not working?
99+
A: Install the parser: :TSInstall arizona
100+
101+
Q: No code completion in dynamic blocks?
102+
A: Install otter.nvim for language injection support
103+
104+
Q: How to check what's working?
105+
A: Run :checkhealth arizona for detailed status
106+
107+
==============================================================================
108+
vim:tw=78:ts=8:ft=help:norl:

lua/arizona/health.lua

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
-- Arizona Framework Health Check
2+
3+
local M = {}
4+
5+
function M.check()
6+
local health = vim.health
7+
8+
health.start("Arizona Framework")
9+
10+
-- Core feature: Filetype detection (always works)
11+
if vim.filetype.match({ filename = "test.herl" }) == "arizona" then
12+
health.ok("Filetype detection working (.herl → arizona)")
13+
else
14+
health.error("Filetype detection broken")
15+
end
16+
17+
-- Feature: Tree-sitter parser
18+
local ts_ok, parsers = pcall(require, "nvim-treesitter.parsers")
19+
if ts_ok then
20+
if parsers.get_parser_configs().arizona then
21+
health.ok("Tree-sitter parser configured")
22+
else
23+
health.error("Tree-sitter parser not configured")
24+
end
25+
else
26+
health.warn("nvim-treesitter not available")
27+
end
28+
29+
-- Feature: Language injection
30+
if pcall(require, "otter") then
31+
health.ok("Language injection available (otter.nvim found)")
32+
else
33+
health.warn("Language injection unavailable (install otter.nvim)")
34+
end
35+
36+
-- Current buffer status
37+
local current_ft = vim.bo.filetype
38+
if current_ft == "arizona" then
39+
health.start("Current Buffer")
40+
health.ok("Current buffer is Arizona template file")
41+
end
42+
end
43+
44+
return M
45+

plugin/arizona.lua

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
-- Arizona Framework Neovim Plugin
2+
-- Auto-activating language support for .herl template files
3+
4+
-- Prevent double loading
5+
if vim.g.arizona_loaded then
6+
return
7+
end
8+
vim.g.arizona_loaded = 1
9+
10+
-- Core feature: Filetype detection
11+
vim.filetype.add({
12+
extension = { herl = "arizona" },
13+
})
14+
15+
-- Feature: Tree-sitter parser registration
16+
local function setup_treesitter()
17+
local ok, parser_config = pcall(require, "nvim-treesitter.parsers")
18+
if not ok then
19+
return
20+
end
21+
22+
local parsers = parser_config.get_parser_configs()
23+
parsers.arizona = {
24+
install_info = {
25+
url = "https://github.com/arizona-framework/tree-sitter-arizona",
26+
files = { "src/parser.c" },
27+
branch = "main",
28+
},
29+
filetype = "arizona",
30+
}
31+
end
32+
33+
-- Feature: Language injection via otter.nvim
34+
local function setup_language_injection()
35+
local ok, otter = pcall(require, "otter")
36+
if not ok then
37+
return
38+
end
39+
40+
-- Auto-activate on Arizona files
41+
vim.api.nvim_create_autocmd("FileType", {
42+
pattern = "arizona",
43+
group = vim.api.nvim_create_augroup("ArizonaLanguageInjection", { clear = true }),
44+
callback = function()
45+
otter.activate({ "html", "erlang" }, true)
46+
end,
47+
})
48+
end
49+
50+
-- Auto-setup all features
51+
setup_treesitter()
52+
setup_language_injection()
53+

0 commit comments

Comments
 (0)