Add more precise tag for function/class declaration names #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Similar to
github.com/codemirror/lang-python@162be8f40a.I referenced the tests from
lezer-parser/javascript, which has tests forFunctionDeclaration/VariableDefinitionandClassDeclaration/VariableDefinition.For the pull request, I am assuming that for purposes of syntax highlighting that
ClassDefinition/VariableNameandFunctionDefinition/VariableNamein python should give the same output asClassDeclaration/VariableDefinitionandFunctionDeclaration/VariableDefinitionin javascript.Even though in javascript there is both
VariableDefinitionandVariableName, while in python there's onlyVariableName. This is a slight deviation from codemirror 5 since both function definition names and function parameter names are given the samecm-defspan.The alternative for
FunctionDeclaration/VariableDefinition, instead ofcan be
The drawback for this is if you wanted to highlight function definition names in both python and javascript, you would have to have an additional tag:
Applying a tag modifier twice is a no-op, so
t.defintion(t.defintion(x))equalst.definition(x). The patch looks good as it is.