5 ms·
VSCode extension for syntax highlighting multi-line YAML strings
- mdaniel 1y agoI don't understand why VSCode itself doesn't already have this, since it is silly to have to install 100 extensions to add this behavior to every different possible place that a string literal with an interior language could appear I also suspect that unlike the JetBrains feature that does this (Language Injection), VSCode doesn't understand the code it just syntax highlights it. Meaning if we take the cited example and change it to the following, would VSCode turn it red? example3: | # js console.ogl('wat")
- 9dev 1y agoOh neat! Finally VS Code can do something IntelliJ has been able to do since decades. We’re so close to discovering why IDEs were a good idea in the first place!
- IshKebab 1y agoVSCode is an IDE. It's just a highly modular one, so it doesn't come with everything by default.
- mdaniel 1y agoI believe the splitting of hairs is that plugins should build on top of core, solid, helpful primitives, and augment the core platform with esoteric things that the core audience wouldn't care about. That's not this plugin It also pragmatically makes for fragmentation in the experience, leading to the same outcome as the current LLM debate: "works great" "not for me"
- IshKebab 1y ago> augment the core platform with esoteric things that the core audience wouldn't care about. That's not this plugin Seems like it is to me. Storing code inside yaml is pretty obviously a terrible idea and I haven't seen many systems do it (beyond Bash at least).
- 9dev 1y agoThat is not an argument. The same implementation could be used to highlight SQL queries in arbitrary code, for example. What you want is the general ability to have regions of nested code in a file that use a different language than the rest of the file.
- IshKebab 1y agoVSCode does support that. It's up to language extension authors to implement it though because obviously only they know which bit of text is in which language. I don't think SQL queries in code is a very big use case and even there, any that are large enough to need syntax highlighting are probably better off in a separate file. The biggest use case of multi-language files I've seen is Vue single file components, but in practice they turned out to be a terrible idea precisely because of tooling issues like this.
- 9dev 1y ago> VSCode does support that. It's up to language extension authors to implement it though because obviously only they know which bit of text is in which language. Wrong, proper tooling can infer that intelligently, or by having the user annotate it with a comment (e.g. #language=bash). > I don't think SQL queries in code is a very big use case […] You seem to have very little exposure to mature codebases, then. Embedded SQL without an ORM is widespread, still. You'll also find plenty of advocates on this very forum. > […] and even there, any that are large enough to need syntax highlighting are probably better off in a separate file. That isn't up to the tool author to decide. > The biggest use case of multi-language files I've seen is Vue single file components, […] …and HTML files, YAML config for CI pipelines, database migration scripts, DevOps configuration files, Postgres extensions, … > but in practice they turned out to be a terrible idea precisely because of tooling issues like this. > The Vue ecosystem is very well and alive; also, proper tooling is very capable of solving issues like this.
- xigoi 1y agoWhy an IDE? Vim can do such things just fine.
- 9dev 1y agoBecause I prefer an interface that isn't constrained to 70 year old typewriter conventions, thank you very much.
- xigoi 1y agoI don’t know what you’re talking about, but I prefer a tool that I can customize to my liking instead of being told by a random corporation how I should like it.
- homebrewer 1y agoYou can, IDEA is very flexible. My setup looks nothing like most screenshots out there on the 'net, and is heavily scripted to easily solve common tasks in one or two key presses.
- IshKebab 1y agoI pity whoever needs this.
- imcritic 1y agoWho (and in which valid cases) embeds some block of code in a programming language as a value to some key in a YAML file??
- nothrabannosir 1y agoGitHub actions
- conception 1y agoRoo code too