nvim/CONFORM_MIGRATION.md

73 lines
2.6 KiB
Markdown

# Migration Plan: none-ls → conform.nvim
**Date:** 2026-01-12
**Status:****COMPLETED**
**Reason:** none-ls's phpcbf formatter is buggy (adds blank lines). conform.nvim is more modern, doesn't use LSP overhead, better maintained.
## Current State
**Formatting (conform.nvim):**
- ✅ prettier (JS/TS/CSS/JSON/HTML/Markdown)
- ✅ stylua (Lua)
- ✅ phpcbf (PHP) with WordPress standard
**Linting (nvim-lint):**
- phpcs, eslint_d, markdownlint
**LSP (lspconfig):**
- Language features (autocomplete, goto-def, hover, etc.)
## Migration Checklist
### Phase 1: Setup conform.nvim
- [x] Create `lua/plugins/conform.lua`
- [x] Configure formatters:
- [x] prettier (JS/TS/CSS/JSON/HTML/Markdown)
- [x] stylua (Lua)
- [x] phpcbf (PHP) with WordPress standard support
- [x] Configure format-on-save behavior
- [x] Set up project-local executable resolution (vendor/bin, node_modules/.bin, Mason, global)
- [x] Add keymaps for manual formatting (`<leader>lf`, `<leader>lt`)
### Phase 2: Remove none-ls
- [x] Delete `lua/plugins/none-ls.lua`
- [x] Remove none-ls from lazy-lock.json (happens automatically on `:Lazy sync`)
- [x] Remove the custom phpcbf autocmd workaround (no longer needed)
### Phase 3: Testing
- [x] Test prettier formatting (JS/TS/CSS files)
- [x] Test stylua formatting (Lua files)
- [x] Test phpcbf formatting (PHP files) - **verified NO blank lines added**
- [x] Test format-on-save toggle (`<leader>lt`)
- [x] Test manual format (`<leader>lf`)
- [x] Test project-local formatter detection
- [x] Verify phpcs.xml is respected when present
### Phase 4: Documentation
- [x] Update README.md Configuration section
- [x] Update AGENTS.md Process section (plugin list, formatting tools)
- [x] Update MIGRATION_PLAN.md status (Phase 9.2)
- [x] Update LOG.md with decision and rationale
## Expected Benefits
1. **No more blank line bug** - conform calls phpcbf cleanly without none-ls's buggy preprocessing
2. **No LSP overhead** - formatters run as simple shell commands
3. **Better maintained** - conform.nvim is actively developed
4. **Cleaner architecture** - clear separation: LSP (features), nvim-lint (diagnostics), conform (formatting)
5. **Easier debugging** - simpler execution path, better error messages
## Rollback Plan
If conform.nvim has issues:
1. Restore `lua/plugins/none-ls.lua` from git
2. Keep the custom phpcbf autocmd for PHP
3. Run `:Lazy sync` to reinstall none-ls
## Notes
- conform.nvim has built-in support for all our formatters (prettier, stylua, phpcbf)
- It handles executable resolution similarly to our `find_executable()` helper
- Format-on-save can be toggled per-buffer or globally
- Visual range formatting supported out of the box