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 not working (and all associated functionalities) #5910

Open
SPSFClarivate opened this issue Oct 22, 2024 · 11 comments
Open

Comments

@SPSFClarivate
Copy link

Summary

When trying to Ctrl click, or use the Go to definition in VSC, it doesn't work. When doing the mouse hover, I got a: "!Unresolved!"

Steps To Reproduce:

  1. Open VSC
  2. Open any classes, and wait. Click on Go to definition

Expected result

The distant class should open

Actual result

Nothing happens

Additional information

2024-10-22_7-27-34

Salesforce Extension Version in VS Code:

v62.0.0

Salesforce CLI Version:
@salesforce/cli/2.62.6 win32-x64 node-v20.17.0

OS and version:
Windows 10

VS Code version:
1.94.2

Most recent version of the extensions where this was working:
My colleague on macbook for the same project.

@svc-idee-bot
Copy link
Collaborator

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@mingxuanzhangsfdx
Copy link
Member

Hi @SPSFClarivate , I would like to know what kind of errors you might have -

  1. Could you please confirm that the cli integration and apex extensions have been activated? You can check it out from the command palette Developer: Show Running Extensions.
  2. Please toggle your developer tools and see if there is any error message.
  3. Is there any error in the output panel of Apex Language Server?

@SPSFClarivate
Copy link
Author

SPSFClarivate commented Oct 23, 2024

Hello @mingxuanzhangsfdx,

  1. I can confirm that the extensions are all running:

2024-10-23_8-35-34

  1. Found it:

2024-10-23_8-43-31
The error with the local language value is repeated a lot. And then there is one error about grammar. But otherwise nothing else.

  1. This is the output in the output panel of Apex Language server:
    8:34:41.885 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types. 08:34:41.907 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in Apex types. 08:34:41.922 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Collecting built-in standard types from jar 08:34:43.344 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Done collecting built-in standard types from jar 08:34:43.344 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning Apex Standard Library. 08:34:43.537 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Done scanning Apex Standard Library. 08:34:43.537 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Starting ApexIndexer. 08:34:43.552 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Start indexer. 08:34:43.562 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types. 08:34:43.562 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning workspace source. 08:34:44.563 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Building change list. 08:34:45.095 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: No indexing changes found 08:34:45.179 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: StandardObjects: 711 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: CustomObjects: 251 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: ApexFiles: 2067 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: ErrorFiles: 0 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Total Memory (MB): 508 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Used Memory (MB): 186 08:34:45.184 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types took 1547 ms. 08:34:45.184 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types took 3298 ms. Oct 23, 2024 8:34:45 AM apex.jorje.parser.impl.BaseApexLexer dedupe INFO: Deduped array ApexLexer.DFA22_transition. Found 7075545 shorts which is 13MB not including array overhead. Removed 6418975 shorts which is 12MB not counting array overhead. Took 9 ms. Oct 23, 2024 8:34:48 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation WARNING: Unmatched cancel notification for request id 4

@mingxuanzhangsfdx
Copy link
Member

@SPSFClarivate Thanks for the reply.

Could you try deleting all folders under .sfdx/tools in your project and re-open the project with VS Code? This will make the apex language server re-index the whole project.

@SPSFClarivate
Copy link
Author

Hello, I already did many many times and nothing changed.

Thanks :)

@mingxuanzhangsfdx
Copy link
Member

@SPSFClarivate Thanks for your reply. Do you get a chance to recall for how long you have been in this issue? Does it work if you downgrade the version of Apex extension?

From your screenshot, you are referring to the class implemented by you. I am wondering if the !Unresolved! error happens to all the local classes from you. Also, please let me know if classes from the standard apex library works fine with you, such as System.debug(o);.

From the output info you shared, I do not see any outstanding error. Could you go to the setting page of VSCode, and set 'verbose' for apex.trace.server? You can ask your colleague to do so with you and compare the difference of the output of Apex Language Server around that specific unresolved class. Please let me know the difference.

@SPSFClarivate
Copy link
Author

Hello,

I had this issue for a long time, and I thought everyone was affected by this, but then my colleague showed me on his mac.
However I have another colleague on windows machine, and it doesn't work as well.

Here is the trace when I try to go to definition against line 541 of Data.cls. Which should open the method definition "ValidateCRUDFLS" as I click on the method, within the class Query.cls:

