Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Go to Definition" and "Peek Definition" not working #653

Closed
maruchymurphy79 opened this issue Oct 3, 2018 · 21 comments
Closed

"Go to Definition" and "Peek Definition" not working #653

maruchymurphy79 opened this issue Oct 3, 2018 · 21 comments

Comments

@maruchymurphy79
Copy link

maruchymurphy79 commented Oct 3, 2018

Summary

"Go to Definition" and "Peek Definition" not working when the method is in a different class or if it is not a static method. I'm opening the issue again due #557 was closed due it was classified as duplicate and related to a null exception issue I'm not getting.

Steps To Reproduce:

  1. Right click on the method you want to see the definition.
  2. Select "Go to Definition" from menu.

Expected result

New class opened with the corresponding method we would like to see the definition.

Actual result

A message is displayed "No definition found for 'Method name'".
sample

Also, I have recently changed to the new manifest structure and still "Go to Definition" and "Peek Definition" are not working.
capture

VS Code Version: 1.27.2
salesforce.salesforcedx-vscode Version: 43.17.0
OS and version: W10
Internal Work Item: W-5501966

@vazexqi
Copy link
Contributor

vazexqi commented Oct 3, 2018

@maruchymurphy79 - Are you able to open a case with support? I would like to request for login-as so that I can get your apex code and try it out.

@maruchymurphy79
Copy link
Author

@vazexqi - Will do it today. Keep in mind we don't use DX, that is why we are taking advantage of the new extension version.

@ntotten
Copy link
Contributor

ntotten commented Oct 3, 2018

@maruchymurphy79 When you say you aren't using "DX", what do you mean by that? If you mean that you aren't using the new source format, then that is the problem. To use VS Code you are required to convert your metadata to the new source format. See: https://github.com/forcedotcom/salesforcedx-vscode/wiki/Migrate-From-Forcecom-IDE-to-Visual-Studio-Code

@maruchymurphy79
Copy link
Author

@ntotten That is exactly what I meant. We don't use DX but we are using the new source format. So far is working good except for the issue I mentioned here. Thanks.

@maruchymurphy79
Copy link
Author

@vazexqi I have opened the support case (Case# 20359687). Thanks for your help and support.

@ntotten
Copy link
Contributor

ntotten commented Oct 3, 2018

Perfect, we’ll take a look. Thanks for clarifying!

@allileong
Copy link
Contributor

Hi @maruchymurphy79, I am currently looking into this issue and was wondering, are you still seeing this problem in your VS Code extensions? I saw that the case that you opened with support has been closed, but it was unclear to me whether or not it was closed because you are no longer experiencing the problem. Thanks!

@cadencereplies
Copy link

cadencereplies commented Feb 21, 2019

I'm experiencing this same issue and curious what the result of this was. @maruchymurphy79 ?

@maruchymurphy79
Copy link
Author

@allileong @JJtorrent The ticket was closed as "Known Issue". It hasn't fixed yet. It works for some methods and classes but it continue failing sometimes.

@praksb
Copy link
Contributor

praksb commented Feb 22, 2019

@JJtorrent @maruchymurphy79 Can you please try enabling the apex semantic error in settings and let us know if the member or type or the file in which you are invoking Go-to-Def has any semantic errors are not? You need to set the following in your VS Code settings:
"salesforcedx-vscode-apex.enable-semantic-errors": true,

This would help us to debug the issue further. Sometimes, semantic errors present in the code may result in type or member not binding to the definition.

@cadencereplies
Copy link

cadencereplies commented Feb 25, 2019

@praksb, I added the setting you mentioned into settings.json file of my project:

{
    "terminal.integrated.env.osx": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    },
    "terminal.integrated.env.linux": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    },
    "terminal.integrated.env.windows": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    },
    "eslint.nodePath": "/Users/Jonathan/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-45.3.0/node_modules",
    "html.suggest.angular1": false,
    "html.suggest.ionic": false,
    "salesforcedx-vscode-core.show-cli-success-msg": false,
    "salesforcedx-vscode-apex.enable-semantic-errors": true,
    "eslint.enable": true
}

I'm still not getting any semantic warnings or errors in the Apex Language Service console messages after restarting VS Code and opening/editing/saving/deploying a Lightning component's JS controller. If it matters, this particular project is a manifest type.

ALS log:

09:13:07.015 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types.
Feb 25, 2019 9:13:07 AM apex.jorje.parser.impl.BaseApexLexer dedupe
INFO: Deduped array ApexLexer.DFA22_transition. Found 7272051 shorts which is 13MB not including array overhead. Removed 6615472 shorts which is 12MB not counting array overhead. Took 14 ms.
09:13:10.460 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Patching standard library for System.Database.* methods
09:13:10.468 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Done patching standard library for System.Database.* methods
09:13:11.835 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - Scanning user-defined types.
09:13:11.835 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types took 4821 ms.
09:13:18.604 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - Scanning user-defined types took 6768 ms.

Now that the semantic errors flag it set, I'm getting weird warnings in other classes for totally standard stuff... for instance it says that CaseShare is an invalid type, and I'm getting Variable does not exist warnings about standard fields dereferenced on an object... ??

@praksb
Copy link
Contributor

praksb commented Feb 26, 2019

@JJtorrent When you enable this setting "salesforcedx-vscode-apex.enable-semantic-errors": true you would start seeing errors in the "Problems" pane. Squigglies will also start showing up in your editor under the parts of code where there is a semantic error and the error will show up when you hover over the squigglied text. You will NOT see these errors show up in the console messages.

These errors are not enabled by default because they are not always accurate since they work based on the types you have locally on your machine and not all types may be available for the compiler to successfully bind. This is the reason you are seeing CaseShare show up as an invalid type. You could fix this by downloading the SObject types by running the "SFDX: Refresh SObject Definitions" command from the "Command Palette" in VS Code.

Doing the above mentioned SObject refresh would fix some of the problems you are seeing with respect to "Go to definition" not working since now the compiler should be able to bind successfully many of symbols that is necessary for the feature to work successfully.

@cadencereplies
Copy link

cadencereplies commented Feb 26, 2019

@praksb
Refreshing the SObject definitions has not cleared up the type warnings under the Problems pane or the missing Go To Definitions. Here are some curious examples in the Problems:

  • Invalid type: CaseShare
  • Variable does not exist: System (i.e. System.debug statements)
  • Variable does not exist: LoggingLevel

Perhaps I am missing some other settings? I'm curious if this is a problem localized to Manifest-type projects (which I am working in presently).

@praksb
Copy link
Contributor

praksb commented Feb 26, 2019

@JJtorrent Did the operation to refresh SObject definitions succeed? A successful refresh should have something log lines which look like these in the output window:

10:23:00.464 sfdx sobject definitions refresh
Fetched 434 Standard sObjects from default org
Fetched 6 Custom sObjects from default org
10:23:54.935 sfdx sobject definitions refresh ended with exit code 0

Also, can you clarify what manifest-type project means? Are you following the "Org based development model"? If so, did you authorize an org?
https://forcedotcom.github.io/salesforcedx-vscode/articles/user-guide/org-development-model

@cadencereplies
Copy link

@praksb
Yes, I am using the org-based development model via Create Project with Manifest.
Yes, here is the Output panel from SObject Refresh:

Starting SFDX: Refresh SObject Definitions

12:53:09.142 sfdx sobject definitions refresh
Fetched 549 Standard sObjects from default org
Fetched 43 Custom sObjects from default org
12:53:41.919 sfdx sobject definitions refresh ended with exit code 0

@praksb
Copy link
Contributor

praksb commented Feb 26, 2019

@JJtorrent I am out of ideas to debug on this thread. I would love to understand more on why it is not working for you. Do you mind if I setup a meeting over google hangout where you can share your screen? That would help me understand your project setup and try out a few things. Do let me know if that works for you and your availability for the meeting and I can send a meeting invite over email with the link to google hangout.

Thanks!

@cadencereplies
Copy link

@praksb, my apologies for the delay. I will have time next week in the mid-mornings, if you'd still like to look at the project setup.

@praksb
Copy link
Contributor

praksb commented Mar 15, 2019

@JJtorrent Great. Let me send you an email.

@wfresch
Copy link

wfresch commented Apr 25, 2019

How's this coming along?

@praksb
Copy link
Contributor

praksb commented Apr 25, 2019

@wfresch what specific issue are you running into? Is it: #1166 ?

@no-response
Copy link

no-response bot commented May 2, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants