-
Notifications
You must be signed in to change notification settings - Fork 55
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
Sync locals from nvim-tree-sitter. #345
base: master
Are you sure you want to change the base?
Conversation
1. Add `(block)` as a `@local.scope` 2. Fix the scope for functions. `function_declaration` is used for abstract functions, while `function_definition` is used for the actual concrete functions (along with their function bodies). 3. Add `(class_parameter)`'s `name` as a local definition. References: - nvim-treesitter/nvim-treesitter@ee64345 - nvim-treesitter/nvim-treesitter@06075ec
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.
Thanks!
|
Thank you for reviewing, I'll dig into those failures! |
This adds a test that illustrates the problem being fixed by moving `@local.scope` from `(function_declaration)` to `(function_definition)`. ```scala def meth_with_params(localParam: Int) { var ref_param = c"$localParam $meth_with_params" // ^parameter // ^method } var okay1 = s"hello" var okay = c"$localParam $okay1" // ^none // ^variable ``` Specifically, the local function parameter (named `localParam`) should only be in scope within the body of `meth_with_params`, but on master (e.g. without the `@local.scope` move to `(function_definition)`) for `var okay = c"$localParam $okay1"` the `localParam` is highlighted as a **parameter**!. Here is the failure for the new test when ran against `master`: ``` Failure - row: 6, column: 14, expected highlight 'none', actual highlights: 'parameter' ```
@eed3si9n - As far as I can tell (I'm still ramping up my debugging skills for tree-sitter), the failure here demonstrates a somewhat fundamental issue with how To illustrate the problem I just pushed a test that is being fixed by moving def meth_with_params(localParam: Int) {
var ref_param = c"$localParam $meth_with_params"
// ^parameter
// ^method
}
var okay1 = s"hello"
var okay = c"$localParam $okay1"
// ^none
// ^variable Specifically, the local function parameter (named Here is the failure for the new test when ran against
|
FWIW, I created nvim-treesitter/nvim-treesitter#5359 to ensure that the nvim-treesitter locals for scala are correct. As far as I can tell there is no corresponding feature for |
(block)
as a@local.scope
function_declaration
is used forabstract functions, while
function_definition
is used for theactual concrete functions (along with their function bodies).
(class_parameter)
'sname
as a local definition.References: