sgwozdz / jenkinsfile-support

Visual Studio Code extension
MIT License
33 stars 7 forks source link

Unbalanced braces reported if value contains double slash #68

Open joe-mojo opened 3 years ago

joe-mojo commented 3 years ago

Describe the bug If a correctly closed string literal is holding a '//', next brace is reported as unmatched. Minimal example:

pipeline {
    agent none
    parameters {
        string(name: 'GIT_URL', defaultValue: 'https://example.com/repos/project.git', description: 'whatever')
    }

}

Expected behaviour As the double-slash are in correctly closed string literal, no error should be reported

Actual behaviour 2 braces are wrongly reported as unbalanced

Screenshots Actual behaviour: image Workaround: image

Additional context Workaround:

pipeline {
    agent none
    parameters {
        string(name: 'GIT_URL', defaultValue: 'https:/' + '/example.com/repos/project.git', description: 'whatever')
    }

}

Splitting string literal so as to remove the // sequence remove both reported errors.

wolf99 commented 3 years ago

Seeing same issue

tomas-kr commented 3 years ago

Same issue, but no "//" required:

image

ahochsteger commented 1 year ago

@sgwozdz the bug seems to be also triggered by /* somewhere in a string like in this simple example:

node {
    stage('Test') {
        sh 'ls build/*.json'
    }
}

image

When removing the slash from the ls command, the error disappears: image

It seems that to treat /* somewhere in a string as the start of a block comment just like //, causing the error.

BTW I'm using v1.1.0 of the extension with v1.73.1 of Visual Studio Code.

MiMiMeowMeow commented 4 months ago

Bump Still see this issue v1.1.0 of the extension with v1.91.1 of Visual Studio Code.