Goz3rr / vscode-glualint

glualint for vscode
https://marketplace.visualstudio.com/items?itemName=goz3rr.vscode-glualint
MIT License
7 stars 4 forks source link

Added an option to lint all files within the workspace #17

Closed robotboy655 closed 9 months ago

robotboy655 commented 10 months ago

This Pull Request adds an option to lint all files within the workspace. There are a few caveats to this however:

This Pull Request also fixes opened documents not getting linted on editor open, especially when the currently opened document is a non Lua file. This also bypasses glualint.activeLanguages due to API limitations.

Please let me know if there are any issues or changes necessary.

robotboy655 commented 9 months ago

@Goz3rr Any feedback on this?

Goz3rr commented 9 months ago

Thanks, seems like this slipped past without me noticing.

I don't do much lua coding these days so I'm not sure if I can judge what would be the best behavior here, but seeing as it's mostly gated behind an optional setting I don't think there really is a wrong choice here. As I understand it you want to lint all the files in the workspace at all times, even when they're not currently open in the editor?

Things that stood out to me at a glance:

robotboy655 commented 9 months ago

Yes, the main idea behind this PR is to lint all documents in the workspace.

I have pushed changes that address the code style inconsistency and to use async/await as requested. If I missed anything, please let me know (and preferably point out what I missed)


Yes, the following changes https://github.com/Goz3rr/vscode-glualint/pull/17/commits/c30fe13faf154478c72223885548bfd976f33e0f are meant to address already opened documents not being linted on editor open. The workspaceContains activation event is necessary when the selected tab is not a Lua file on VSCode open.

I am testing on VSCode 1.85 via extension debugging, but this also happens in the live build of the extension. There must've been a change to VSCode that causes this. There may be some trickery with package.json that would enable the extension to actually see all open documents with vscode.workspace.textDocuments, but I am not sure. Here's what my proposed fix does:

https://github.com/Goz3rr/vscode-glualint/assets/3299036/79f25f87-7c9f-4624-87f6-7f717a8f97bd

I can move this to a separate PR if desired.

Goz3rr commented 9 months ago

The changes look good, thanks!