Skip to content

Weird decorators highlighting with default python syntax #51

@sterliakov

Description

@sterliakov

Let's begin with an image:

Screenshot

I know for sure this change was introduced last year and is annoying me already for a while. Previously decorators used to be highlighted fully, including dotted paths. This looks annoying, especially for properties, but I'm ready to accept "works as intended" resolution too:)

Scopes are assigned as follows:

  • Line start: source.python meta.annotation.python punctuation.definition.annotation.python
  • "at" sign and lone decorator name: source.python meta.annotation.python variable.annotation.python
  • dotted path: source.python meta.annotation.python meta.path.python meta.generic-name.python
  • period in path: source.python meta.annotation.python meta.path.python punctuation.accessor.dot.python
  • last path component: source.python meta.annotation.python meta.path.python variable.annotation.python

Tbh, this smells like a bug in ST syntax (why does variable.annotation.python not apply to qualifying components?) - if you agree, I'll address this question to ST team instead.

Code to reproduce:

@deco
def foo(x): pass


@foo.deco
def bar(x): pass


class A:
	@property
	def foo(x): pass

	@foo.setter
	def foo(x): pass

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions