wrong format on line comment webstorm or intellij ultimate - javascript

Have anyone experience in intellij ultimate or webstorm adding a comment with the shortcut cmd + / ?
I’m trying to change the following behavior from
//This is a comment
to
// This is a comment
notice the space after the // . I can work on atom and sublime as expected but I don’t know why webstorm or intellij use a different functionality, I’ve played with a flag in the code style tab called Comment at first column but that doesn’t change the behavior as I want it. If anyone have experience this I appreciate any solution / workaround
Already read this answer, but that is not the intended behavior, what I need to add a line comment with the proper space after //
Intellij: add space after double slashes in line comment

At the moment it's not possible.
https://youtrack.jetbrains.com/issue/IDEA-141701 -- watch this ticket (star/vote/comment) to get notified on progress.

Related

Latest version of Visual Studio Code IDE prevents styled-components-snippets from running — how do you fix this? [duplicate]

I have a user snippet configured in Visual Studio Code. Let's take one of the items in this snippet: one with the prefix imp.
Now, prior to the recent VSCode update, as soon as I did something like the following.
it automatically showed the autocompletion box to me (I didn't have to press Ctrl + Space to activate it), as shown below:
But now after the update, something strange has happened. When I type in just im, obviously, it shows me the <img> autocompletion suggestions as shown below:
But when I continue to type the full thing imp, the autocompletion box gets hidden. It's only when I press Ctrl + Space that I get the autocompletion box again.
What is the reason for this problem and how to fix it?
I can reproduce your issue exactly, which led me to look to see if it has been reported on github. It has, see Snippets gone from IntelliSense.
From same issue as above:
I have pushed a fix for next insiders and I have pitched this for the
1.75.1 recovery release
It is in today's Insiders (I just tested it) 02/03/2023.
So you can either try the Insiders Build now or wait for the Recovery Release. And continue to use the manual trigger of Ctrl+Space in the meantime.
As #WayneBloss mentions in a comment below, disabling the snippetsPreventQuickSuggestions setting might fix the issue.

VSCODE Javascript template string become white and lost highlight in a non deterministic way

I don't know exactly how to express it in words to find related problems. In some cases, apparently random, when using JavaScript string templates, the text editor loses becomes white, with bold text and makes editing the code very difficult.
First appearance of the problem was when I started working with javascript string for GraphQL query, then it started showing up working with React and mainly storybook.
The problem does not always occur instantly, for example, I am editing the code and it works perfectly, when I restart the machine and reopen vscode, the template is like this.
The question is, what is the source of this problem and how can I fix it to keep the original hightlight to work?
[EDIT] After disable all extensions, the issue still happen.
This is the minimal example possible without extensions:
const text1 = `
This is a test
`
const text2 = `
This is a test ${string}
`
const text3 = `
This is a test this is a test ${string}
`
What is the exact vscode configuration that set to keep string like text1 and text2 in any possible case?
I tried and didn't get the effect so I cannot test it. And it means two things:
You have another extension installed on your vscode which has a bug or has conflicts with the original editor's color validation.
Your vscode has some settings turned off.
I guess the first one is correct. Please disable all extensions and test if it is ok then turn them on one by one and see which one make problems.
I saw comments above after I wrote this. And it seems Matt Bierner has also mentioned something like this. If this works give him a thumbs up as he said it sooner ;)
I had the same issue, fixed to me after disable Babel ES6/ES7 extension.
for me I disabled the mysql-inline-decorator extension and it worked, so if you have it installed remove or disable it!

Visual Studio 2017 Stop All JavaScript Formatting [duplicate]

I prefer my own style of code formatting as opposed to Visual Studio's default settings. I've turned off auto-formatting options in Tools→Options. In most cases, it works.
However, after using any of the built-in refactorings, Visual Studio clobbers my settings with its default settings. How do I keep VS from doing that?
I had this problem while writing VB in an aspx page.
The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.
Note - in Visual Studio 2015 this can be found at:
Tools > Options > Text Editor > Basic > Advanced
Disable pretty listing. It is the option that re-formats what you are doing. I had the same discomfort with it and after doing it, my code stays how i want and it doesn't go back to previous settings.
As suggest by #TheMatrixRecoder took a bit of finding for me so maybe this will help someone else.
Unitick these options to prevent annoying automated formatting when you places a semicolon or hit return at the end of a line.
You might have had Power Tool installed.
In this case you can turn it off from 'Tools > Options > Productivity Power Tools > PowerCommands > General'
In my case, it was ReSharper.
Test if ReSharper
StackOverflow: How can I disable ReSharper in Visual Studio and enable it again?
Prevent ReSharper from reformatting code
StackOverflow: Is there a way to mark up code to tell ReSharper not to format it?
Update 2017-03-01
It was ReSharper in the end:
Update 2020-12-18
On the latest version of ReSharper, there are more options: untick everything on this page, and ensure all dropdowns are set to the equivalent of None.
ReSharper "typing assist" is like a 3-year-old trying to "help" build a card castle. A simple backspace or an enter key will (poorly) reformat entire blocks of code, requiring it to be undone or painfully formatted back to the original.
And if that is not enough, this is the bit that adds delays when typing so sometimes it feels like trying to run in skis.
The reformat on semicolon or closing brace cannot be turned off. I find it infuriating the Microsoft would have the temerity to tell anyone how to format code; the most illegible code I have ever seen was while working there.
I want adjacent assignments to be vertically aligned; VS reformats them to one space on either side of the equal sign irrespective of the length of the variable on the left. This is intolerable. And turning it off on the editor options is ignored; given comments like the opener above I am certain this is deliberate.
Consistency is only a virtue when it leads to desirable outcomes. This is not one.
VS2015 settings that helped me prevent auto formatting:
(and Tools > Options > Text Editor > Basic > Advanced, just like Tango91 suggested)
In VS2017 you can change it after selecting your coding language in the settings menu. There is an option called "new Lines" in the "Formatting"-submenu.
I see that many answers here solve the problem for a specific situation.
For my situation I continually found that the IDE would automatically format JavaScript code within an ASP page.
To disable, I unchecked this box:
In addition, I found it very helpful to use the search query in the toolbar (CTRL+Q) and just search for the text format on paste. As you can see with the scroll bar, there are quite a few options to check!
I doubt that you can disable re-formatting after refactoring. Refactoring changes code and since it's only text I doubt what you'd want is that it just dumps unformatted text into your source. Wouldn't it be a little easier to just set the code style VS adheres to to the style you like and follow?
Follow TOOLS->OPTIONS->Text Editor->CSS->Formatting
Choose "Compact Rules" and uncheck "Hiearerchical indentation"
It can be the case of Clang Format.
Previously, the entire file is automatically formatted on file save, and it drove me nuts (for the repositories which Clang Format is not enabled).
Such behavior is gone after turning "Tools -> Option -> LLVM/Clang -> ClangFormat -> Format On Save -> Enable" to False.
I was pissed off every time I pasted anything in cshtml file in Visual Studio 2015, 2017. I tried different settings and finally found the proper one:
Options => Text Editor => HTML => Advanced => Paste (Format on paste) => False
You can tweak the settings of the code formatting. I always turn off all extra line breaks, and then it works fine for how I format the code.
If you tweak the settings as close as you can to your preference, that should leave you minimal work whenever you use refactoring.
In addition to Tango's answer for the actual solution, there may be people actually want to stay current with auto-formats but not have it screw up your relevant changes. I would suggest that you modify the file to have auto-format activate, check in those changes, then proceed with the actual changes you wish to make.
That way your code can stay up to date, but your check in will be relevant.
You might need to check on Tools-> Options-> Xaml Styler -> Format xaml on save
On the navigation options at the top select "Tools" and then select "Manage Extensions".
I had CodeMaid, Visual Assist, and Rosalyn installed. Seems like an update start to cause these auto formatting issues. I disabled them and do this fixed it.

CKEditor JavaScript error on IE8

I am using CKEditor version 3.6.1.
There is an error on IE8 when I put an empty row by "enter."
Here is an example:
writting test
writing test2
As you can see, there is an empty line between two sentences. When I click the empty row by mouse, I could not focus it to write something. To focus the empty row to write, I need to use my keyboard. Someone told me it's a JavaScript error on IE8. When I debugged it, I saw an error message like setSize == undefined. Does anyone know about this?
In addition, it's to hard to upgrade the CKEditor version, because I customized many codes.
It's impossible to help you if you use old version of CKEditor, you have modified it and you haven't provided us any idea what you have changed and what error and where do you have.

How do I stop visual studio inserting a space between function definition and immediate call?

I am using the visual studio JSLint plugin to keep my javascript in order, which seems to work really well apart from this one problem.
If I type in
x = (function () {
}())
And then put the semicolon on the end, Visual studio corrects it to:
x = (function () {
} ());
And then JSLint complains JS Lint: Unexpected space between '}' and '('.
Obviously this is fixable by removing the space, but visual studio is very persistent in putting the space back. Putting a semicolon anywhere inside the function, which is most of the file, will cause VS to put the space back. This is starting to get annoying.
I've tried mucking about with the visual studio Javascript editor settings ('insert space after...'), but can't seem to stop it doing this.
Another way this could be expressed is
x = (function () {
})();
Which VS leaves alone, but JSLint says JS Lint: Move the invocation into the parens that contain the function. So no dice there.
Any suggestions? I know I can turn bits of JSLint off, even just around this last line of the file, but that's going to look messy, I'd like to do a bit better.
UPDATED ANSWER FOR VS 2013:
In VS 2013, we seem to have more control. Go to Tools > Options window, then under Text Editor > Javascript > Formatting > Spacing you can deselect the second-to-last option that says "Insert space after function keyword for anonymous functions."
I had a pic but I can't post it :).
First of all you can make Visual Studio not so persistent if you switch off some default settings:
Another way is to follow not so exact the formatting rules of JSlint. You can just include
/*jslint white: true */
to switch off the white space formatting rule.
I don't have a better response than turning off whitespace formatting rule checking, but this is very unfortunate. As far as I can tell, this one situation described here is the only case were visual studio automatic formatting and jslint collide in a way you can't reasonable config your way out of.
Losing the entire whitespace checking for this source file, or losing the auto reformatting of the rest of your JavaScript, are both somewhat sledgehammer approaches to this problem. I'd love to see another creative option if anyone has one.

Categories

Resources