different languages with different syntaxcheck in same visual studio code file - visual-studio-code

Is it possible to have different syntax highlighting in different sections in the same file in visual studio code?
I mix classic asp, html and js in the same file.
in asp, everything after a single quote is a comment, in js it delimits a string.
Is there some way I can tel vscode that this part is asp, and this part is js?

Related

How can I use a script as a programming language in Visual Studio Code?

Recently I've been working on creating a new coding language with Python. Currently, I'm building the language on Replit, but I would like to switch to Visual Studio Code. I have a script containing the launguage's lexer, parser, etc, and I don't want to write a whole grammar (I'm currently making the language in a different way than most) for the language in order to switch to Visual Studio Code.
Is there a way I can "run" a text file and have Visual Studio Code provide the script for my language with the path to that file, and run it?
If this post isn't specific enough, please advise me on how to fix that.

Auto-suggestion HTML and CSS code without an extension in VS Code

I just installed Visual Studio Code. It works and suggests HTML and stylesheet and JavaScript as well, but what matters is that I didn't install any extension in Visual Studio Code, and it works well without HTML and JavaScript extension.
How does it work without any extension? Do I need to install an extension for this?
To answer it on Low-Level, VS Code is built on top of monaco-editor
As mentioned in its docs, it has below stuffs by default
Rich IntelliSense, Validation TypeScript, JavaScript, CSS, LESS, SCSS,
JSON, HTML
Refer: https://microsoft.github.io/monaco-editor/
Those shortcut features are built with https://emmet.io/
So, for working with basic web stuffs, you don't need an extension.

How to start creating a language extension for VS Code?

Pursuant to the discussion in Add XHTML support, I'd like to start creating an extension for Visual Studio Code which would implement support for XHTML. Which is HTML with XML syntax, so the the desired functionality is already (mostly?) implemented elsewhere – for XML and HTML languages, the latter having two extensions bundled with VS Code: html and html-language features. But it's disparate.
As the first step, should I clone the VS Code repo and delete everything except the two directories named html and html-language features? Or Language services for HTML? Or the latter and html from the former? Or start with html, make it work for XHTML and only then deal with language features?
Should the second step be just adding the extension(s) I'm developing on my computer to my installation of VS Code? The GUI seems to allow adding only extensions from the Visual Studio Marketplace. Is it the right solution to place the extensions under development into VS Code's directory for extensions (either directly or with symbolic links)? I'm on Manjaro Linux.
If you can offer any other helpful advice, I welcome it too.

Dynamic Syntax Highlighting in VSCode

I'm writing an extension for Visual Studio Code which features syntax highlighting for a scripting language. I was able to color many important elements via a TextMate grammar file. There are many lines where I would not know if a captured string refers to a user defined class (for a static call, for instance), or an instance of a class/variable until I perform analysis in code.
Is there a way I can dynamically highlight syntax via code in Visual Studio Code or any alternatives for achieving this?
What you are asking for is semantic coloring. It is not supported as of VS Code 1.35. You could try to emulate it using decorators, but the decorators can easily get out of sync with the rest of the highlighting during editing
This VS Code issue tracks adding semantic coloring to VS Code.

How to I get Visual Studio Code to treat <webscript> the same way it treats <script>?

I’m working on HTML files which contain JavaScript inside <webscript> tags. Can I customize Visual Studio Code so that it treats these tags the same way it treats <script> tags, i.e. with syntax highlighting, etc.?
AFAIK, there is no direct way to customize this in Code. But you could write your own language configuration. A documentation with a sample file can be found at: https://code.visualstudio.com/api/language-extensions/language-configuration-guide
The most easiest way would searching for the default html language configuration copy this file and just edit the regex for script to support webscript, too. Should be this one on GitHub