Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while validating file - invalid regular expression #60731

Closed
flcdrg opened this issue Oct 12, 2018 · 5 comments
Closed

Error while validating file - invalid regular expression #60731

flcdrg opened this issue Oct 12, 2018 · 5 comments
Assignees

Comments

@flcdrg
Copy link

flcdrg commented Oct 12, 2018

Issue Type: Bug

Creating a file named version.json and using the content described in https://github.com/AArnott/Nerdbank.GitVersioning/blob/master/doc/versionJson.md, the following error is displayed:

[Error - 4:03:11 PM] Error while validating file:///c%3A/dev/git/MyProject/version.json: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
SyntaxError: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
    at new RegExp (<anonymous>)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:37705
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:38951)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:33084
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:35308)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:40896
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
    at g (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:41344)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:42242
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
[Error - 4:03:11 PM] Error while computing document colors for file:///c%3A/dev/git/Integration-vsts/version.json: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
SyntaxError: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
    at new RegExp (<anonymous>)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:37705
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:38951)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:33084
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:35308)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:40896
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
    at g (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:41344)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:42242
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
[Error - 4:03:13 PM] Error while validating file:///c%3A/dev/git/Integration-vsts/version.json: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
SyntaxError: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
    at new RegExp (<anonymous>)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:37705
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:38951)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:33084
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:35308)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:40896
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
    at g (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:41344)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:42242
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
[Error - 4:03:14 PM] Error while computing document colors for file:///c%3A/dev/git/Integration-vsts/version.json: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
SyntaxError: Invalid regular expression: /^v?(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)(?:\.(?<patch>0|[1-9][0-9]*)(?:\.(?<revision>0|[1-9][0-9]*))?)?(?<prerelease>-(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?(?<buildMetadata>\+(?:[\da-z\-]+|\{height\})(?:\.(?:[\da-z\-]+|\{height\}))*)?$/: Invalid group
    at new RegExp (<anonymous>)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:37705
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:38951)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:33084
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:35308)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:40896
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)
    at g (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:41344)
    at c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:42242
    at z (c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain.js:9:43497)

VS Code version: Code 1.28.1 (3368db6, 2018-10-11T18:15:15.139Z)
OS version: Windows_NT ia32 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 x 3592)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.93GB (8.59GB free)
Process Argv --disable-extensions .
Screen Reader no
VM 0%
Extensions disabled

I originally reported this at dotnet/Nerdbank.GitVersioning#230, but @AArnott believes there is no problems with the regexes in the schema file.

@vscodebot
Copy link

vscodebot bot commented Oct 12, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@aeschli
Copy link
Contributor

aeschli commented Oct 12, 2018

@aeschli aeschli closed this as completed Oct 12, 2018
@AArnott
Copy link
Member

AArnott commented Oct 12, 2018

@aeschli Thanks for investigating this. But @flcdrg already filed dotnet/Nerdbank.GitVersioning#230 as he mentioned. And as I mentioned in the linked issue, the regex that it's complaining about works fine in Javascript as you can see here.

So isn't the bug in VS Code if the regex expression is valid and works in Javascript, but VS Code is rejecting it?

@aeschli
Copy link
Contributor

aeschli commented Oct 14, 2018

That's what I get when looking at the regex in https://regexr.com/:
image

Also when entering the regex in the Chrome console:
image

@AArnott
Copy link
Member

AArnott commented Oct 15, 2018

Thanks. I wish there was more consistency across JS regex so we don't get different answers from different services. But I can remove the names of the capture groups as that seems to make it happy.

Thanks, @aeschli

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants