pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

feat: semantic highlighting

Open kiyoon opened this issue 8 months ago • 1 comments

I would like to know if anything is planned for semantic highlighting.

It is a feature provided in basedpyright, pylance and even typescript language server that highlights based on the semantics, like known variables by the LSP are highlighted.

This has been very important in my workflow because I set syntax highlighting to very minimal and prefer to use mainly semantic highlighting. More colour in my code means more type-complete, making programming more fun kind of like painting.

As a reference this is what basedpyright looks like:

Image

The var_outside_scope has a semantic highlight as well, it just happens to be white in this case. So the variable within and outside of function have different colours.

I appreciate your work!

kiyoon avatar May 18 '25 01:05 kiyoon

Hi, thanks for reaching out. We do plan to support semantic syntax highlighting.

cc @kinto0

Possibly the same request as https://github.com/facebook/pyrefly/issues/218

yangdanny97 avatar May 18 '25 02:05 yangdanny97

Closing this to consolidate our tracking

yangdanny97 avatar May 29 '25 02:05 yangdanny97

Hi @kiyoon, which IDE are you using? @SamChou19815 added support for semantic highlighting which we have tested in VSCode and is available Pyrefly's latest release. If you get a chance to try it, we'd love to know what you think.

lolpack avatar Jun 18 '25 15:06 lolpack

@lolpack Thank you! I'm using Neovim and I can see some colours, although not all of them :)

Specifically, the colours on the function call's keyword arguments are missing.

build_sql(
    param1=value1,
    param2=value2,
)

The param1 and param2 should be coloured. But I know you are still working on it 👍

kiyoon avatar Jun 19 '25 04:06 kiyoon

@lolpack Thank you! I'm using Neovim and I can see some colours, although not all of them :)

Specifically, the colours on the function call's keyword arguments are missing.

build_sql( param1=value1, param2=value2, ) The param1 and param2 should be coloured. But I know you are still working on it 👍

done, will be out in next release. let us know if there are other important ones you are missing and want us to prioritize!

kinto0 avatar Jun 26 '25 15:06 kinto0