bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61655: [Tree sitter] [Feature Request] font-lock function calls, def


From: Jacob Faibussowitsch
Subject: bug#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately
Date: Wed, 22 Feb 2023 13:07:32 -0500

> What's a "member function"? Is it like a method?

Yeah, I suppose method is the more general term for it.

> If people want this distinction, we can add such face. But I'm curious 
> whether some other editors use different colors for these cases.

I personally do not; I brought it up because it was functionality that the 3rd 
party package had over stock. I think a good representative list is the one 
vscode offers:

https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers

> I'm also wondering what face we're supposed to use for "receiver-less" method 
> calls, such as calls to the methods defined in the same class, in e.g. Ruby 
> and Java. Or C++/C#. They don't use ‘this’.

I don’t think emacs should worry about differentiating these cases. Highlight 
those tokens as tree-sitter sees them; regular function calls (i.e. 
`font-lock-function-call-face`). It’s a problem you cannot accurately solve 
without playing the compiler — with all of the implementation and not to 
mention performance baggage that comes with it.

> I also wonder whether we'll need to separate faces for properties: 
> definitions vs. uses. That one we could use to do early, to keep the names 
> uniform, e.g. we'd have:

This is something (also 3rd party package) lsp-mode supports through their 
semantic highlighting. They further distinguish between read and writes to 
variables. But again, they are able to do so because they hook directly into 
compilers.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On Feb 21, 2023, at 18:24, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 21/02/2023 17:31, Jacob Faibussowitsch wrote:
> > but maybe a better default is to leave these faces totally blank and
> > just purely `:inherit` from `font-lock-function-name-face`
> 
> I believe so.
> 
>> +(defface font-lock-function-call-face
>> +  '((t :inherit font-lock-function-name-face :foreground "royalblue1"))
>> +  "Font Lock mode face used to highlight function calls."
>> +  :group 'font-lock-faces)
> 
> This one I was thinking of as well.
> 
>> +(defface font-lock-member-function-call-face
>> +  '((t :inherit font-lock-function-name-face :foreground "brightred"))
>> +  "Font Lock mode face used to highlight member function calls."
>> +  :group 'font-lock-faces)
> 
> What's a "member function"? Is it like a method? If people want this 
> distinction, we can add such face. But I'm curious whether some other editors 
> use different colors for these cases.
> 
> I'm also wondering what face we're supposed to use for "receiver-less" method 
> calls, such as calls to the methods defined in the same class, in e.g. Ruby 
> and Java. Or C++/C#. They don't use 'this'.
> 
> I think more importantly, we need a new face for variables.
> 
> font-lock-variable-ref-face ?
> 
> I also wonder whether we'll need to separate faces for properties: 
> definitions vs. uses. That one we could use to do early, to keep the names 
> uniform, e.g. we'd have:
> 
>  font-lock-function-name-face
>  font-lock-function-call-face
>  font-lock-variable-name-face
>  font-lock-variable-ref-face
>  font-lock-property-name-face
>  font-lock-property-ref-face






reply via email to

[Prev in Thread] Current Thread [Next in Thread]