How to disable IntelliSense in VS Code for Markdown? - intellisense

I don't want word completion for Markdown files in Visual Studio Code, how do I disable it? Ideally, for Markdown only but in the worst case, even a global switch would be good.

IntelliSense suggestions in VS Code can be configured globally or per each workspace and as of 1.9 per file-type (language), using the editor.quickSuggestions, editor.acceptSuggestionOnEnter and editor.suggestOnTriggerCharacters settings.
// Controls if quick suggestions should show up or not while typing
"editor.quickSuggestions": true,
Since VSCode 1.11, the quickSuggestions setting allows more fine-grained control over quick suggestions. However, this setting accepts either a boolean, or an object matching IQuickSuggestionsOptions, and defaults to true. Setting it to false disables quick suggestions all together.
File-type settings (preferred, as of 1.9 release)
Open the Command Palette by pressing F1 and run the Configure language specific settings command, then select Markdown.
A new editor pane will open where you can place those settings:
// Place your settings in this file to overwrite the default settings
{
"[markdown]": {
"editor.quickSuggestions": false
}
}
This way, you'll disable IntelliSense for markdown files only.
Global
Open Command Palette by pressing F1, type open user settings and press Enter. A new editor pane will open where you can place those settings:
// Place your settings in this file to overwrite the default settings
{
"editor.quickSuggestions": false
}
Workspace
Workspace settings allows setting custom settings without applying them to your other VS Code projects. The workspace settings file is located under the .vscode folder in your project.
Open Command Palette by pressing F1, type open workspace settings and press Enter. A new editor pane will open when you can place the same snipped as listed above.
I don't know if it's currently possible to associate settings with selected filetypes.
Other options to configure
In addition to editor.quickSuggestions several other options can be changed to further customize how IntelliSense works:
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": false,
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
"editor.acceptSuggestionOnEnter": false,
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Enable word based suggestions
"editor.wordBasedSuggestions": false,
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false

In addition to what #JakubS said, there are two more settings that will help eliminate IntelliSense:
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false,
The editor.autoClosingBrackets option will stop Visual Studio Code from automatically inserting a closing parenthesis, bracket, brace, single quote, double quote, etc.
The editor.suggestOnTriggerCharacters option will stop the auto-complete window from appearing when you type a dollar sign or dot.
All together, here's what I use:
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": false,
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
"editor.acceptSuggestionOnEnter": false,
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Enable word based suggestions
"editor.wordBasedSuggestions": false,
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false

This only worked for plaintext, not markdown. My settings.json is as below but I'm still getting suggestions in .md files (though now not in .txt files).
{
"[markdown]": {
"editor.quickSuggestions": false
},
"[plaintext]": {
"editor.quickSuggestions": false
},
[other entries]
}

If also the markdown linting warnings are distracting and you want to disable them temporarily, you can use;
CTRL/COMMAND+SHIFT+P
Toggle linting by markdownlint on/off (temporarily)
You can enable it when you believe you're done with a document.

Related

Remove automated closing bracket comments in IntelliJ IDEA

I'm seeing following happen when working in intelliJ IDEA with Dart based project
All comments there i.e // AppBar are auto generated, I assume for easier tracking of what closing brackets belong where. Weird bit is that I can't even highlight them, nor delete them and when I copy code they are not copied over.
Is there a way to disable this feature in the ide?
The checkbox is in Settings (Preferences) | Editor | General | Appearance, toggle 'Show closing labels in Dart source code'.
And in the vs code editor, change this setting to false
"dart.closingLabels": true
You can find this setting easily. Go setting and search(Ctrl+f) dart.closingLabels
Update 24.11.2019:
If you want to customize the closing label color, you can do this. In vscode, open your settings.json file and set this setting
"workbench.colorCustomizations": {
"dart.closingLabels": "#FF5733"
},

How to format curly braces for autoformat in intellij

Whenever I hit alt-cmd-l to autoformat my code, it formats my imports and arrays from:
import { CommonModule } from '#angular/common';
let arr = [ myStringVar ]; // simple example, just go with it
to
import {CommonModule} from '#angular/common';
let arr = [myStringVar];
How do I tell IntelliJ to put a space after the opening brace and before the close brace when auto-formatting? (Specifically for javascript, typescript)
I've looked around for the answer and could not find one or asked the question badly. So I apologize if this is duplicate.
I'm on Intellij 2016.3.3
Go to preference, select Editor > Code Style > Javascript and choose Spaces, check the checkboxes in Within section "ES6 import/export brances", and if you want spaces in object literal braces, check "Object literal braces" and as well.
Go to settings and search for ES6 import/export braces. It should take you to Editor -> Code Style -> Javascript (or TypeScript). Just hit that checkbox on the spaces tab and it should add the spaces back.
As you are using Angular, I believe you need to edit the settings for the Typescript and NOT for JavaScript. As I am using IntelliJ IDEA 2021, I will give you the fix for the same. You can do so by going through the following path:
Go to File > Settings... > Editor > Code Style > Typescript
Click on the Spaces tab.
In the Within collapsible, tick the checkbox that says "ES6 import/export braces".
Click on Apply button and then click on Ok button.
If you now go to the Typescript file and hit the combo: Ctrl + Alt + L, it should now format the file correctly.
CAVEAT:
You have to be careful to ensure that you are making the changes for the Scheme that is applicable for your project. For example, maybe you have customized your Editor in some way previously and saved your customizations under a new name, such as MyCustomSettings. Once you do this, you will notice that there is an additional Scheme called the Default scheme. But MyCustomSettings will be your Scheme for your project and you have to make sure that you make the changes for the MyCustomSettings Scheme and not for the Default scheme. You can refer to the Schemes via the following path:
File > Settings... > Editor > Code Style > Typescript, there is a dropdown referred as Scheme. Choose the appropriate one for your Project and make sure you make the above edits in that Scheme.

How to center the editor window back on the cursor in VSCode?

I'm using VSCode as my text editor. I'm curious, is there a keybinding for centering the editor window on the cursor, when the window is a lot of lines below/above it such that it's not visible on the screen? I've tried looking at the default keybindings by going to FIle > Preferences > Keyboard Shortcuts, but I see no such options for centering the window.
There is no such keybinding / command built-in.
I couldn't stand that either, so I created a VSCode extension. You can find it and install it here on the marketplace. The default shortcut is CTRL + L.
If you are using vscodevim, zz should work.
If you want to always keep the cursor on the center, you can change the setting Cursor Surrounding Lines to a really high number (100 is ok) and that should work.
As #kwood put it, there is an extension Center Editor Window in the marketplace that meets this end.
I would like to make an answer here, to complement that -- even the extension's author did not explicitly state in the marketplace page -- if you would like to change the default key binding (Ctrl+L), you may try put the following lines in the keybindings.json for the keyboard bindings.
{
"key": "cmd+k cmd+c",
"command": "center-editor-window.center",
"when": "editorTextFocus"
},
The above command sets ⌘ Command+K, ⌘ Command+C as the keyboard shortcut.
Apart from that, you may set
"center-editor-window.threeStateToggle": true,
in the settings.json for VS Code settings so that it will switch among three states (center, top, bottom) instead of one (center).

Problems with Ctrl+Backspace in Sublime Text 3

