ahkpp icon indicating copy to clipboard operation
ahkpp copied to clipboard

Add unit tests for folding regions and language configuration

Open mark-wiemer opened this issue 3 years ago • 3 comments

Description

Language configuration is determined by ahk.configuration.json, but there is no current way to ensure the regular expressions defined there work correctly in editor files.

Reproduction steps

Steps to reproduce the behavior:

  1. Change the folding regions regular expression
  2. Test the extension
  3. Note the tests still pass since there is no automated test to ensure folding regions are valid

Expected behavior

Tests fail when folding regions change.

Additional context

Language Configuration Guide | Visual Studio Code Extension API

mark-wiemer avatar Nov 27 '21 15:11 mark-wiemer

Hi so does this like include stuff like ;#region ;region etc?

Yuna-She-They avatar May 29 '22 18:05 Yuna-She-They

The current regexes in ahk.configuration.json don't match #regions anyway? If this is naïve code then feel free to change it, but it's working for me:

"folding": {
    "markers": {
        "start": "^;.*\\bregion\\b",
        "end": "^;.*\\bendregion\\b"
    }
}

File location: \.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.8.4\ahk.configuration.json

Cirieno avatar Jul 21 '22 12:07 Cirieno

@Braber01 yes it's meant to support code like that, and yes @Cirieno I know the code change should be simple. I've been struggling to set up some automated test suites to make sure the regexes are robust and well-documented because regexes are notoriously hard to work with. I'm still tracking this issue, if we can figure out a way to easily test this behavior I'd be happy to accept a PR to fix it :)

mark-wiemer avatar Jul 28 '22 04:07 mark-wiemer

closing as dupe, this will come when I work on the relevant files

mark-wiemer avatar Oct 18 '24 03:10 mark-wiemer