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

feat: use builtin neovim semantic token api #1186

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stefanboca
Copy link
Collaborator

Closes #187

@stefanboca stefanboca marked this pull request as draft February 10, 2025 03:29
@stefanboca
Copy link
Collaborator Author

stefanboca commented Feb 10, 2025

I'm not sure how to test this, so I've marked it as draft...

Some notes:

  • I made the assumption that there is only ever a single semantic bracket request at a given time. Any new requests (calls to add_brackets_via_semantic_tokens that occur before a previous timeout expires will be overwritten.
  • semantic tokens must not be disabled by users - the way to do this was by setting client.server_capabilities.semanticTokensProvider = nil, which we have a nil check for, so this should not change any behavior.

(token.type == 'function' or token.type == 'method')
and cursor[1] == token.line
and cursor[2] >= token.start_col
and cursor[2] < token.end_col
Copy link
Collaborator Author

@stefanboca stefanboca Feb 10, 2025

Choose a reason for hiding this comment

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

Previously this line was cursor[2] <= token-end_col, but vim.lsp.semantic_tokens.get_at_pos does the equivalent of the current version. This might have been an off by one error originally? Maybe it's also related to #1168?

@stefanboca stefanboca requested a review from Saghen February 10, 2025 03:37
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.

LSP semantic tokens usage
1 participant