How to set markdown snippet trigger automatically - visual-studio-code

According to the official document, https://code.visualstudio.com/docs/languages/markdown
Snippets for Markdown
There are several built-in Markdown snippets included in VS Code -
press Ctrl+Space (Trigger Suggest) and you get a context specific list
of suggestions.
Does there any way, trigger snippet automatically when I type word, because it's troublesome, press Ctrl+Space

Try setting:
"[markdown]": {
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
},
},
This enables IntelliSense automatically when you start typing. By default, this will show snippets and word based suggestions (suggestions based on words in the current document). To disable word based suggestions, set:
"[markdown]": {
"editor.quickSuggestions": true,
"editor.wordBasedSuggestions": false
}
You can also set:
"editor.snippetSuggestions": "top"
If you always want snippets to show before word base suggestions

There is an inconsistency in VS Code and it is a known issue. Markdown snippets do not get auto-completion. Probably it will be fixed in next release.
Yes this is an inconsistency. Full extensions get auto (7x24) completion by default (e.g. latex, cake), some built-in extensions like Markdown do not.
https://github.com/Microsoft/vscode/issues/1617#issuecomment-166999086

Related

How to make IntelliSense in Python behave as it does in C#?

When I write C# code in VS Code and start typing some word and IntelliSense appears and focus on some suggestion I can press dot or space and this word appears in code.
But in python I strictly have to press Enter only if I want to get suggested word. Is it possible to make IntelliSense in Python behave like it behaves in C#?
Try changing the following lines to your settings.json file
"editor.acceptSuggestionOnCommitCharacter": true,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
In addition to #DreamyPlayer's answer, add the following line to settings.json (or rewrite it, if key editor.inlineSuggest.enabled exists):
"editor.inlineSuggest.enabled": true

VSCode's User Snippets Not Working for Markdown and Latex Files

I have gotten user snippets in VSCode to work for C and C++, but for some reason VSCode is not providing snippet suggestions for .md and .tex files.
Here is a minimal example of tex.json (that doesn't work):
{
"dummy": {
"prefix": "dummy",
"body": [
"some random text for demonstration"
],
"description": "A dummy snippet"
}
}
VSCode provides suggestions in .md and .tex files, just not user snippets. How do I fix this issue or employ some other way to use user snippets for Markdown and Latex?
Update: Snippets are now working in .md files, thanks to the comment by #Mark. I need to type the prefix and press Ctrl + Space. This solution does not, however, work for Latex.
For markdown files try this language-specific setting in your settings.json file:
"[markdown]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
}
and you shouldn't need to trigger the snippet suggestion with Ctrl+Space anymore.
[For latex files I don't need that setting - if snippets aren't working in your latex files try the same setting but with latex.]
Sometimes "Ctrl+ Space" is a shortcut for switching input methods on Windows, please turn it off, it works for me

Is there a configuration I could modify so that I don't have to ⌃Space first to trigger IntelliSense for "markdown" in vscode

I've read this post and official doc, and reproduced what they are saying.
To trigger IntelliSense for "markdown", I have to ⌃Space first, and then type the prefix-keyword, which is boring.
Is there a configuration I could modify so that I don't have to ⌃Space first to trigger IntelliSense for "markdown"
To enable suggestions as you type (quick suggestions), in your settings json file set:
"[markdown]": {
"editor.quickSuggestions": {
"other": true
}
}
Quick suggestion are disabled by default for markdown. The [markdown]language specific setting block lets you override this default and re-enable them.
If you enable quick suggestions in markdown, you may want to disable suggestions for words in the file as well by setting: "editor.wordBasedSuggestions": false

Visual Studio Code remove tag highlight

I want to remove the highlighting of a tag when my cursor is on it. For example Visual Studio Code shows a paragraph tag like this: [<]p[>] where I want it to show like this <p>. See image for an example.
Example image
In your settings.json put:
// Highlight matching brackets when one of them is selected.
"editor.matchBrackets": false,
That will stop the behavior you see, but will do it for all supported languages (so also javascript for example). You can change that setting for only html by :
"[html]": {
"editor.matchBrackets": false
}
It appears that this has changed since the other answers were posted:
Value is not accepted. Valid values: "always", "near", "never".(1)
Use this instead:
"editor.matchBrackets": "never"
Try this
"editor.selectionHighlight": false
Ref -> https://www.samundra.com.np/disable-annoying-highlight-in-visual-studio-code/1666

Use VSCode Language specific settings for .min.js

Visual Studio Code Version 1.10 adds the ability to specify languages settings on a per language basis (*1). You put something like this in your settings.json file:
"[javascript]": {
"editor.fontSize": 100,
}
I'd like to do something more specific. I'd like to apply different rules to files that match *.min.js.
How would I do that?
I've actually got something that works, but it's a bit hacky, so I thought I'd ask.
*1) In case you want to know which ones: Use autocomplete after typing in "[]":, or see languageIds array in this file.
I'm aware beautify skips formatting min files by default. But just using "editor.formatOnSave": true, this doesn't seem to happen. Also, other non-formatting stuff like wordwrap is nice.
Here's my current solution:
"files.associations": {
"*.min.js": "javascriptreact"
},
// Hijack javascriptreact to create custom settings for min.js files
"[javascriptreact]": {
"editor.formatOnSave": false,
"editor.wordWrap": "on"
}
I'm using the fact that vscode happens to have a second type of javascript, one that isn't used my my project. Not ideal, but it seems to work.