What is the shortcut in Visual Studio Code for console.log
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I want to know what is the shortcut for console.log in Visual Studio code?
typescript visual-studio-code
add a comment |
I want to know what is the shortcut for console.log in Visual Studio code?
typescript visual-studio-code
add a comment |
I want to know what is the shortcut for console.log in Visual Studio code?
typescript visual-studio-code
I want to know what is the shortcut for console.log in Visual Studio code?
typescript visual-studio-code
typescript visual-studio-code
edited Oct 21 '16 at 13:11
SWeko
25.7k65694
25.7k65694
asked Oct 21 '16 at 12:59
Petko KamenovPetko Kamenov
370139
370139
add a comment |
add a comment |
11 Answers
11
active
oldest
votes
Update Feb, 2019:
As suggested by Adrian Smith and others: If you want to bind a keyboard shortcut to create a console log statement, you can do the following:
- File > Preferences > Keyboard Shortcuts
- Below the search bar you'll see a message "For advanced customizations open and edit keybindings.json", click on it
- Add this to the JSON settings:
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Pressing CTRL+SHIFT+L will output the console snippet. Also, if you already have text selected it will be put inside the log statement.
If you rather want intellisene/autocomplete:
Go to Preferences -> User Snippets -> Choose Typescript (or whatever language you want). A json
file should open. You can add code snippets there.
There is already a snippet for console.log
commented out:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
You have to do this for every language you want to use the snippet ... is kinda bothering.
Also, you should set "editor.snippetSuggestions": "top"
, so your snippets appear above intellisense. Thanks @Chris!
You can find snippet suggestions in Preferences -> Text Editor -> Suggestions
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this"prefix": "c",
should make it work with "c" right?
– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?
– Cristian Muscalu
Feb 14 '17 at 10:18
|
show 3 more comments
The top answer by @Sebastian Sebald is perfectly fine, but hitting a similar problem (not console.log specifically, but rather it "missing") I wanted to also contribute an answer.
Your prefix is indeed working - by default its log
and in your case you have changed it to c
. When you type log
(or c
) VSCode will generate a full list of "all the things™" based on many factors (ie I don't know what factors, probably class relevance).
Things like snippets tend to gravitate towards the bottom. To bump them to the top, despite their length, add this to your settings:
"editor.snippetSuggestions": "top"
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error sayingProperty editor.snippetSuggestions is not allowed
though, what is that about?
– Bossan
Jun 30 '18 at 13:30
add a comment |
In Atom there is a nice shortcut for console.log() and I wanted the same in VS Code.
I used the solution by @kamp but it took me a while to figure out how to do it.
Here are the steps I used.
Go to: File > Preferences > Keyboard Shortcuts
At the top of the page you will see a message that says:
For advanced customizations open and edit keybindings.json
- This opens two panes: the default keybindings, and your custom bindings.
- Enter the code provided by @kamp
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
add a comment |
Other way is to open keybindings.json file and add your desired key combination. In my case it's:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log($1)$0;"
}
}
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
add a comment |
All the above answers works fine, but if you don't want to change the configuration of the visual studio code, rather want auto-completion for console.log(object);
you can simply use this shortcut clg and press Ctrl+Space for suggestion and hit Enter
Note : This feature is avaliable when you install JavaScript (ES6) code snippets extension.
Similarly you have auto-completion for :
clg forconsole.log(object);
clo forconsole.log('object :', object);
ccl forconsole.clear(object);
cer forconsole.error(object);
ctr forconsole.trace(object);
clt forconsole.table(object);
cin forconsole.info(object);
cco forconsole.count(label);
(This list continues...)
link for JavaScript(ES6) code snippets :
https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets
add a comment |
Type log
and hit enter
. It will auto-complete console.log();
I seem to have a bug where typinglog
and pressing enter only outputsconsole.log();
on some occasions, and I can't figure out why? Is it just me or can others typelog
then enter and get a consistentconsole.log();
output every time?
– Ben Clarke
Nov 18 '18 at 21:24
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
add a comment |
In case anybody is interested in putting the currently selected text into the console.log()
statement:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
}
}
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
add a comment |
When you type the word log, you will see something like this:
Choose the one which says Log to the console in case you see different log options (that would basically be possible when you have some identifier with the name log.
Click Enter.
The intellisense will do its job!
add a comment |
Here's a better solution
{
"key": "cmd+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}', $TM_SELECTED_TEXT$1);"
}
}
add a comment |
Anyone looking for For advanced customizations open and edit keybindings.json
Click this little icon to open keybindings.json.
Use this code for generate both console.log() & to generate console.log("Word") for selected text.
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
add a comment |
The below one is currently selected text with single quotes. Hope it helps
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}]
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40177331%2fwhat-is-the-shortcut-in-visual-studio-code-for-console-log%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
11 Answers
11
active
oldest
votes
11 Answers
11
active
oldest
votes
active
oldest
votes
active
oldest
votes
Update Feb, 2019:
As suggested by Adrian Smith and others: If you want to bind a keyboard shortcut to create a console log statement, you can do the following:
- File > Preferences > Keyboard Shortcuts
- Below the search bar you'll see a message "For advanced customizations open and edit keybindings.json", click on it
- Add this to the JSON settings:
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Pressing CTRL+SHIFT+L will output the console snippet. Also, if you already have text selected it will be put inside the log statement.
If you rather want intellisene/autocomplete:
Go to Preferences -> User Snippets -> Choose Typescript (or whatever language you want). A json
file should open. You can add code snippets there.
There is already a snippet for console.log
commented out:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
You have to do this for every language you want to use the snippet ... is kinda bothering.
Also, you should set "editor.snippetSuggestions": "top"
, so your snippets appear above intellisense. Thanks @Chris!
You can find snippet suggestions in Preferences -> Text Editor -> Suggestions
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this"prefix": "c",
should make it work with "c" right?
– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?
– Cristian Muscalu
Feb 14 '17 at 10:18
|
show 3 more comments
Update Feb, 2019:
As suggested by Adrian Smith and others: If you want to bind a keyboard shortcut to create a console log statement, you can do the following:
- File > Preferences > Keyboard Shortcuts
- Below the search bar you'll see a message "For advanced customizations open and edit keybindings.json", click on it
- Add this to the JSON settings:
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Pressing CTRL+SHIFT+L will output the console snippet. Also, if you already have text selected it will be put inside the log statement.
If you rather want intellisene/autocomplete:
Go to Preferences -> User Snippets -> Choose Typescript (or whatever language you want). A json
file should open. You can add code snippets there.
There is already a snippet for console.log
commented out:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
You have to do this for every language you want to use the snippet ... is kinda bothering.
Also, you should set "editor.snippetSuggestions": "top"
, so your snippets appear above intellisense. Thanks @Chris!
You can find snippet suggestions in Preferences -> Text Editor -> Suggestions
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this"prefix": "c",
should make it work with "c" right?
– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?
– Cristian Muscalu
Feb 14 '17 at 10:18
|
show 3 more comments
Update Feb, 2019:
As suggested by Adrian Smith and others: If you want to bind a keyboard shortcut to create a console log statement, you can do the following:
- File > Preferences > Keyboard Shortcuts
- Below the search bar you'll see a message "For advanced customizations open and edit keybindings.json", click on it
- Add this to the JSON settings:
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Pressing CTRL+SHIFT+L will output the console snippet. Also, if you already have text selected it will be put inside the log statement.
If you rather want intellisene/autocomplete:
Go to Preferences -> User Snippets -> Choose Typescript (or whatever language you want). A json
file should open. You can add code snippets there.
There is already a snippet for console.log
commented out:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
You have to do this for every language you want to use the snippet ... is kinda bothering.
Also, you should set "editor.snippetSuggestions": "top"
, so your snippets appear above intellisense. Thanks @Chris!
You can find snippet suggestions in Preferences -> Text Editor -> Suggestions
Update Feb, 2019:
As suggested by Adrian Smith and others: If you want to bind a keyboard shortcut to create a console log statement, you can do the following:
- File > Preferences > Keyboard Shortcuts
- Below the search bar you'll see a message "For advanced customizations open and edit keybindings.json", click on it
- Add this to the JSON settings:
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Pressing CTRL+SHIFT+L will output the console snippet. Also, if you already have text selected it will be put inside the log statement.
If you rather want intellisene/autocomplete:
Go to Preferences -> User Snippets -> Choose Typescript (or whatever language you want). A json
file should open. You can add code snippets there.
There is already a snippet for console.log
commented out:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
You have to do this for every language you want to use the snippet ... is kinda bothering.
Also, you should set "editor.snippetSuggestions": "top"
, so your snippets appear above intellisense. Thanks @Chris!
You can find snippet suggestions in Preferences -> Text Editor -> Suggestions
edited Feb 10 at 14:47
answered Oct 21 '16 at 13:22
Sebastian SebaldSebastian Sebald
7,40833952
7,40833952
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this"prefix": "c",
should make it work with "c" right?
– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?
– Cristian Muscalu
Feb 14 '17 at 10:18
|
show 3 more comments
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this"prefix": "c",
should make it work with "c" right?
– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?
– Cristian Muscalu
Feb 14 '17 at 10:18
1
1
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
This used to work, but it doesn't anymore, since last update maybe? Is it just me? s17.postimg.org/5mxnx4umn/2017_02_14_11h10_03.jpg
– Cristian Muscalu
Feb 14 '17 at 9:14
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
The above defined prefix is "log" so typing "c" will not help ;) Start typing "l" instead.
– Sebastian Sebald
Feb 14 '17 at 9:23
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this
"prefix": "c",
should make it work with "c" right?– Cristian Muscalu
Feb 14 '17 at 9:41
Oh, i forgot to mention i had it changed to work with "c". I didn't change anything, and after update it's not working anymore. Don't have the snippet anymore, but this
"prefix": "c",
should make it work with "c" right?– Cristian Muscalu
Feb 14 '17 at 9:41
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
If everything else is correct. Yes. Note that you also require to add the snippet to each language you want to use it. So if you added it to TS it will not work in JS, vice versa.
– Sebastian Sebald
Feb 14 '17 at 10:06
Here is the new proof with using
"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?– Cristian Muscalu
Feb 14 '17 at 10:18
Here is the new proof with using
"prefix" :"c"
inside a js file s23.postimg.org/a8xwzsbrv/2017_02_14_12h16_00.jpg Can you confirm that is working with you?– Cristian Muscalu
Feb 14 '17 at 10:18
|
show 3 more comments
The top answer by @Sebastian Sebald is perfectly fine, but hitting a similar problem (not console.log specifically, but rather it "missing") I wanted to also contribute an answer.
Your prefix is indeed working - by default its log
and in your case you have changed it to c
. When you type log
(or c
) VSCode will generate a full list of "all the things™" based on many factors (ie I don't know what factors, probably class relevance).
Things like snippets tend to gravitate towards the bottom. To bump them to the top, despite their length, add this to your settings:
"editor.snippetSuggestions": "top"
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error sayingProperty editor.snippetSuggestions is not allowed
though, what is that about?
– Bossan
Jun 30 '18 at 13:30
add a comment |
The top answer by @Sebastian Sebald is perfectly fine, but hitting a similar problem (not console.log specifically, but rather it "missing") I wanted to also contribute an answer.
Your prefix is indeed working - by default its log
and in your case you have changed it to c
. When you type log
(or c
) VSCode will generate a full list of "all the things™" based on many factors (ie I don't know what factors, probably class relevance).
Things like snippets tend to gravitate towards the bottom. To bump them to the top, despite their length, add this to your settings:
"editor.snippetSuggestions": "top"
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error sayingProperty editor.snippetSuggestions is not allowed
though, what is that about?
– Bossan
Jun 30 '18 at 13:30
add a comment |
The top answer by @Sebastian Sebald is perfectly fine, but hitting a similar problem (not console.log specifically, but rather it "missing") I wanted to also contribute an answer.
Your prefix is indeed working - by default its log
and in your case you have changed it to c
. When you type log
(or c
) VSCode will generate a full list of "all the things™" based on many factors (ie I don't know what factors, probably class relevance).
Things like snippets tend to gravitate towards the bottom. To bump them to the top, despite their length, add this to your settings:
"editor.snippetSuggestions": "top"
The top answer by @Sebastian Sebald is perfectly fine, but hitting a similar problem (not console.log specifically, but rather it "missing") I wanted to also contribute an answer.
Your prefix is indeed working - by default its log
and in your case you have changed it to c
. When you type log
(or c
) VSCode will generate a full list of "all the things™" based on many factors (ie I don't know what factors, probably class relevance).
Things like snippets tend to gravitate towards the bottom. To bump them to the top, despite their length, add this to your settings:
"editor.snippetSuggestions": "top"
answered Feb 20 '17 at 9:45
ChrisChris
21.2k1385144
21.2k1385144
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error sayingProperty editor.snippetSuggestions is not allowed
though, what is that about?
– Bossan
Jun 30 '18 at 13:30
add a comment |
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error sayingProperty editor.snippetSuggestions is not allowed
though, what is that about?
– Bossan
Jun 30 '18 at 13:30
3
3
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
You're the hero I needed. Thanks!
– BinarySolo
Feb 28 '17 at 12:08
1
1
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
Haha no worries at all
– Chris
Feb 28 '17 at 12:09
I get an error saying
Property editor.snippetSuggestions is not allowed
though, what is that about?– Bossan
Jun 30 '18 at 13:30
I get an error saying
Property editor.snippetSuggestions is not allowed
though, what is that about?– Bossan
Jun 30 '18 at 13:30
add a comment |
In Atom there is a nice shortcut for console.log() and I wanted the same in VS Code.
I used the solution by @kamp but it took me a while to figure out how to do it.
Here are the steps I used.
Go to: File > Preferences > Keyboard Shortcuts
At the top of the page you will see a message that says:
For advanced customizations open and edit keybindings.json
- This opens two panes: the default keybindings, and your custom bindings.
- Enter the code provided by @kamp
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
add a comment |
In Atom there is a nice shortcut for console.log() and I wanted the same in VS Code.
I used the solution by @kamp but it took me a while to figure out how to do it.
Here are the steps I used.
Go to: File > Preferences > Keyboard Shortcuts
At the top of the page you will see a message that says:
For advanced customizations open and edit keybindings.json
- This opens two panes: the default keybindings, and your custom bindings.
- Enter the code provided by @kamp
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
add a comment |
In Atom there is a nice shortcut for console.log() and I wanted the same in VS Code.
I used the solution by @kamp but it took me a while to figure out how to do it.
Here are the steps I used.
Go to: File > Preferences > Keyboard Shortcuts
At the top of the page you will see a message that says:
For advanced customizations open and edit keybindings.json
- This opens two panes: the default keybindings, and your custom bindings.
- Enter the code provided by @kamp
In Atom there is a nice shortcut for console.log() and I wanted the same in VS Code.
I used the solution by @kamp but it took me a while to figure out how to do it.
Here are the steps I used.
Go to: File > Preferences > Keyboard Shortcuts
At the top of the page you will see a message that says:
For advanced customizations open and edit keybindings.json
- This opens two panes: the default keybindings, and your custom bindings.
- Enter the code provided by @kamp
answered Oct 17 '17 at 9:31
Adrian SmithAdrian Smith
36627
36627
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
add a comment |
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
Thank you for the detailed steps
– Moaaz Bhnas
Jul 17 '18 at 10:43
add a comment |
Other way is to open keybindings.json file and add your desired key combination. In my case it's:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log($1)$0;"
}
}
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
add a comment |
Other way is to open keybindings.json file and add your desired key combination. In my case it's:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log($1)$0;"
}
}
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
add a comment |
Other way is to open keybindings.json file and add your desired key combination. In my case it's:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log($1)$0;"
}
}
Other way is to open keybindings.json file and add your desired key combination. In my case it's:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log($1)$0;"
}
}
answered Oct 10 '17 at 7:03
kampkamp
223412
223412
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
add a comment |
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
"ctrl+shift+c" for the "key" is a bit easier to click with one hand IMO and its not already taken by another keybinding if your using the default vs code keybindings
– russiansummer
Nov 3 '17 at 19:41
add a comment |
All the above answers works fine, but if you don't want to change the configuration of the visual studio code, rather want auto-completion for console.log(object);
you can simply use this shortcut clg and press Ctrl+Space for suggestion and hit Enter
Note : This feature is avaliable when you install JavaScript (ES6) code snippets extension.
Similarly you have auto-completion for :
clg forconsole.log(object);
clo forconsole.log('object :', object);
ccl forconsole.clear(object);
cer forconsole.error(object);
ctr forconsole.trace(object);
clt forconsole.table(object);
cin forconsole.info(object);
cco forconsole.count(label);
(This list continues...)
link for JavaScript(ES6) code snippets :
https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets
add a comment |
All the above answers works fine, but if you don't want to change the configuration of the visual studio code, rather want auto-completion for console.log(object);
you can simply use this shortcut clg and press Ctrl+Space for suggestion and hit Enter
Note : This feature is avaliable when you install JavaScript (ES6) code snippets extension.
Similarly you have auto-completion for :
clg forconsole.log(object);
clo forconsole.log('object :', object);
ccl forconsole.clear(object);
cer forconsole.error(object);
ctr forconsole.trace(object);
clt forconsole.table(object);
cin forconsole.info(object);
cco forconsole.count(label);
(This list continues...)
link for JavaScript(ES6) code snippets :
https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets
add a comment |
All the above answers works fine, but if you don't want to change the configuration of the visual studio code, rather want auto-completion for console.log(object);
you can simply use this shortcut clg and press Ctrl+Space for suggestion and hit Enter
Note : This feature is avaliable when you install JavaScript (ES6) code snippets extension.
Similarly you have auto-completion for :
clg forconsole.log(object);
clo forconsole.log('object :', object);
ccl forconsole.clear(object);
cer forconsole.error(object);
ctr forconsole.trace(object);
clt forconsole.table(object);
cin forconsole.info(object);
cco forconsole.count(label);
(This list continues...)
link for JavaScript(ES6) code snippets :
https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets
All the above answers works fine, but if you don't want to change the configuration of the visual studio code, rather want auto-completion for console.log(object);
you can simply use this shortcut clg and press Ctrl+Space for suggestion and hit Enter
Note : This feature is avaliable when you install JavaScript (ES6) code snippets extension.
Similarly you have auto-completion for :
clg forconsole.log(object);
clo forconsole.log('object :', object);
ccl forconsole.clear(object);
cer forconsole.error(object);
ctr forconsole.trace(object);
clt forconsole.table(object);
cin forconsole.info(object);
cco forconsole.count(label);
(This list continues...)
link for JavaScript(ES6) code snippets :
https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets
edited Jul 15 '18 at 8:03
answered Apr 28 '18 at 11:04
Sabunkar Tejas SahaileshSabunkar Tejas Sahailesh
537815
537815
add a comment |
add a comment |
Type log
and hit enter
. It will auto-complete console.log();
I seem to have a bug where typinglog
and pressing enter only outputsconsole.log();
on some occasions, and I can't figure out why? Is it just me or can others typelog
then enter and get a consistentconsole.log();
output every time?
– Ben Clarke
Nov 18 '18 at 21:24
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
add a comment |
Type log
and hit enter
. It will auto-complete console.log();
I seem to have a bug where typinglog
and pressing enter only outputsconsole.log();
on some occasions, and I can't figure out why? Is it just me or can others typelog
then enter and get a consistentconsole.log();
output every time?
– Ben Clarke
Nov 18 '18 at 21:24
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
add a comment |
Type log
and hit enter
. It will auto-complete console.log();
Type log
and hit enter
. It will auto-complete console.log();
edited Nov 16 '18 at 12:23
François Romain
4,264125589
4,264125589
answered Oct 31 '18 at 10:43
nedemirnedemir
13112
13112
I seem to have a bug where typinglog
and pressing enter only outputsconsole.log();
on some occasions, and I can't figure out why? Is it just me or can others typelog
then enter and get a consistentconsole.log();
output every time?
– Ben Clarke
Nov 18 '18 at 21:24
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
add a comment |
I seem to have a bug where typinglog
and pressing enter only outputsconsole.log();
on some occasions, and I can't figure out why? Is it just me or can others typelog
then enter and get a consistentconsole.log();
output every time?
– Ben Clarke
Nov 18 '18 at 21:24
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
I seem to have a bug where typing
log
and pressing enter only outputs console.log();
on some occasions, and I can't figure out why? Is it just me or can others type log
then enter and get a consistent console.log();
output every time?– Ben Clarke
Nov 18 '18 at 21:24
I seem to have a bug where typing
log
and pressing enter only outputs console.log();
on some occasions, and I can't figure out why? Is it just me or can others type log
then enter and get a consistent console.log();
output every time?– Ben Clarke
Nov 18 '18 at 21:24
1
1
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
You have to wait a few milisenconds / seconds for the command line to regonise what you have typed. sometimes it laggs a bit
– nedemir
Nov 23 '18 at 14:17
add a comment |
In case anybody is interested in putting the currently selected text into the console.log()
statement:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
}
}
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
add a comment |
In case anybody is interested in putting the currently selected text into the console.log()
statement:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
}
}
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
add a comment |
In case anybody is interested in putting the currently selected text into the console.log()
statement:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
}
}
In case anybody is interested in putting the currently selected text into the console.log()
statement:
{
"key": "cmd+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log(${TM_SELECTED_TEXT}$1)$0;"
}
}
answered Oct 25 '17 at 21:32
medoingthingsmedoingthings
2,09321017
2,09321017
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
add a comment |
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
This is awesome!
– AJ Hsu
Nov 7 '18 at 2:42
add a comment |
When you type the word log, you will see something like this:
Choose the one which says Log to the console in case you see different log options (that would basically be possible when you have some identifier with the name log.
Click Enter.
The intellisense will do its job!
add a comment |
When you type the word log, you will see something like this:
Choose the one which says Log to the console in case you see different log options (that would basically be possible when you have some identifier with the name log.
Click Enter.
The intellisense will do its job!
add a comment |
When you type the word log, you will see something like this:
Choose the one which says Log to the console in case you see different log options (that would basically be possible when you have some identifier with the name log.
Click Enter.
The intellisense will do its job!
When you type the word log, you will see something like this:
Choose the one which says Log to the console in case you see different log options (that would basically be possible when you have some identifier with the name log.
Click Enter.
The intellisense will do its job!
answered Nov 29 '18 at 5:38
SrishtiSrishti
356113
356113
add a comment |
add a comment |
Here's a better solution
{
"key": "cmd+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}', $TM_SELECTED_TEXT$1);"
}
}
add a comment |
Here's a better solution
{
"key": "cmd+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}', $TM_SELECTED_TEXT$1);"
}
}
add a comment |
Here's a better solution
{
"key": "cmd+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}', $TM_SELECTED_TEXT$1);"
}
}
Here's a better solution
{
"key": "cmd+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}', $TM_SELECTED_TEXT$1);"
}
}
answered Sep 6 '18 at 12:55
Param SinghParam Singh
4192621
4192621
add a comment |
add a comment |
Anyone looking for For advanced customizations open and edit keybindings.json
Click this little icon to open keybindings.json.
Use this code for generate both console.log() & to generate console.log("Word") for selected text.
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
add a comment |
Anyone looking for For advanced customizations open and edit keybindings.json
Click this little icon to open keybindings.json.
Use this code for generate both console.log() & to generate console.log("Word") for selected text.
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
add a comment |
Anyone looking for For advanced customizations open and edit keybindings.json
Click this little icon to open keybindings.json.
Use this code for generate both console.log() & to generate console.log("Word") for selected text.
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
Anyone looking for For advanced customizations open and edit keybindings.json
Click this little icon to open keybindings.json.
Use this code for generate both console.log() & to generate console.log("Word") for selected text.
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}
answered Mar 22 at 6:50
Hiran D.A WalawageHiran D.A Walawage
8291713
8291713
add a comment |
add a comment |
The below one is currently selected text with single quotes. Hope it helps
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}]
add a comment |
The below one is currently selected text with single quotes. Hope it helps
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}]
add a comment |
The below one is currently selected text with single quotes. Hope it helps
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}]
The below one is currently selected text with single quotes. Hope it helps
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+c",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
}
}]
answered Nov 25 '17 at 22:17
Ragavan RajanRagavan Rajan
586415
586415
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40177331%2fwhat-is-the-shortcut-in-visual-studio-code-for-console-log%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown