euclidity / vscode-cucumber

Code snippets to write scenarios faster + Syntax highlight for .feature files
https://marketplace.visualstudio.com/items?itemName=stevejpurves.cucumber
MIT License
25 stars 13 forks source link

syntax highlighting for markdown-embedded gherkin #26

Open danieleades opened 3 years ago

danieleades commented 3 years ago

I'm using yzhang.markdown-all-in-one for previewing markdown files. This works a treat for automagically applying syntax highlighting to both the plain-text and the generated output.

This plugin seems to have some mechanism for picking up installed syntax highlighters based on the tags on markdown code blocks. I usually find that installing an appropriate plugin Just Works (for python, plantuml, Rust, etc.)

Is there some way to register this plugin as a syntax highlighter for these embedded code blocks?

apologies for not providing more detail, i'm really not clear on how this is implemented for other 'languages'. Hoping you'll know more than me

danieleades commented 3 years ago

update: on reboot the syntax highlighting is working in the rendered preview, but no syntax highlighting is present in the plain-text view

danieleades commented 3 years ago

found this - https://github.com/Microsoft/vscode/issues/23055#issuecomment-369475841

dialex commented 3 years ago

Hi there, I'm not sure I understand your expected behaviour. Can you include a couple of screenshots that show what you expected vs what you actually have?

danieleades commented 3 years ago

absolutely. here's a screenshot-

Screenshot 2020-12-04 091605

as you can see, I have syntax highlighting in fenced code blocks for just about every language I use, except for features

dialex commented 3 years ago

Perfect, now it's clear! I would use gherkin instead of feature as the language identifier, because that's the official name of that syntax.

I can't implement that feature right now, but if anyone wants to contribute I'll gladly merge it.

danieleades commented 3 years ago

looks like it just requires an update to package.json, though I don't know how to test the change.

danieleades commented 3 years ago

And... Does it work?

dialex commented 3 years ago

Not yet, still trying (committing directly to master, testing in production, cowboy mode: activated 😬)

dialex commented 3 years ago

It didn't work :( This was my attempt https://github.com/euclidity/vscode-cucumber/pull/28/commits/26380c470873b051522a82e5e4577e7455f5d746

I'll ping https://github.com/mjbvz, maybe he can help spot what's wrong: https://github.com/mjbvz/vscode-fenced-code-block-grammar-injection-example/issues/9

dialex commented 3 years ago

I followed @mjbvz advice and made this change: https://github.com/euclidity/vscode-cucumber/pull/28/commits/86c9ed34ee095e65ef514c556a02b5c3129bf9d6

However it still doesn't work. I'll have to give up. I'll leave the issue and PR opened in case someone else wants to fix it. Sorry :/