MagicPython
MagicPython copied to clipboard
Ability to colorize imports?
-
Editor name and version: VSCode 1.49.0
-
Platform: Windows 10
-
Color scheme: Dark+
-
MagicPython version: Installed via Python extension v2020.8.108011
-
A sreenshot:
-
5-10 lines of surrounding code:
from django.utils import timezone
from django.views import generic
from .models import Question, Choice
class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'latest_questions'
def get_queryset(self):
return Question.active_objects.all().order_by('-pub_date')[:5]
class DetailView(generic.DetailView):
model = Question
template_name = 'polls/detail.html'
class ResultsView(generic.DetailView):
model = Question
template_name = 'polls/results.html
Just as the above code snippet does, is it possible to colorize class imports in VSCode?
I've tried searching the web for an answer on this topic but couldn't find one; I'm submitting an issue here in hopes of someone either telling me that this is intended but not working, or that this is not supported.
Thanks for any info!
Just as the above code snippet does, is it possible to colorize class imports in VSCode?
No, not really, because syntax highlighter doesn't know if it's a class or just a weirdly named module.
@vpetrovykh Victor, it's weird that GH highlights that though. Maybe they no longer use MP?
Maybe they no longer use MP?
Yeah, it appears they no longer use https://github.com/github/linguist to highlight the source.
That explains the bugs, sigh.
Just as the above code snippet does, is it possible to colorize class imports in VSCode?
No, not really, because syntax highlighter doesn't know if it's a class or just a weirdly named module.
@vpetrovykh Victor, it's weird that GH highlights that though. Maybe they no longer use MP?
Gotcha, thanks for the explanation.
In my project the module naming is fairly consistent where I can guarantee that:
- A lower case import is a function
from x import foo
- A camel case import is a class
from x import FooBar
Is it possible for me to manually colorize these within my theme using the VSCode editor.tokenColorCustomizations
setting?
Thanks!