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

Scopes: Should we require scopes/ranges to be properly nested (i.e. disallow straddling) #73

Open
szuend opened this issue Mar 6, 2024 · 2 comments
Labels

Comments

@szuend
Copy link
Collaborator

szuend commented Mar 6, 2024

While the start/end item encoding enforces a tree structure, negative column deltas could still result in scopes that are not properly nested, e.g.:

 A |
   |
   |   B |
   |     |
   |     |
         |
         |

Could be encoded as start item A, start item B, 'end item B, end item Awhereend item A` has a negative column delta.

Should consumers reject scopes encoding like these?

@nicolo-ribaudo
Copy link
Member

Could we maybe enforce that the delta is positive in the format itself, by storing it as an uint rather than as a signed integer?

@hbenl
Copy link
Collaborator

hbenl commented Mar 8, 2024

I agree that we should require proper nesting. It is somewhat implicit because the scopes that we are encoding need to be properly nested themselves but we could state this explicitly and also require that consumers reject a sourcemap with scopes that aren't properly nested.

Could we maybe enforce that the delta is positive in the format itself, by storing it as an uint rather than as a signed integer?

I don't see how since we're using VLQ, which (AFAIK) doesn't have a way to encode uints.

@jkup jkup added the Scopes label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants