Search Unity

QUESTION: VSCode IntelliSense not working

Discussion in 'Editor & General Support' started by TheLinuxPirate, Jun 25, 2022.

  1. TheLinuxPirate

    TheLinuxPirate

    Joined:
    Jan 8, 2022
    Posts:
    3
    I'm on Linux in case that differs the settings but I was going to test a script when I noticed that the "IntelliSense" was not working in VSCode, I saw other forms that made me go into prefrencenses -> Editor -> and select VSCode from there but that hasn't seemed to do anything, (unless I need to reboot?)

    My version of VSCode: https://aur.archlinux.org/packages/visual-studio-code-bin

    .NET Version: 6.0.102
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Not sure how much applies to your OS, but here's my
    #include <stdblurb.h>
    file:

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874
     
    TheLinuxPirate likes this.
  3. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,065
    Check omnisharp-vscode for latest setup requirements.

    Right now, for v1.25.0 from 21 May 2022, you need to:
    • Install a recent version of mono (current stable is 6.12.0.182 but 6.12.0.174 also worked for me)
    • Set
      omnisharp.useModernNet
      to
      false
      in VSCode's settings
    • Restart VScode after making the settings change
     
    TheLinuxPirate likes this.
  4. TheLinuxPirate

    TheLinuxPirate

    Joined:
    Jan 8, 2022
    Posts:
    3
    Thanks for the responses, I got an output in the VSCode terminal and got this error: "
    [warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file '/home/myusername/PROJECTS/My project/Assembly-CSharp.csproj'.
    /home/myusername/PROJECTS/My project/Assembly-CSharp.csproj
    /usr/share/dotnet/sdk/6.0.102/Microsoft.Common.CurrentVersion.targets(1217,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code)." I'm going to have to wait until my Mono package has a new update for 6.12.0.182.
     
  5. TheLinuxPirate

    TheLinuxPirate

    Joined:
    Jan 8, 2022
    Posts:
    3
    Got it fixed, I was able to "Set omnisharp.useModernNet to false in VSCode's settings" and install msbuild, thanks for the help everyone :)
     
  6. Santi_24

    Santi_24

    Joined:
    Jun 27, 2022
    Posts:
    2
    I still can't get it to work, any ideas?
     
  7. Santi_24

    Santi_24

    Joined:
    Jun 27, 2022
    Posts:
    2
    Nvm, my problem was that the vsc insiders executable was named code-insiders, and unity only works with an executable called code, so I created a symbolic link and that solved it
    sudo ln -s /usr/bin/code-insiders /usr/bin/code