-
Notifications
You must be signed in to change notification settings - Fork 217
Add semantic token for constants #138
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
Conversation
TOKEN_TYPES = [ | ||
:variable, | ||
:method, | ||
:namespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we can't differentiate between a module and class reference, should we use namespace or class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought calling both modules and classes a class token may be confusing, and so settled with namespace. Any opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and all classes and modules are considered modules. So, indeed namespace would be the more appropriate one.
0d52ef7
to
64fa643
Compare
|
||
response = make_request("textDocument/semanticTokens/full", { textDocument: { uri: "file://#{__FILE__}" } }) | ||
assert_empty(response[:result][:data]) | ||
assert_equal([0, 6, 3, 2, 0], response[:result][:data]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should reconsider how we test this (in another PR) because this is surprisingly cryptic.
64fa643
to
7ecb07f
Compare
This is an expected failure since the source code contains a constant.
7ecb07f
to
11dc40e
Compare
* Fix spacing between constants and sigs * Use HTTP response classes instead of code
Motivation
Inconsistent highlighting in constants:
Implementation
Add new semantic token type,
namespace
, and add them as a token for constants.Irrelevant to the primary issue but I also rearranged some of the visit methods in alphabetical order.
Automated Tests
const.exp
Manual Tests
test/fixtures/const.rb