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

Embedded languages syntax highlighting stopped working in 1.92.0 #224978

Closed
Tracked by #1
staspiter opened this issue Aug 6, 2024 · 17 comments · Fixed by #232244
Closed
Tracked by #1

Embedded languages syntax highlighting stopped working in 1.92.0 #224978

staspiter opened this issue Aug 6, 2024 · 17 comments · Fixed by #232244
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author feature-request Request for new features or functionality grammar Syntax highlighting grammar insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@staspiter
Copy link

staspiter commented Aug 6, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.92.0
  • OS Version: Windows 10, macOS 14 Sonoma

I have been using the following two extensions a lot. Since 1.92.0 update both extensions stopped working meaning the embedded code in JS does not get highlighted inside of YAML anymore. Each extension basically does the same job for me, so I tried to switch from one to another before realizing that my VSCode got an update and this functionality stopped working in both extensions. I've also tried the insiders build and the problem is still there. When I downgraded to 1.91.1, the extensions worked perfectly. This happens on both Windows and Mac.

The extensions are:

  1. Extended Embedded Languages - https://marketplace.visualstudio.com/items?itemName=ruschaaf.extended-embedded-languages
  2. YAML Embedded Languages - https://marketplace.visualstudio.com/items?itemName=harrydowning.yaml-embedded-languages

Steps to reproduce:

  1. Install VSCode 1.92.0 or the insiders build.
  2. Install one of the above extensions.
  3. Create a yaml file with the following content:
test: | #js
  console.log("hello world")
  1. Make sure the js code gets highlighted correctly

This is how it looks like in 1.92.0
image

1.91.1:
image

@mjbvz mjbvz assigned alexr00 and unassigned mjbvz Aug 6, 2024
@mjbvz
Copy link
Collaborator

mjbvz commented Aug 6, 2024

Possibly fixed by #224954

@staspiter
Copy link
Author

Installing this extension https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml helps as a workaround. I guess because it takes over the yaml grammar and completes it with what is expected by other extensions.

@alexr00
Copy link
Member

alexr00 commented Aug 7, 2024

Duplicate of #224862.

Should be fixed by #224954 in the very latest insiders (from d4c4e69) and will be fixed in the upcoming recovery release.

@alexr00 alexr00 closed this as completed Aug 7, 2024
@RedCMD
Copy link
Contributor

RedCMD commented Aug 7, 2024

"block-scalar" was taking precedence over injections because it was consuming the whitespace before it while the embedded language extensions were not

if I remove the ([\t ]*+) part
it starts working
image

but it will still break down when inside a nested block-map
image
this is because the other extensions use ^ instead of (^|\\G)
they will need to fix that part for themselves
Extended Embedded Languages
YAML Embedded Languages

@RedCMD
Copy link
Contributor

RedCMD commented Sep 9, 2024

@alexr00 VSCode needs to pull the latest yaml commits to fix this
RedCMD/YAML-Syntax-Highlighter@71a8871

sorry, I was under the impression the changes had already gone through
but it seems I missed the pull update by a few hours? #224954

@alexr00 alexr00 reopened this Sep 11, 2024
@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release grammar Syntax highlighting grammar labels Sep 11, 2024
@alexr00 alexr00 modified the milestone: August 2024 Recovery 1 Sep 11, 2024
@alexr00 alexr00 removed bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release labels Sep 11, 2024
@alexr00
Copy link
Member

alexr00 commented Sep 11, 2024

Re-using the old candidate here as this is a separate issue: #224862

@RedCMD
Copy link
Contributor

RedCMD commented Sep 11, 2024

separate issue?
#224862 is already fixed tho?

@harrydowning has already pushed a temporary patch to his extension in the meantime harrydowning/vscode-yaml-embedded-languages#45

@alexr00
Copy link
Member

alexr00 commented Sep 12, 2024

I'm seeing #224862 still occur. I guess I can't say for certain whether it's a separate issue since #224862 is still happening.

@ruschaaf
Copy link

I'm the author of the Extended Embedded Language plugin mentioned above. Thank you @RedCMD for the suggestions and patches you've given. I'm seeing a problem now on VSCode 1.93.0 using YAML as an embedded language - e.g. putting yaml inside Python or C++. The issue seems to be the similar to #20488 which I've come across in some other embedded grammars where the embedded grammar captures the end-of-string token before the host can see it, so the embedded language highlighting "leaks" out of its string. In the past I've had to remove potential embedded languages because of this, but YAML is too useful to just remove so I wanted to see if there was a workaround?

image

RedCMD referenced this issue in RedCMD/YAML-Syntax-Highlighter Oct 21, 2024
@RedCMD
Copy link
Contributor

RedCMD commented Oct 22, 2024

@alexr00 alexr00 added this to the November 2024 milestone Oct 22, 2024
@alexr00
Copy link
Member

alexr00 commented Oct 22, 2024

Awesome, I'll try adopting https://github.com/RedCMD/YAML-Syntax-Highlighter again for the November milestone.

@alexr00
Copy link
Member

alexr00 commented Oct 25, 2024

@RedCMD I'm still seeing the original bug:

Image

@alexr00 alexr00 modified the milestones: November 2024, January 2025 Oct 25, 2024
@RedCMD
Copy link
Contributor

RedCMD commented Oct 25, 2024

@alexr00 that is highlighted correctly

from RedHat:
Image

@RedCMD
Copy link
Contributor

RedCMD commented Oct 25, 2024

if you think it is an issue
then a new report should be made

as #224862 has been fixed by me and by the mdx extension

@alexr00
Copy link
Member

alexr00 commented Oct 25, 2024

Thanks @RedCMD, I forgot to install the MDX extension 🤦‍♀️

I've gone through the issues, and they all no longer repro with your changes 🚀

@alexr00
Copy link
Member

alexr00 commented Oct 25, 2024

For using yaml as an embedded language in C++ with Extend Embedded Languages, I see the following:

Image

The yaml scope doesn't escape outside of the string, but it also doesn't get any yaml scopes besides source.yaml.

Image

@alexr00 alexr00 modified the milestones: January 2025, November 2024 Oct 25, 2024
@alexr00 alexr00 added the feature-request Request for new features or functionality label Oct 25, 2024
@alexr00 alexr00 modified the milestones: November 2024, January 2025 Dec 3, 2024
@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Dec 10, 2024
@vs-code-engineering vs-code-engineering bot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Dec 11, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 24, 2025
@alexr00 alexr00 added author-verification-requested Issues potentially verifiable by issue author verification-needed Verification of issue is requested labels Jan 27, 2025
@vs-code-engineering vs-code-engineering bot unlocked this conversation Jan 27, 2025
Copy link

This bug has been fixed in the latest release of VS Code Insiders!

@staspiter, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version a1fc8c1 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

@rzhao271 rzhao271 added the verified Verification succeeded label Jan 28, 2025
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author feature-request Request for new features or functionality grammar Syntax highlighting grammar insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants