Update language server plugin to exclude base file diagnostics for file hooks#7176
Update language server plugin to exclude base file diagnostics for file hooks#7176lL1l1 wants to merge 12 commits into
Conversation
This reverts commit e16da95.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe FA Lua plugin now logs startup progress and wraps repository hook content with diagnostic directives before passing it to the language server. Changelog snippets document the plugin update and remove placeholder text. ChangesFA Plugin update
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This reverts commit 134823a.
| start = 1, | ||
| finish = 1, | ||
| text = repoFile:read("*a") | ||
| text = diagnosticDisable .. repoContent .. diagnosticEnable .. text:sub(1, 1) |
There was a problem hiding this comment.
The reason I replace with text:sub(1,1) is that I can't make start and finish equal 0. You have to replace some byte, you can't just add in content.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.vscode/fa-plugin.lua:
- Around line 77-85: The diagnostic-enable directive assembled in the diff
insertion must always begin on its own line. Normalize repoContent after reading
it in the surrounding hook logic, ensuring a trailing newline is present before
concatenating diagnosticEnable, and add a regression case covering repository
files without a final newline.
- Around line 75-77: Close the file handle in the repoFile flow after
repoFile:read("*a") completes. Add repoFile:close() immediately after reading,
while preserving the existing content-processing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ab837315-6911-453d-9f85-5ffde078087b
📒 Files selected for processing (3)
.vscode/fa-plugin.luachangelog/snippets/category.7158.mdchangelog/snippets/other.7176.md
💤 Files with no reviewable changes (1)
- changelog/snippets/category.7158.md
avoids waiting for GC to close file
Description of the proposed changes
Disable diagnostics for the base file that is being hooked so that errors in that file don't show up when editing your hook.
Testing done on the proposed changes
I've used this plugin when developing mods.
You can also view what the plugin's text replacement is creating by going to
LOGPATH/diffed.lua(https://luals.github.io/wiki/plugins/) when develop=true in the misc parameters (as in the debug setup commit). The normal log file is linked in the vscode's output panel (ctrl+shift+u) in the lua category when the language server starts, which leads to the LOGPATH folder.Checklist
Summary by CodeRabbit
Bug Fixes
Documentation
Chores