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

Incorrect YAML syntax highlighting for version numbers with multiple periods #4468

Closed
rpatrick00 opened this issue Mar 11, 2021 · 4 comments
Closed

Comments

@rpatrick00
Copy link

rpatrick00 commented Mar 11, 2021

Given a YAML file that looks like this:

topology:
    Name: todo_domain
    DomainVersion: 12.2.1.4.0

The DomainVersion field value is highlighted as a numeric constant instead of a string.

I tested the following regular expression using one of the online regex testers and it is not excluding numbers with multiple dots in it.

{
    token : "constant.numeric", // float
    regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)/
}
@brynne8
Copy link

brynne8 commented Dec 27, 2021

I would prefer numbers with multiple dots to be seen as numeric instead of string.

@robertpatrick
Copy link

@AlexanderMisel But numbers can have, at most, only one decimal point. While your preference may be to highlight these as a numeric, it is not technically correct to do so. If you try to convert such a string into a number in any programming language, it will fail.

@brynne8
Copy link

brynne8 commented Dec 28, 2021

You are right. If I were to write a lexer for parsing, I would try to make it as accurate as I can.

@andrewnester
Copy link
Contributor

Fixed and release in Ace 1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants