2

I am having trouble with navigate the code path by using "Go to definition" / "Peek Preview" for one project. I also don't see any SFDX commands on Command palette. The project has below structure. (I have other trailhead projects where the navigation works perfectly fine)

enter image description here

I only see these commands for SFDX:

When right click and go to definition on a method of a class, I see "No definition found". I tried couple of things:

  1. adding Java path to User Settings.

    "salesforcedx-vscode-apex.java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home"

  2. This did not help me - Navigate to method definition in VSCode

  3. Installed VS Code extention - Salesforce Language Support - https://marketplace.visualstudio.com/items?itemName=chuckjonas.apex-autocomplete , but this did not help. It created .vim-force.com and .vscode files

Note - this is only for this specific project. I think it could be because it is missing some configuration? This project is used to deploy only to sandboxes and not scratch orgs as of now.

Any help is appreciated!

4
  • The SFDC extensions for VSCode have a tendency to work themselves into some pretty odd states (especially the Apex Language Server, which has a bad habit of pegging my CPU). In my experience, completely closing VSCode and then re-opening it seems to get things working again. In other words, have you tried turning it off and then on again?
    – Derek F
    Commented Mar 27, 2020 at 13:28
  • Yes, 3 times. Should I try few more times until it comes up. I have this project for a month now in my VS code but couldn't get the navigation working. Some SFDX commands like Execute Anonymous / execute SOQL queries does not appear in command palette. However I have other project folder created for trailheads which works fine.
    – SfdcBat
    Commented Mar 27, 2020 at 13:31
  • Could this be because .sfdx file is in .gitignore?
    – SfdcBat
    Commented Mar 27, 2020 at 13:37
  • 1
    It works now. I was one folder above the folder that has force-app in it.
    – SfdcBat
    Commented Mar 27, 2020 at 13:44

1 Answer 1

2

I was one folder above the folder that has force-app in it. The folder I hide in the screen shot. By opening the folder that contains force-app resolved the issue.

1
  • What do you mean by 'I was one folder above ...' in vscode integrated terminal? In the Explorer panel? Please be more clear. I'm having the same issue but none of the two that I mentioned helped when I switched them to 'force-app/main/default/classes'. I still get 'No definition found ...'. Thanks!
    – Bahman.A
    Commented Apr 22, 2021 at 22:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .