This question already has answers here:
Prevent VS Code IntelliSense inserting ={} after function name
(2 answers)
Closed 6 days ago.
Whenever VSCode does suggestions and I choose one of those suggestions, it adds "={}" behind any variable I auto-complete.
I recorded a little clip to demonstrate the problem:
I want it to just autocomplete "album" in this case. Not "album={}".
How to fix this
Open VS code.
Go to File > Preference > Settings then
type: run code in the settings search bar
Select Edit in settings.json to open the settings.json file
Add the "javascript.preferences.jsxAttributeCompletionStyle": "none" line to your settings.json file
Why we do this:
In the defaultSettings.json file there is this code snippet:
// Preferred style for JSX attribute completions.
// - auto: Insert `={}` or `=""` after attribute names based on the prop type.
// - braces: Insert `={}` after attribute names.
// - none: Only insert attribute names.
"javascript.preferences.jsxAttributeCompletionStyle": "auto",
therefore, the default setting for jsxAttributeCompletionStyle is auto and by setting it to "none" in your settings.json file you overwrite that default setting.
Related
Turn on all setting correctly. Not working. However, I few weeks ago is was working. I
get a message that they are asking for a donation. Is is legal? And will it work after
the donation? I would live without it, but is is a very nice and effective feature!
Bracket Pair Colorizer is no longer maintained. It's outdated.
Instead, you can colorize your brackets by adding this single line to your settings.json:
"editor.bracketPairColorization.enabled": true
If you are facing trouble activating the default bracket pair colorizer then here are the steps to follow. In VS Code, Ctrl + Shift + P > type json in search box > click on Open User Settings(JSON). In settings.json file, search for 'bracket' > delete all bracket-related entries.
Now just write below 2 lines anywhere after putting a comma at the end of the line before them :
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
Bracket pair colorizer functionality is now built into VS Code. So don't even install that extension.
even if you keep the below line in settings.json, there is no difference
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active"
}
Bracket pair colorizer functionality is now built into VS Code. So don't even install that extension.
2.Even if you add the below line in settings.json file
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active"
}
Doesn't make any difference.
No need of donation, and even turning on any setting.
This question already has answers here:
What is the correct way of code comments in JavaScript
(4 answers)
Closed 2 years ago.
How to write comments in JavaScript and when?
It depends on what type of comment you want to write: single-line or multi-line.
For single-line, you can try this:
// I am a comment
For multi-line:
/* I am a
multi-line comment */
Check out this tutorial, for additional info.
If you need multiline command use this
/**
* This is my multiline command
*/
And if you want inline command then simply use this
// This is my inline command
To comment out single line, you may use //
Example
//This Button is for linking and demo
<Button>Click Me</Button>
Another way, you would use /* for start and */ for closing
Example
/*Describe my whole js file what am I doing
This js include three function which was...
also that...
finally...
*/
try this article, you will get a better understanding for JavaScript comments
JS noob here. I'm currently using js-beautify(https://github.com/beautify-web/js-beautify) plugin to properly indent/format a long string of HTML code. This is how I'm using it
html_beautify(HTML);
HTML is a variable containing regular HTML code.
How can I pass options like disabling word-wrap or removing empty lines?
It looks like you can add an object as the second parameter to handle your options:
html_beautify(elHTML, { preserve_newlines: false, wrap_line_length: 0 });
I want to select line 2 for copy & paste in ACE. There is a method selectLine(), which is documented here: http://ace.c9.io/#nav=api&api=selection but i don't understand how to use it. Unfortunately its also nothing to find on stackoverflow.com about selection, only about highlighting, which is not the same.
// ACE Editor Setup
var editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode("ace/mode/html");
editor.setValue("textline1\n textline2\n textline3");
var select = new Selection(editor.getSession()); // Uncaught TypeError: Illegal constructor
select.selectLine(2);
Once ace is initialized, it creates a Selection object instance therefore you don't need to recreate it. To access Selection just use editor.selection.
Another important point is selectLine selects the current line (it doesn't accept any parameters). So to move the cursor and select the line you have to first use moveCursorToPosition function.
Here is an example:
editor.selection.moveCursorToPosition({row: 1, column: 0});
editor.selection.selectLine();
How can I set up the designed in visual studio to put a space after my javascript functions?
At present when I press the return key I get this
var myfunc = function() { .... };
When I want this
var myfunc = function () { .... };
Know its a setting somewhere but cant find it - will help with my JSlinting!
In VS 2010 you can't.
The options you have are found at "Options-> Text Editor -> JScript -> Formatting", but that is not one of the options available.
Here's the options you have:
Automatic Formatting
Format completed line on Enter
Format completed statement on ;
Format completed block on }
Format on paste
New lines
Place open brace on new line for functions
Place open brace on new line for control blocks
Spacing - section that would have what you're after
Insert space after comma delimiter
Insert space after semicolon in 'for' statement
Insert space before and after binary operators
Insert space after keywords in control flow statements
You can't do it with VS. I am using VS 2010 and it permit you to write formatting rules going on Tools -> Options and then select Text Editor in the list on the left.
You can define rules like the one you want for languages like C# but not for javascript.