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

Token scope prefers $ over other symbols #2048

Merged
merged 10 commits into from
Nov 28, 2023
Merged

Token scope prefers $ over other symbols #2048

merged 10 commits into from
Nov 28, 2023

Conversation

AndreasArvidsson
Copy link
Member

Fixes #1321

Checklist

  • I have added tests
  • [-] I have updated the docs and cheatsheet
  • [-] I have not broken the cheatsheet

: testRegex(identifierMatcher, document.getText(scopeB.domain))
? false
: undefined;
if (testRegex(identifierMatcher, textA)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also a bit surprised by our logic here. Why do we immediately prefer a if it's an identifier; what if b is also an identifier? I would expect us to return undefined in that case 🤔. I guess you're just mirroring the same logic here but seems wrong to me

Copy link
Member Author

@AndreasArvidsson AndreasArvidsson Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. It just isn't possible for two identifiers to be adjacent so it still works.
This function doesn't even need to return undefined. It's just a question if you should prefer the first one over the second. False does the same thing as undefined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh right yeah I guess we never hit that with two identifiers

False and undefined are different I believe. False means prefer b; undefined means no preference so let modifier decide

I would argue we should be correct here now that we actually can have them adjacent

Copy link
Member Author

@AndreasArvidsson AndreasArvidsson Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just saying that today we don't actually utilize that. We could simplify the function signature and still have the same behavior as today.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I have now updated the code to reflect the actual logic

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid

@pokey pokey added this pull request to the merge queue Nov 28, 2023
Merged via the queue into main with commit 3fe5d81 Nov 28, 2023
14 checks passed
@pokey pokey deleted the dollar_token branch November 28, 2023 11:57
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

Successfully merging this pull request may close these issues.

$ should be treated as an identifier
2 participants