I regularly use ctrl+backspace in Sublime 3 to delete a whole word, but recently it stopped working. Nothing happens when I try to use it.
I have tried mapping it in Key Bindings - User as
{ "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false } }
but still no luck. Have also checked that it is not caught by AutoHotKey or other programs running in the background.
Anyone else having the same issue with Sublime 3? Any ideas how to fix this?
Thanks in advance
Check out the FindKeyConflicts plugin, available via Package Control. Once installed, open the Command Palette and type findkeycon until the FindKeyConflicts options appear. Choose All Conflicts and hit Enter. Once the new tab opens and is populated, search in it for ctrl+backspace and see if anything comes up. Once you find the offending plugin, you can use PackageResourceViewer to edit the appropriate .sublime-keymap file and change that key combo to something else.
Good luck!

In Etherpad, are there any shortcuts for other actions than bold, italic and underline (strike, bullet point, ...)?

Well, pretty much everything is in the title: are there any shortcuts to perform something else than making text bold, italic or underlined ? Or any plugin allowing to do so ?
According to a colleague of mine, the source code doesn't seem to contain such things, but maybe we've missed something ?
Etherpad contains an embedded rich-text editor called ACE2 (originally AppJet Code Editor), that seems to be responsible for the keyboard shortcut handling.
The ace.js file that is embedded by default used to be minified and therefore hard to read in older version of Etherpad, but you can read the original source files directly in the infrastructure/ace part of the source code, from which the minified version is produced. For more info about that have, a look at ACE2's README.
More recent versions (at least the etherpad.org ones) seem to include the normal ACE2 JS source.
The keyboard shortcut handling code is located in ace2_inner.js, inside the handleKeyEvent() function. Based on this, it looks like the keyboard shortcuts supported out-of-the-box are the following (on top of the browser's shortcuts like Cut/Copy/Paste):
Enter - special etherpad carriage return
Tab or Shift+Tab - indent or outdent bullet lists
Ctrl+Z - special etherpad undo
Ctrl+Y - special etherpad redo
Ctrl+B - bold
Ctrl+I - italics
Ctrl+U - underline
Ctrl+H - delete
Ctrl+S - Save a Revision
Nothing for strikethrough or bullet lists indeed, and nothing that looks like an easy extension mechanism for shortcuts, so you may need to get your hands dirty ;-)
If you have your own deployment of Etherpad the easiest might be to modify the source code of ACE2 to handle additional shortcuts, then re-build the ace2.js minified version (according to the instructions in the README) if needed.
Here's an example of how to handle Ctrl+S shortcut for strikethrough toggle, and Ctrl+L for bullet list toggle. The strikethrough shortcut disables the builtin browser Save As... shortcut, which I find is a bonus, but if you don't like that you can always opt for another key than S.
Insert the following snippet in ace2_inner.js in between similar-looking blocks that handle other shortcuts, around line 3200:
/* Ctrl+S toggles striketrough, and prevents triggering the browser's Save dialog */
if ((!specialHandled) && isTypeForCmdKey &&
String.fromCharCode(which).toLowerCase() == "s" &&
(evt.metaKey || evt.ctrlKey)) {
// ctrl/cmd-s (strikethrough toggle)
fastIncorp(13); // don't ask me ;-)
evt.preventDefault();
toggleAttributeOnSelection('strikethrough');
specialHandled = true;
}
if ((!specialHandled) && isTypeForCmdKey &&
String.fromCharCode(which).toLowerCase() == "l" &&
(evt.ctrlKey)) {
// ctrl/cmd-L (bullet list toggle)
fastIncorp(9); // seriously, don't ask me ;-)
evt.preventDefault();
doInsertUnorderedList();
specialHandled = true;
}
If you can't rebuild the minified version you can also try to directly patch it using the minified names. Here's the minified version of the above snippet for me, though YMMV, I didn't check if the minification is stable and reuses the same shortened names every time. Search for "y" (with the quotes) to locate the minified version of handleKeyEvent() inside ace.js:
if ((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="s"&&(i.metaKey || i.ctrlKey)){G(13);\\ni.preventDefault();c("strikethrough");Cp=true;}if((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="l"&&(i.metaKey||i.ctrlKey)){G(9);\\ni.preventDefault();As();Cp=true;}
Finally, if you don't control the etherpad deployment you could perhaps implement something similar using an in-browser GreaseMonkey script that patches the default handleKeyEvent() function. As a starting point for hooking into the editor, try inspecting the window.pad* objects, such as window.padeditor. For instance select some text in the editor and try the following in the console:
> window.padeditor.ace.execCommand('bold')
> window.padeditor.ace.execCommand('insertunorderedlist')