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

VF Language Server - textDocument/documentHighlight failed #5593

Open
humairazaman-devsinc opened this issue May 10, 2024 · 9 comments
Open

Comments

@humairazaman-devsinc
Copy link

humairazaman-devsinc commented May 10, 2024

Summary

I have a VisualForce page. It has many tags, including apex tags, html tags and a script tag, and nothing goes wrong. The moment I add a <style> tag, every time I try to format it (and I have a format on save as well as an autosaver, so that happens a lot) I get the Visualforce Language Server error

  Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Debug Failure. False expression.
  Code: -32603 

The error message changes slightly according to unknown circumstances, I have also noticed js_source_text is not defined, but the error code remains the same.

If I comment out the script tag, everything works, and there is no error message.

EDIT: I just realized that Debug Failure. False expression. triggers if I click a line of code within the <script> tags, and the js_source_text is not defined shows up when I attempt to format. Neither shows up if the <style> tag is commented.

Steps To Reproduce:

  1. Have a VisualForce page.
  2. Add a <style> tag.
  3. Attempt to run the formatter.

Expected result

Code is formatted.

Actual result

Code is not formatted, instead, there is an error message in the Visualforce Language Server output.

Additional information

Screen Shot 2024-05-10 at 8 43 01 AM

Salesforce Extension Version in VS Code: v60.12.0

Salesforce CLI Version: v60.12.0

OS and version: Mac v 12.7.4

VS Code version: Version: 1.89.0 (Universal)

Most recent version of the extensions where this was working: It never worked for me.

@daphne-sfdc
Copy link
Contributor

Hi @humairazaman-devsinc, Can we see what other error messages are present? What are the 5 errors in the Problems tab? And what do you see when you run SFDX: Toggle Developer Tools in the command palette?

@humairazaman-devsinc
Copy link
Author

The errors as pertains this page are:
Screen Shot 2024-05-14 at 4 22 12 AM

I am not sure about any other messages, I believe there was at least one other message, but I was not paying attention at the time and I have no idea how to trigger it other than all this only happening after I added the style tag (to reformat the page, I have regularly been commenting out the style tag so it has been well proven to be the source of the problem).

SFDX: Toggle Developer Tools gave a No Matching Commands in the command palette, which offered Developer: Toggle Developer Tools as the closest alternative.

The SLDF extensions I am using are:

  • Salesforce Extension Pack v60.12.0
  • Salesforce Extension Pack (Expanded) v60.12.0

@daphne-sfdc
Copy link
Contributor

Hi @humairazaman-devsinc,

Sorry about the typo - I did mean Developer: Show Developer Tools.

You see this every time you uncomment the style tag, right? If you can consistently reproduce the issue this way, can you please comment and uncomment the style tag again to produce the error a second time? And please send us all the error messages that you see.

@humairazaman-devsinc
Copy link
Author

humairazaman-devsinc commented May 14, 2024

Screen.Recording.2024-05-14.at.9.55.45.AM.online-video-cutter.com.mp4

^ This is what happens on commenting/uncommenting the code, on formatting, on clicking the style line (I forgot to make it absolutely clear, but clicking something other than the style lines doesn't cause trouble) and on opening the dev tools.

I haven't used the dev tools before, so if there was something else you wanted to see, let me know and I'll check that too.

One other problem that I forgot to add was that if you change it and try to deploy it, the Output tab remains stuck on the VF Language Server and wont show the result of the deployment or anything else:

Screen.Recording.2024-05-14.at.10.29.42.AM.mov

@daphne-sfdc
Copy link
Contributor

@humairazaman-devsinc Thank you for your video of the issue. Our team is currently working on an attempt to reproduce this issue. We'll let you know when we have a reproduction and are able to proceed. Thank you for your patience.

Copy link

git2gus bot commented May 15, 2024

This issue has been linked to a new work item: W-15773029

@daphne-sfdc
Copy link
Contributor

Hi @humairazaman-devsinc, Our team has found a reproducer for this error and have identified this to be a bug. We have created a new work item and will prioritize it in our next grooming session.

However, I'm still able to deploy the Visualforce page to my scratch org and see the results of the deployment after seeing the error. Since the error only happens when you format, are you able to deploy if you turn off format on save? If you save without formatting, are you able to deploy the Visualforce page and see the results?

@humairazaman-devsinc
Copy link
Author

humairazaman-devsinc commented May 15, 2024

Yes, I can still deploy even with the error. The Output tab remains stuck on the VF Language Server potentially because every time it tries to move away, another error comes in and deems the VF Language Server the most relevant view. As such, while the deployment happens, it is hard to see the logs for it, unless I preemptively move to a different tab, and even then, sometimes the problem persist for a small while.

Everything actually works fine, even the formatter can be made to work with an outside linter or via commenting and uncommenting the style tag. There is no real blocker, only a major inconvenience.

Thanks for the help, and looking forward to having this fixed whenever it happens.

@fedegiust
Copy link

Any progress on this one? I'm having the same issue on Windows, this issue it seems that is preventing the Prettier formatter to be able to run.

image

image

Prettier is configured for VF pages
image

And the VF pages are not ignored
image

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

3 participants