`[Trace - 8:45:10 AM] Sending request 'textDocument/codeAction - (19)'.
Params: {
"textDocument": {
"uri": "file:///force-app/main/crud-lib/classes/Data.cls"
},
"range": {
"start": {
"line": 540,
"character": 15
},
"end": {
"line": 540,
"character": 15
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}

[Trace - 8:45:10 AM] Received notification 'telemetry/event'.
Params: {
"properties": {
"Feature": "CodeAction",
"Exception": "None"
},
"measures": {
"ExecutionTime": 1
}
}

[Trace - 8:45:10 AM] Received response 'textDocument/codeAction - (19)' in 4ms.
Result: []

[Trace - 8:45:10 AM] Sending request 'textDocument/definition - (20)'.
Params: {
"textDocument": {
"uri": "file:///force-app/main/crud-lib/classes/Data.cls"
},
"position": {
"line": 540,
"character": 15
}
}

[Trace - 8:45:10 AM] Received notification 'telemetry/event'.
Params: {
"properties": {
"Feature": "Definition",
"Exception": "None"
},
"measures": {
"ExecutionTime": 1
}
}

[Trace - 8:45:10 AM] Received response 'textDocument/definition - (20)' in 4ms.
Result: []

[Trace - 8:45:11 AM] Sending request 'textDocument/codeLens - (21)'.
Params: {
"textDocument": {
"uri": "file:///force-app/main/crud-lib/classes/Data.cls"
}
}

[Trace - 8:45:11 AM] Received notification 'telemetry/event'.
Params: {
"properties": {
"Feature": "CodeLens",
"Exception": "None"
},
"measures": {
"ExecutionTime": 0
}
}

[Trace - 8:45:11 AM] Received response 'textDocument/codeLens - (21)' in 2ms.
Result: []

`

And now the starting trace:
`[Trace - 8:50:00 AM] Sending request 'initialize - (0)'.
Params: {
"processId": 18828,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.94.2"
},
"locale": "en",
"rootPath": "projectpath",
"rootUri": "file:///projectpath",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"configuration": true,
"didChangeWatchedFiles": {
"dynamicRegistration": true,
"relativePatternSupport": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"location.range"
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
},
"inlineValue": {
"refreshSupport": true
},
"inlayHint": {
"refreshSupport": true
},
"diagnostics": {
"refreshSupport": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
},
"labelDetailsSupport": true
},
"insertTextMode": 2,
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true,
"foldingRangeKind": {
"valueSet": [
"comment",
"imports",
"region"
]
},
"foldingRange": {
"collapsedText": false
}
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator",
"decorator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"serverCancelSupport": true,
"augmentsSyntaxTokens": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"typeHierarchy": {
"dynamicRegistration": true
},
"inlineValue": {
"dynamicRegistration": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": false
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"staleRequestSupport": {
"cancel": true,
"retryOnContentModified": [
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/range",
"textDocument/semanticTokens/full/delta"
]
},
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
},
"positionEncodings": [
"utf-16"
]
},
"notebookDocument": {
"synchronization": {
"dynamicRegistration": true,
"executionSummarySupport": true
}
}
},
"initializationOptions": {
"enableEmbeddedSoqlCompletion": true,
"enableSynchronizedInitJobs": true
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///projectpath",
"name": "projectname"
}
]
}

08:50:02.716 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types.
08:50:02.755 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in Apex types.
08:50:02.757 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Collecting built-in standard types from jar
08:50:03.674 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Done collecting built-in standard types from jar
08:50:03.674 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning Apex Standard Library.
08:50:03.787 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Done scanning Apex Standard Library.
08:50:03.788 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Starting ApexIndexer.
08:50:03.789 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Start indexer.
08:50:03.794 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types.
08:50:03.794 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning workspace source.
08:50:04.348 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Building change list.
08:50:04.752 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Applying found changes
08:50:04.754 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Creating 962 Apex artifacts in Apex DB
Oct 25, 2024 8:50:05 AM apex.jorje.parser.impl.BaseApexLexer dedupe
INFO: Deduped array ApexLexer.DFA22_transition. Found 7075545 shorts which is 13MB not including array overhead. Removed 6418975 shorts which is 12MB not counting array overhead. Took 5 ms.
`

And it is working onto Salesforce code on my machine, so System.debug, does open the System class.

I will compare with him today :)

@SPSFClarivate
Copy link
Author

Hello please don't close this one, I won't be able to answer for a week, holidays, but I will be back :)

Thanks for your help

@mingxuanzhangsfdx
Copy link
Member

@SPSFClarivate Since the issue is reproducible on both you and your colleague's windows computer, would you like to try to provide me an example project where the issue happens to both you and your colleague? This is the best way for us to figure our the root cause.

Copy link

github-actions bot commented Nov 8, 2024

This issue has not received a response in 3 days. It will auto-close in 2 days unless a response is posted.

@github-actions github-actions bot added the stale label Nov 8, 2024
@SPSFClarivate
Copy link
Author

Hello @mingxuanzhangsfdx, I created a project a small project with only 2 cls classes and it worked. I will be on holidays for 2 weeks again, but I will compare the properties of the projects. I believe they will be very similar or the same. The only main difference is that we have a huge code base on our product.
I have already extended Java memory settings, and looked at the whole settings in VSC.
I provide more feedback around 26 of Nov.

Thanks

@github-actions github-actions bot added stale and removed stale labels Nov 9, 2024
@daphne-sfdc daphne-sfdc removed the stale label Nov 12, 2024
@forcedotcom forcedotcom deleted a comment from github-actions bot Nov 12, 2024
@github-actions github-actions bot added the stale label Nov 16, 2024
@forcedotcom forcedotcom deleted a comment from github-actions bot Nov 16, 2024
@daphne-sfdc daphne-sfdc removed the stale label Nov 16, 2024
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

4 participants