How can I underline whitespaces in VS Code using textMateRules? - visual-studio-code

I am using VS Code and would like to have markdown headings displayed underlined in the source code. I have added the following configuration:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"markup.heading.markdown",
],
"settings": {
"foreground": "#C0C3CA",
"fontStyle": "underline",
}
},
],
}
This basically works. The spaces in between the words however are not underlined, see this screenshot:
Is there a possibility to have these underlined as well?
According to the scope inspector the spaces also have the markup.heading.markdown scope, just like the words. So I don't see why they do not get underlined.
Any ideas?

It conflicts with "editor.renderWhitespace": "all" setting.
You can find out more a about why it happens on GitHub:
https://github.com/microsoft/vscode/issues/49462
https://github.com/eclipse/che-che4z-lsp-for-hlasm/issues/6

Related

VS Code custom color theme identifies, but does not render selected token color

I am using TextMate rules to try and write a custom VSC Rust color theme that's not quite as busy as the default one, following this explanation in the docs.
For a token without semantic information, the VSC scope inspector correctly reports the color I selected (#FF0000 in the screenshot), but does not render it. Am I misunderstandings how this feature works?
My minimal settings.json snippet looks like this:
"editor.tokenColorCustomizations": {
"[Default Dark+]": {
"textMateRules": [
{
"scope": "punctuation.brackets.curly.rust",
"settings": {
"foreground": "#FF0000"
}
}
]
}
},
"editor.semanticHighlighting.enabled": false
VSC v1.71.2, rust-analyzer v0.3.1221

Disable VSCode ESLint warnings, but keep formatting functionality

I am using VSCode's ESLint extension to fix and format my TS code. I would like to remove all the warnings (such as red underlines) from ESLint, because I find them really annoying and distracting.
Using the config
"eslint.enable": true,
removes all warnings, but also disables the formatting.
In VS Code settings you can define an entry called "eslint.rules.customizations" and provide an array of rules with a severity setting set to "off".
{
"eslint.rules.customizations": [
{ "rule": "<rule-name>", "severity": "off" }
],
}
For example, if you are trying to remove the red (error) or yellow (warn) squigglies for the rules "react/jsx-curly-brace-presence" and "prettier/prettier" you can configure the following:
{
"eslint.rules.customizations": [
{ "rule": "prettier/prettier", "severity": "off" },
{ "rule": "react/jsx-curly-brace-presence", "severity": "off" }
]
}

Extending an existing VSCode syntax highlighter with new elements

I am working on a new flavor of Markdown that introduces some new syntactical elements. I have manually modified the markdown.tmLanguage.json file bundled with VSCode to implement some syntax highlighting for them. I would now like to create a VSCode extension that provides the new additions to Markdown's syntax highlighting.
However, I do not really think that copy-pasting the original Markdown syntax highlighting logic just to add a few things on top is a good idea -- is there a way to create a .json syntax highlighting file that inherits (for lack of a better word) the existing syntax highlighting from another file?
For example, here's some pseudocode:
{
"version": "1.0.0",
"name": "My Markdown Flavor",
"extends": "markdown.tmLanguage.json", // <- PSEUDOCODE
"repository": { "... insert my extensions here ..." }
}
Is that possible? Or do I have to copy-paste the entire markdown.tmLanguage.json file?
I figured it out -- it is sufficient to include text.html.markdown as the last pattern:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Majsdown",
"patterns": [
{
"include": "#majsdown_inject_expression"
},
{
"include": "#majsdown_execute_statement"
},
{
"include": "text.html.markdown"
}
],
// ...

Why is VSCode latex snippet not working (// character)?

I want to have create the following snippets:
"fraction": {
"prefix": ["//"],
"body": [
"\\frac{$1}{$2}",
],
"description": "Fraction"
},
I have many snippets in my latex.json file and all seem to work fine but this one doesn't, any idea why this could be the case?

How to color parameters in VScode in the declaration method and the body

I can not make see that the parameters of the methods are of a certain color in the body too.
Any help will be appreciated.
Try:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "variable.parameter.ts, variable.other.object.ts",
"settings": {
"foreground":"#f00"
}
}
]
}
If you examine your variables with the palette command Developer: Inspect TM Scopes you will see that both of your instances are variables but so are many other things. You can narrow down your scope with the two scopes I used above to achieve what you want.
This works fine in the function declaration:
Press ctrl+comma
from the top right menu, click on curly braces. (settings.json file)
Add the following settings:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "variable.parameter",
"settings": {
"fontStyle": "",
"foreground":"#413f39"
}
}
]
}
There are two conditions for successful coloring:
The language must support semantic parsing.
The current theme must contains
"semanticHighlighting": true