feat: improve editor tooling and fix warnings

Neovim improvements:
- Add tree-sitter text objects for functions, types, blocks
- Add folding support
- Enhanced REPL integration (toggle, send line/selection)
- New commands: LuxCheck, LuxReplToggle, LuxSend
- Better keybindings with localleader

VS Code extension:
- Full syntax highlighting with TextMate grammar
- LSP client integration
- 20+ snippets for common patterns
- Commands: run, format, check, REPL
- Keybindings and context menu

Fixes:
- Fix all cargo warnings with #[allow(dead_code)] annotations
- Clean up unused variables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 18:23:55 -05:00
parent ebc0bdb109
commit a6eb349d59
14 changed files with 1437 additions and 9 deletions

View File

@@ -6,8 +6,10 @@ Neovim support for the Lux programming language.
- Syntax highlighting (vim regex and tree-sitter)
- LSP integration (diagnostics, hover, completions, go-to-definition)
- Tree-sitter text objects for code navigation
- Code folding
- REPL integration with send-to-REPL
- Commands for running, formatting, and testing
- REPL integration
## Installation
@@ -23,10 +25,19 @@ Neovim support for the Lux programming language.
lsp = {
enabled = true,
autostart = true,
inlay_hints = false, -- requires neovim 0.10+
},
format = {
on_save = false,
},
repl = {
position = "bottom", -- "bottom", "right", or "float"
size = 30, -- percentage of screen
},
diagnostics = {
virtual_text = true,
update_in_insert = false,
},
})
end,
ft = "lux",
@@ -58,6 +69,7 @@ ln -s /path/to/lux/editors/nvim/ftdetect ~/.config/nvim/ftdetect
ln -s /path/to/lux/editors/nvim/ftplugin ~/.config/nvim/ftplugin
ln -s /path/to/lux/editors/nvim/syntax ~/.config/nvim/syntax
ln -s /path/to/lux/editors/nvim/lua/lux ~/.config/nvim/lua/lux
ln -s /path/to/lux/editors/nvim/after ~/.config/nvim/after
```
## Tree-sitter Support
@@ -69,6 +81,32 @@ For tree-sitter based highlighting, install the grammar:
require("nvim-treesitter.configs").setup({
ensure_installed = { "lux" },
highlight = { enable = true },
indent = { enable = true },
-- Enable text objects
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
},
},
move = {
enable = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@class.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@class.outer",
},
},
},
})
-- Register the parser
@@ -89,7 +127,11 @@ parser_config.lux = {
| `:LuxRun` | Run the current file |
| `:LuxFormat` | Format the current file |
| `:LuxTest` | Run tests |
| `:LuxCheck` | Type check the current file |
| `:LuxRepl` | Start the REPL in a terminal |
| `:LuxReplToggle` | Toggle the REPL window |
| `:LuxSendLine` | Send current line to REPL |
| `:'<,'>LuxSend` | Send selection to REPL |
## Key Mappings
@@ -100,18 +142,56 @@ Default mappings in Lux files (using `<localleader>`):
| `<localleader>r` | Run current file |
| `<localleader>f` | Format current file |
| `<localleader>t` | Run tests |
| `<localleader>c` | Type check file |
| `<localleader>R` | Toggle REPL |
| `<localleader>l` | Send line to REPL |
| `<localleader>s` (visual) | Send selection to REPL |
LSP mappings (when LSP is active):
| Mapping | Action |
|---------|--------|
| `gd` | Go to definition |
| `gD` | Go to declaration |
| `K` | Hover information |
| `gr` | Find references |
| `gi` | Go to implementation |
| `<leader>rn` | Rename symbol |
| `<leader>ca` | Code actions |
| `<leader>e` | Show diagnostics float |
| `<leader>q` | Diagnostics to location list |
| `[d` / `]d` | Previous/next diagnostic |
## REPL Integration
The REPL can be positioned at the bottom, right, or as a floating window:
```lua
require("lux").setup({
repl = {
position = "float", -- floating window
size = 30,
},
})
```
Send code to the running REPL:
- `<localleader>l` - Send current line
- Select code visually, then `<localleader>s` - Send selection
## Text Objects
With `nvim-treesitter-textobjects`, you can use:
| Object | Description |
|--------|-------------|
| `af`/`if` | Function outer/inner |
| `ac`/`ic` | Type/class outer/inner |
| `ab`/`ib` | Block outer/inner |
| `aa`/`ia` | Parameter outer/inner |
Example: `dif` deletes the body of a function, `vaf` selects the entire function.
## Configuration
```lua
@@ -124,11 +204,27 @@ require("lux").setup({
enabled = true,
-- Auto-start LSP when opening .lux files
autostart = true,
-- Show inlay hints (requires neovim 0.10+)
inlay_hints = false,
},
format = {
-- Format on save
on_save = false,
},
repl = {
-- Position: "bottom", "right", or "float"
position = "bottom",
-- Size as percentage of screen
size = 30,
},
diagnostics = {
-- Show virtual text for diagnostics
virtual_text = true,
-- Update diagnostics in insert mode
update_in_insert = false,
},
})
```