pythonvisual-studio-coderequirements.txt

Why do my txt files on VScode show up as full of errors?


Screenshot

Whenever I open a new window/project that has a .txt file, it shows up full of errors. In the explorer tab, the file shows up as red and if I open it, each line shows underlined as red.

Did anyone encounter the same issue? If so how can I fix it?

Thanks in advance!

I tried closing VSCode and opening it again. Other than that, I don't know much how to debug this issue.


Solution

  • You have to edit visual code settings for the file extension itself instead of restarting the app. Syntax highlighting is a feature not an issue.

    Instead go to bottom right and select the language used (python would be selected in your case) enter image description here Now when you click it you should have a menu open up to select the interpreter to associate with the file. enter image description here Here you can type in your file type to select one type to associate with your current file only or select configure File assocation for '.txt' to set the language that will be used for this file type every time.

    For your file type requirements.txt the best options are plain text or pip requirements enter image description hereenter image description here