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

Fix usage of sublime.score_selector #2427

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Conversation

BenjaminSchaaf
Copy link
Contributor

ST 4173 tweaks how selector scoring works resulting in LSP no longer functioning.

As per the comment there seems to be a misunderstanding of how sublime.score_selector works. The entire selector must always match for a non-zero score, so if the goal is to check if it's not empty and matches then checking for >= 8 is simply wrong.

ST 4173 tweaks how selector scoring works resulting in LSP no longer
functioning.

As per the comment there seems to be a misunderstanding of how
`sublime.score_selector` works. The entire selector must always match
for a non-zero score, so if the goal is to check if it's not empty and
matches then checking for `>= 8` is simply wrong.
@BenjaminSchaaf
Copy link
Contributor Author

An alternative would be to check sublime.score_selector > 1; although a selector like source would also have a score of 1 and thus not match. It's thus simpler but not as correct.

@jfcherng
Copy link
Contributor

jfcherng commented Feb 28, 2024

Fwiw

API \ ST version =4173 <4173
sublime.score_selector("a.b", "b") 0 0
sublime.score_selector("a.b", "") 1 1
sublime.score_selector("a.b", " ") 1 1
sublime.score_selector("a.b", "a") 1 8
sublime.score_selector("a.b", "a.b") 2 16

@rchl
Copy link
Member

rchl commented Feb 28, 2024

@jfcherng I think you've mislabeled the columns which confused me on how this could cause things to break. The new build returns 2 for sublime.score_selector("a.b", "a.b"), not the old one.

plugin/core/types.py Outdated Show resolved Hide resolved
@jfcherng
Copy link
Contributor

@jfcherng I think you've mislabeled the columns which confused me on how this could cause things to break. The new build returns 2 for sublime.score_selector("a.b", "a.b"), not the old one.

Oh. I use a wrong column title... Fixed.

@rchl rchl merged commit 1ba8c05 into sublimelsp:main Feb 28, 2024
8 checks passed
rchl added a commit that referenced this pull request Feb 28, 2024
* main:
  Cut 1.29.0
  Fix usage of sublime.score_selector (#2427)
  docs: add info about typst-lsp commands (#2424)
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.

3 participants