thqby / vscode-autohotkey2-lsp

Autohotkey v2 Language Support using vscode-lsp.
https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp
GNU Lesser General Public License v3.0
219 stars 21 forks source link

[QUESTION] What's the Exclusion Glob patterns syntax? #577

Closed RaptorX closed 2 months ago

RaptorX commented 2 months ago

I have setup some exclusion patterns for a given folder like this:

20240823@20-03-19

But the files are being read by the extension anyways. I tried a few patterns as you can see in the image. Am I writing them wrong or the extension is not ignoring the files?

thqby commented 2 months ago

This option does not take effect for files opened by the editor or files included by opened files.

RaptorX commented 2 months ago

They are not open.

When i open VSCode they get marked red because they were moved to the "old" folder and the #include locations are invalid now.

I dont want the extension to mark them as problems. And I dont open them (they are copied here by other people in my team), I want the extension to totally ignore them.

But even with the exclusion patterns, they are being read and marked as "having errors" by the extension anyways.

thqby commented 2 months ago

**\old\*.*

RaptorX commented 2 months ago

**\old\*.*

LOL

Exactly the one that i didnt try... let me check and see if it works on my end :)

EDIT:

So I just tested it and, If I open VSCode within a folder and no files are open when i start it, it will not mark those files as having issues.

As soon as I click on ANY file in the folder, all the "ignored" files get read and marked with errors. So it seems that it is only ignoring on load, but they are not being ignored on file open, even if the file is not related to them at all.

This is what i mean:

https://github.com/user-attachments/assets/8812349c-9f70-455c-b395-3d572dc1995f

thqby commented 2 months ago

The open file does not refer to them indirectly? I can't reproduce the issue.

RaptorX commented 2 months ago

The open file does not refer to them indirectly? I can't reproduce the issue.

No they do not.

On the last video I sent, towards the end you can see the whole contents of the "test" file. It doesn't even have includes. Hehe

RaptorX commented 2 months ago

The open file does not refer to them indirectly? I can't reproduce the issue.

Assume ScriptDir/ Lib/Lib1.ahk Old/ File1.ahk

File1 includes Lib1. Duplicate File1 to File2... Same data. Move File1 to old. Now the include path is invalid (no lib folder in old).

File 2 is your main script now.

I personally use git for version control but others in my team keep putting files in an "old" folder.

I can . gitignore and I can ignore them in searches. But the extension keeps making them red and listing all the "invalid path" or "variable not defined" errors even if I try to use the glob ignore patterns.

I just need to see actual errors in my work folder but sometimes it is annoying.

thqby commented 2 months ago

image Disable other extensions and try again? I still can't reproduce it.

RaptorX commented 2 months ago

Update:

The issue only happens when AHK++ from @mark-wiemer is enabled but it is not directly related to it.

I marked all the affected files with #Requires AutoHotkey v2.0.

When I have AHK++ disabled all of them get ignored. When I enable AHK++ they all get marked with errors even if I am ignoring the whole folder.

The following test is with all extensions disabled except for Autohotkey v2 Language Support:

https://github.com/user-attachments/assets/632b8648-c5d4-4653-b13c-c2b81d511ffa

thqby commented 2 months ago

https://github.com/mark-wiemer-org/ahkpp/blob/main/src/parser/parser.ts#L40

ahk++ opens all ahk files in the workspace, so the extension is notified of the file opening and starts parsing the script.

RaptorX commented 2 months ago

https://github.com/mark-wiemer-org/ahkpp/blob/main/src/parser/parser.ts#L40

ahk++ opens all ahk files in the workspace, so the extension is notified of the file opening and starts parsing the script.

Interesting.

So. I mainly code in v2 and have ahk files default to use your extension. Is ahk++ ignoring what the default extension for a given file is?

I think It shouldn't.

mark-wiemer commented 2 months ago

Hi, you'll see I've opened https://github.com/mark-wiemer-org/ahkpp/issues/488. This was an oversight when I added automatic version switching and unique icons for AHK v1 and AHK v2. Because I wanted the icons to be the appropriate color on start, I make the extension scan every file with .ahk, .ahk2, and other relevant file extensions to check for a #Requires directive near the start of the file. This "opens" the file from the perspective of VS Code (though users never see it), and thqby's extension loads every "opened" file regardless of whether it's excluded or not.

I'll be working on a fix this month, but it's a busy next few weeks for me. Sorry for the inconvenience, I'd recommend disabling AHK++ in the short term and watching the issue if this behavior is frustrating.