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

Fix embedding in new YAML grammar #28

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

RedCMD
Copy link
Contributor

@RedCMD RedCMD commented Aug 17, 2024

VSCode is adopting a new YAML grammar
microsoft/vscode#224978

Injecting into nested block maps doesn't work fully anymore
this is because the new grammar captures the prefixing whitespace, disallowing this injection to capture the newline ^

Workaround is to change ^ to (^|\\G)
https://github.com/harrydowning/yaml-embedded-languages/blob/c8478003b71af928fae1496b9600c32bab9fe18e/extension.js#L171

image

image image

@harrydowning
Copy link
Owner

I haven't been able to replicate your nested test example. Is there anything specific that needs to be done? Here's my version of VS Code

Version: 1.92.2
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0

@RedCMD
Copy link
Contributor Author

RedCMD commented Aug 17, 2024

VSCode temporarily reverted it in 1.92.1 microsoft/vscode#224862 (comment)
1.92.0 had the new grammar
or you can install the grammar directly https://marketplace.visualstudio.com/items?itemName=RedCMD.yaml-syntax

@harrydowning
Copy link
Owner

harrydowning commented Aug 17, 2024

Hmm strange, even after installing your extension directly I haven't been able to reproduce it. Is there any difference between the grammar released by VS Code and your extension? Also I've noticed we seem to lose bracket pair colorization. Do you know why this might be? If this is the new grammar could you look to add this back at some point? It's nice to have someone looking to actively maintain the YAML grammar, so thanks.

@RedCMD
Copy link
Contributor Author

RedCMD commented Aug 17, 2024

Also I've noticed we seem to lose bracket pair colorization

That is caused by 3 different issues

  • I had removed parenthesis (, ) from bracket pairs in YAML. Because YAML has no () brackets.
  • I had disabled all bracket matching within meta.scalar.yaml.
    I've fixed it now, {} and [] will match highlight now. (pre-release version)
  • js is not a language; in your package.json. Fixing this will readd ()

Could you send a screenshot of the code with editor.action.inspectTMScopes enabled please

nested:
  test: | #js
    console.log("hello world")

image

@harrydowning
Copy link
Owner

Thanks, I've fixed this on my end in #29. I have downloaded the old version of VS code (1.92.0) and again can't reproduce.

image

I'm interesting in you're following statement which sounds like it could potentially fix #13

this is because the new grammar captures the prefixing whitespace

Full version:

Version: 1.92.0
Commit: b1c0a14de1414fcdaa400695b4db1c0799bc3124
Date: 2024-07-31T23:26:45.634Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0

@RedCMD
Copy link
Contributor Author

RedCMD commented Aug 18, 2024

do you have another YAML extension installed? RedHats?

I'm interesting in you're following statement which sounds like it could potentially fix #13

my extension does partially fix it
image
but only if there is sufficient nesting for the current indentation
image

@harrydowning
Copy link
Owner

harrydowning commented Aug 19, 2024

do you have another YAML extension installed? RedHats?

Ah yeah, that could be it

@RedCMD
Copy link
Contributor Author

RedCMD commented Aug 19, 2024

early September if they decide to re-add it

how does it break with the old grammar?

sorry didn't mean to close it

@RedCMD RedCMD closed this Aug 19, 2024
@harrydowning harrydowning merged commit 005064b into harrydowning:master Aug 19, 2024
@harrydowning
Copy link
Owner

early September if they decide to read it

how does it break the old grammar

Sorry, I just tested this and it doesn't. Merged now

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

Successfully merging this pull request may close these issues.

2 participants