Skip to content

Update language server plugin to exclude base file diagnostics for file hooks#7176

Open
lL1l1 wants to merge 12 commits into
developfrom
fa-plugin-update
Open

Update language server plugin to exclude base file diagnostics for file hooks#7176
lL1l1 wants to merge 12 commits into
developfrom
fa-plugin-update

Conversation

@lL1l1

@lL1l1 lL1l1 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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

    • Improved Lua hook-file editing to reduce irrelevant diagnostics by excluding warnings originating from the base file.
  • Documentation

    • Updated the changelog entry to reflect the Lua plugin behavior change for hook-file authoring.
  • Chores

    • Added startup logging for the Lua plugin to help confirm initialization in output logs.

@lL1l1
lL1l1 requested review from Garanas and speed2CZ July 16, 2026 07:07
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1fc318f4-8782-4d21-b2fd-ba8f026e5eac

📥 Commits

Reviewing files that changed from the base of the PR and between fdbc461 and fdde3c1.

📒 Files selected for processing (1)
  • .vscode/fa-plugin.lua
🚧 Files skipped from review as they are similar to previous changes (1)
  • .vscode/fa-plugin.lua

📝 Walkthrough

Walkthrough

The 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.

Changes

FA Plugin update

Layer / File(s) Summary
Hook content diagnostic filtering
.vscode/fa-plugin.lua, changelog/snippets/other.7176.md, changelog/snippets/category.7158.md
Adds startup messages, wraps prepended repository content with diagnostic suppression directives, preserves the input’s first character, documents the change, and removes placeholder changelog text.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: speed2cz, garanas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: suppressing base-file diagnostics for hooked files.
Description check ✅ Passed The description covers the change, testing, and checklist, and is complete enough for the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fa-plugin-update

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lL1l1
lL1l1 marked this pull request as ready for review July 16, 2026 07:12
Comment thread .vscode/fa-plugin.lua
start = 1,
finish = 1,
text = repoFile:read("*a")
text = diagnosticDisable .. repoContent .. diagnosticEnable .. text:sub(1, 1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e4130a1 and fdbc461.

📒 Files selected for processing (3)
  • .vscode/fa-plugin.lua
  • changelog/snippets/category.7158.md
  • changelog/snippets/other.7176.md
💤 Files with no reviewable changes (1)
  • changelog/snippets/category.7158.md

Comment thread .vscode/fa-plugin.lua
Comment thread .vscode/fa-plugin.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants