'How to make Visual Studio Code recognise .kv (Kivy) file type?

Kivy (.kv) files use a similar syntax to Python (.py) files. I would like to use the Ctrl-K / Ctrl-C key sequence to comment out lines of code when editing .kv files, as works in Python files. How could I enable that key sequence for .kv files?



Solution 1:[1]

This is not officially possible, AFAIK. You could check to see if there's already a UserVoice suggestion to upvote, and if not create one.

It does look like VSCode is prepared to offer such features in the future. If you browse to:

C:\Users\YouUserName\AppData\Local\Code\app-0.3.0\resources\app\plugins\vs.language.python

And open the file ticino.plugin.json, then find:

"extensions": [ ".py" ],

and change it to:

"extensions": [ ".py", ".kv" ],

After doing this, and restarting VSCode, the Ctrl+K, Ctrl+C command also works in .kv files.

Note that (a) this is a hack, of which I don't know the side effects, and (b) that you will likely loose this setup after VSCode is updated.

Solution 2:[2]

I'd like to suggest to install the "KvLang" directly from VSCode Marketplace. Maybe it will be another easy way to do it.

Thanks.

Solution 3:[3]

If you will create an text file, it will give you a option 'Select a language';

You can just click on it And - Boom! it will give all languages You can use.

If you want to know more just click ===> https://code.visualstudio.com/docs/languages/overview

Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeroen
Solution 2 Guilherme D. Patriota
Solution 3 myNameisShourya