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

Parser: Wrong column position. #2776

Open
maxwell-ilai opened this issue Mar 15, 2023 · 0 comments
Open

Parser: Wrong column position. #2776

maxwell-ilai opened this issue Mar 15, 2023 · 0 comments

Comments

@maxwell-ilai
Copy link

I'm tweaking a plugin for 'Vscode' that will display the colors in the '.styl' file, using the 'Parser' from the stylus package. But in some scenarios the Column value is returned wrong causing a wrong positioning of the color provider.

Fixes I found to return the correct position:

  1. Remove the comma separating the Key:Value. (This fix resolves all issues)
  2. Remove spaces before Key:Value. (This fix resolves all issues)
  3. Put Tab instead of Space before Key:Value. However, if there is any space character at the end of the previous line, it is deducted from the position, returning a value smaller than the real one. See image of 'list' hash below. (This fix partially resolves the issues)

To reproduce:

/// Hashes
foo = { bar: hwb(164 33% 55% / 0.34), baz: black }

foo = {
  bar: #79aa06,
  'baz': #fa01a8d8,
  '0': #6c3cdb
}

list = foo { 'int': red, str: green } { 'node': rgba(13, 125, 199, 0.918), color: #32E }

foo = {
  bar: {
    baz: {
        one:    hsl(0deg 0% 0%),
        two:    rgba(255 255 255 0.3),
        three:  hsla(108 60% 41% 0.336),
        four:   rgba(196, 160, 0, 0.925)
    }
  }
}

Current behavior:

image

Expected behavior(using fixes):

image

Environment information:

  • stylus version: v0.59.0
  • nodejs version: v19.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant