Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Functionality for Python Decorators #232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VoxelMC
Copy link

@VoxelMC VoxelMC commented Jul 22, 2023

Hello! I hope you like this contribution! If you want any changes let me know :)

All I did was add some recognition for decorators in Python.

Before:
image

After:
image

@@ -630,6 +630,25 @@
"foreground": "#fb94ff"
}
},
{
"name": "[PYTHON] - Decorator Puncuation",
Copy link
Contributor

@rennsax rennsax Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A spelling error.

Suggested change
"name": "[PYTHON] - Decorator Puncuation",
"name": "[PYTHON] - Decorator Punctuation",

@rennsax
Copy link
Contributor

rennsax commented Jul 25, 2023

Hello @VoxelMC, thanks for your contribution. These days I've struggled to make cobalt2 to be more compatible with Python (I'm new to this language).

I'm glad to find our thoughts coincide. With your commit I find it impossible to highlight builtin function decorators, including @staticmethod, @classmethod and @property (maybe more? I'm not sure). That's because these builtin decorators use different textmate scopes.

Besides, I'm trying to add some Python semantic token (provided by the extension Pylance) supports to the theme recently.

image

@rennsax
Copy link
Contributor

rennsax commented Jul 26, 2023

Hello @VoxelMC,

To deal with the problem I mentioned yesterday, I suggest also adding rules to semanticTokenColors field. Here is an example.

  "semanticTokenColors": {
    // ...
    "*.decorator": {
      "fontStyle": "italic bold" // I prefer bold to underline
    },
  }

image

It looks great for Python. But till now I'm not sure whether this patch would affect other languages.

@VoxelMC
Copy link
Author

VoxelMC commented Jul 27, 2023

Hello @VoxelMC,

To deal with the problem I mentioned yesterday, I suggest also adding rules to semanticTokenColors field. Here is an example.

  "semanticTokenColors": {
    // ...
    "*.decorator": {
      "fontStyle": "italic bold" // I prefer bold to underline
    },
  }

image

It looks great for Python. But till now I'm not sure whether this patch would affect other languages.

Hello @Eitheages, its nice to meet you! I have been busy moving as of late, but I would love to explore this further with you. I like cobalt2 in general and have just started working a lot more in python and I notice a lot of possible semantics improvements. I love the suggestion that you make here, it looks way better than what I proposed.

I will let you know when I get back on this train!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants