posit-dev / positron

Positron, a next-generation data science IDE
Other
1.19k stars 32 forks source link

Positron should better recognize and highlight Python keywords #3731

Open ntluong95 opened 4 days ago

ntluong95 commented 4 days ago

Currently, module keywords such as pandas, pd, etc. are not highlighted. See the example below

In Vscode image

In Positron image

petetronic commented 3 days ago

Thanks for logging this, this is as a result of the token types from of the Jedi-based language server in use in Positron's Python LSP.

ntluong95 commented 3 days ago

Is there anyway to use Pylang, which is much better?

seeM commented 2 days ago

@ntluong95 I can't find any info on a "Pylang" syntax highlighter. Do you mean Pylance?

ntluong95 commented 2 days ago

Yes sorry I meant Pylance. Fortunately I found this one, which serve my need. Maybe something you can consider to integrate into Positron as I know Pylance is only for VSCode. Link: https://open-vsx.org/extension/detachhead/basedpyright

ntluong95 commented 2 days ago

Yes sorry I meant Pylance. Fortunately I found this one, which serve my need. Maybe something you can consider to integrate into Positron as I know Pylance is only for VSCode. Link: https://open-vsx.org/extension/detachhead/basedpyright

Here is the result after installing the package. However, the Quarto file could not display syntax highlighting for Python module. I think Positron should have more support for Quarto extension since now the Jupyter Notebook is far more better image

seeM commented 1 day ago

Thank you for pointing out basedpyright, we'll look into it!

Aside from the Quarto issue you mentioned, how well does basedpyright currently work in Positron? At the very least, we may be able to iron some of those issues so that users can choose alternative language servers – although it is worth noting that completions would no longer be aware of your session's variables and would not benefit from other Positron-specific language server features in future.

ntluong95 commented 1 day ago

It works well, excepted that in the Outlines, you will see 2 language servers. I think if you can look at their code and cherry-pick the part that help to recognize Python module keywords, and also attach it to Quarto, the problem will be solved. Just my naive idea

seeM commented 1 day ago

Could you please share a screenshot of the 2 language servers in Outlines?

ntluong95 commented 1 day ago

image

Attached is the screenshot