VS code doesn't underline syntax errors

Hi, this problem has been occuring since I installed and started using vs code for the RPG maker course.

Visual studio code doesn’t underline any syntax errors at all.
Also, I don’t get autocomplete options like ‘position’ when I’m typing e.g. target.position. However, I do get autocomplete options for OnCollisionEnter2D etc.

Here are the things I’ve tried so far to no avail:

  • installing .NET Core SDK onto my laptop. (is there something else I need to do with this for it to work in VS code?)
  • Uninstalling and reinstalling VS code.
  • right clicking and selecting ‘open C# project’ when opening my C# script from unity.
  • uninstalling and reinstalling unity snippets extension in VS code.

Any help would be greatly appreciated :slight_smile:
Thanks

Hi Tom,

This solution worked for me, maybe it will work for you too.
In Unity, go to Edit=>Preferences=>External Tools=>Generate all .csproj files

3 Likes

Hi Tom,

In case Michael’s solution did not work for you, please watch lecture “Fixing Visual Studio Problems” (currently #7). There are a few more things you could try.


See also:

1 Like

Hi, thanks for the reply.

This is all I can see on the external tools page. I don’t see an option for generate .csproj files.

I’m using unity version 2018.4.28 because that’s the closest version to 2018.3 that I could find. I’m using this version because that’s the one rick is using for the course and recommended that we use the same version.

Well in that case, you can try watching the lecture Nina suggested.
By the way, what is that “code.cmd” script editor you have selected? Is that how Unity recognizes VS Code in 2018 or have you selected the actual command prompt that comes with VS Code?

If you use VS Code, read this introduction and check if you installed the required extensions.

According to that website, the file is code.exe. Maybe code.cmd causing the problem in your case.

Thanks guys, this problem is solved!

Michael I think you were right about the code.cmd that I had selected as the script editor for unity. I don’t know how I managed that before, but I changed it by clicking browse and finding visual studio code in my file explorer.

That didn’t actually fix it but it did cause an error message to appear in visual studio code:

So I think there was a problem with loading the project in VScode. So I tried opening the script from unity by right clicking and selecting ‘open C# project’, and low and behold, I started getting red squiggly lines underneath my syntax errors. It also solved my problem with the autocomplete suggestions.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms