Why doesn't Visual Studio Code highlight my object's methods?

2.5k Views Asked by At

I have this question, a simple code for example

#Clase de Herencias "
# "
from colorama import *

class vehiculos():
    def __init__(self, marca, modelo): 
    self.marca = marca
    self.modelo = modelo
    self.enmarcha = False
    self.acelera = False
    self.frena = False

def arrancar(self):
    self.enmarcha = True

def acelerar(self):
    self.acelera = True

def frenar(self):
    self.frena = True

def estado (self):
    print ('Marca: ', self.marca, '\nModelo: ', self.modelo,'\nEn Marcha: ', self.enmarcha, '\nAcelera: ', self.acelera, '\nFrena: ', self.frena)


class Moto(vehiculos):
    hcaballito= ''
    
    def caballito(self):
    self.hcaballito ='Haciendo caballito!'

def estado(self):
    print ('Marca: ', self.marca, '\nModelo: ', self.modelo,'\nEn Marcha: ', self.enmarcha, '\nAcelera: ', self.acelera, '\nFrena: ', self.frena, '\nEstado del caballito:', self.hcaballito )

    

#Creando una instancia en esta clase

motor_1 = Moto('BMW', 'SP1')

motor_1.caballito()
motor_1.caballito()

the code works good! but the editor don't highlight the methods when I call them outside of the class definition.

VSCode screenshot

Editors like Sublime Text do highlight the method name

Sublime Text Screenshot

2

There are 2 best solutions below

0
On

Extension Material Theme Kit can help you. Turn to extension marketplace, search and install it, you will observe the result that the function is hightlighted: enter image description here

0
On

This extension can help.

here are syntax highlighting for:

"Events" "Fields" "Fields (Constant)" "Fields (Inside Enums)" "Local Variables" "Methods" "Methods (Extension)" "Methods (Static)" "Namespaces" "Parameters" and "Properties"

for more https://marketplace.visualstudio.com/items?itemName=StanislavKuzmichArtStea1th.EnhancedSyntaxHighlighting .