'Problem with kv file in visual studio code

I'm trying to setup Visual Studio Code for python and everything is good except Kivy.

I have simple code

import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.widget import Widget


class MyGrid(Widget):
    pass


class MyApp(App):
    def build(self):
        return MyGrid()


if __name__ == "__main__":
    MyApp().run()

and simple kivy file

    #:kivy
<MyGrid>:
    GridLayout:
        cols:1
        size: root.width, root.height

        GridLayout:
            cols:2

            Label:
                text: "Name: "

            TextInput:
                multinline:False

            Label:
                text: "Email: "

            TextInput:
                multiline:False

        Button:
            text:"Submit"

And when I'm trying to run python file I got

kivy.lang.parser.ParserException: Parser: File "c:\Users\Paweł\Documents\projects vscode\WeatherProject\my.kv", line 1: 1:#:kivy 2:: 3:GridLayout: Unknown directive

Google isn't helpful at all. Please tell me what should I do.



Solution 1:[1]

Maybe it should fix it!

MyGrid:

  <MyGrid>:
      GridLayout:
          cols:1
          size: root.width, root.height

          GridLayout:
              cols:2

              Label:
                  text: "Name: "

              TextInput:
                  multinline:False

              Label:
                  text: "Email: "

              TextInput:
                  multiline:False

          Button:
              text:"Submit"

Solution 2:[2]

Solution from the OPs comment: I haven't saved the file after editing :)

Solution 3:[3]

remove the indent from GridLayout:

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 pvcodes
Solution 2
Solution 3 Yatharth