I have a file which contains YAML at the top and asciidoc at the bottom. The yaml is surrounded by two lines of ---. The file extension is yaml which is required by the application where it's used.
The only way i know to get a preview out of vscode is to manually rename the file every time i need one and rename it back afterwards.
Is there a way to open the asciidoc preview in vscode while ignoring its extension, e.g. giving a hint, add a configuration or something similar? The docs only describe that
The extension activates automatically when opening an AsciiDoc file (.adoc, .ad, .asc, .asciidoc).
Here's a example file:
---
# yaml here
---
asciidoc here
This is surprisingly simple: https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file
In VS Code, we default the language support for a file based on its filename extension. However, at times you may want to change language modes, to do this click on the language indicator - which is located on the right hand of the Status Bar. This will bring up the Select Language Mode dropdown where you can select another language for the current file.
Tip: You can get the same dropdown by running the Change Language Mode command
(Ctrl+K M)
.