diff --git a/queries/highlights.scm b/queries/highlights.scm index dd1c9139..3f308db0 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -33,8 +33,10 @@ "yield" ] @keyword -((identifier) @keyword - (#match? @keyword "^(private|protected|public)$")) +; `private`, `protected` and `public` are `Module` instance methods, not +; keywords: they can be called with arguments, passed a `def`, or shadowed. +((identifier) @function.method.builtin + (#match? @function.method.builtin "^(private|protected|public)$")) (constant) @constructor diff --git a/test/highlight/classes.rb b/test/highlight/classes.rb index f5aa258c..9139d903 100644 --- a/test/highlight/classes.rb +++ b/test/highlight/classes.rb @@ -22,12 +22,12 @@ def init(id) end private - # ^ keyword + # ^ function.method.builtin public - # ^ keyword + # ^ function.method.builtin protected - # ^ keyword + # ^ function.method.builtin end # <- keyword