fix: add pkl eval linter to catch diagnostics pkl-lsp misses#329
Merged
Conversation
pkl-lsp 0.7.1 does not reliably publish diagnostics (e.g. missing required properties, apple/pkl-lsp#103), so add a nvim-lint linter that runs `pkl eval` and parses its error output. In-buffer errors attach to the exact line/col; errors reported at an imported/amended definition site are surfaced on line 1 with the render path for context. Also set pkl_cli_path to an absolute path via vim.fn.exepath('pkl') so the LSP resolves the mise-managed pkl binary, and switch the lualine LSP click handler to :checkhealth vim.lsp for more detailed LSP info.
Pre-existing formatting issue flagged by the Lint Fish Files CI job: fish_indent normalizes `> ~/...` to `>~/...`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkl-lsp 0.7.1 doesn't reliably publish diagnostics in neovim — notably it misses missing required properties (e.g. an unset
addressfield whoseaddress.streetis then undefined; see apple/pkl-lsp#103). This adds a nvim-lint linter that runspkl evaland parses its error output to fill that gap.Changes
nvim/lua/plugins/nvim-lint.lua: Newpkllinter usingpkl eval. The parser:address.street: Tried to read property…) so they aren't lost.nvim/lua/plugins/pkl.lua: Setpkl_cli_pathto an absolute path viavim.fn.exepath('pkl')so the LSP resolves the mise-managedpklbinary.nvim/lua/plugins/lualine.lua: Switch the LSP click handler from:LspInfoto:checkhealth vim.lspfor more detailed LSP info.Testing
Verified in headless neovim against real
.pklfiles:y: Int = "str") → diagnostic at exact line/col (matches LSP).stylua --checkpasses.Notes
The LSP is kept for completions, hover, and goto-definition. When the next pkl-lsp release fixes diagnostics, the lint linter can be revisited to avoid duplicates.