3

I'm working on a simple Node.js project with NextJS in which the Go To Definition doesn't work properly in vscode.

I made a small video with the difference between Visual Studio Code and WebStorm, in which WebStorm, works perfectly out of the box, without any extension installed.

Does someone know why is this not working in the case shown in the video?
Want to mention that other Go To Definition are working ok, eg. for imports or other local variables.

There are the installed extension vscode:

Extensions installed on WSL: Ubuntu:
2gua.rainbow-brackets
aaron-bond.better-comments
alefragnani.Bookmarks
Anjali.clipboard-history
BendixMa.dart-data-class-generator
BriteSnow.vscode-toggle-quotes
christian-kohler.path-intellisense
Dart-Code.dart-code
Dart-Code.flutter
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
deque-systems.vscode-axe-linter
eamodio.gitlens
EditorConfig.EditorConfig
esbenp.prettier-vscode
FelixAngelov.bloc
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
Gruntfuggly.todo-tree
IbrahimCesar.ibrahimcesar-nextjs-developer-pack
jeroen-meijer.pubspec-assist
jpoissonnier.vscode-styled-components
k--kato.intellij-idea-keybindings
leodevbro.blockman
luanpotter.dart-import
MariusAlchimavicius.json-to-ts
meganrogge.template-string-converter
mhutchie.git-graph
mikestead.dotenv
ms-vscode.vscode-typescript-tslint-plugin
naco-siren.gradle-language
naumovs.color-highlight
oderwat.indent-rainbow
Orta.vscode-jest
PKief.material-icon-theme
PulkitGangwar.nextjs-snippets
quicktype.quicktype
rangav.vscode-thunder-client
richie5um2.vscode-sort-json
shardulm94.trailing-spaces
shd101wyy.markdown-preview-enhanced
sleistner.vscode-fileutils
streetsidesoftware.code-spell-checker
VisualStudioExptTeam.vscodeintellicode
surfmuggle
  • 5,527
  • 7
  • 48
  • 77
Philipos D.
  • 2,036
  • 1
  • 26
  • 33

1 Answers1

0

I had a similar problem with .

  • For go-to-definition did not work;
  • the context menu lacks the option go-to-definition.

For the go-to-definition did work as expected (see image below)

vs-code-go-to-definition-java-works

I first did fix Visual Studio Code 1.73.1 trouble - object not defined but problems still remained

Fix go-to-definition for

Omnisharp Wiki - Troubleshooting: 'The .NET Core SDK cannot be located.' errors gave these hints

  1. check the path to dotnet with C:\where.exe dotnet
    • In my case two paths were returned:
    • C:\Program Files\dotnet\dotnet.exe and
    • C:\Program Files (x86)\dotnet\dotnet.exe
  2. check the environment variable path C:\>echo %PATH%
    • In my case i had two entries for both paths above
  3. change the environment variable with C:\SystemPropertiesAdvanced.exe
    • i removed the path to for x86 dotnet.exe

From the Troubleshooting page

In 64-bit environments the .NET SDK will fail to be discovered if the 32-bit dotnet path comes before the 64-bit dotnet path in the Environment PATH variable. Try removing the 32-bit path entirely from your PATH variable and relaunch VS Code to see if your issue is resolved.

Omnisharp settings

I also added the path in the omnisharp settings

Visual Studio Code - Settings for omnisharp set to dotnet path

What did i do to fix it

  1. Removed the environment variable to x86 version
  2. added the path to the omnisharp settings
  3. rebooted the system

What about go-to-definition for or ?

I would recommend to check if you have two versions installed as well and if you can point the extension to the correct version.

surfmuggle
  • 5,527
  • 7
  • 48
  • 77