What's the code style setting to prevent PhpStorm from adding an extra indentation level when pasting arrays from clipboard?
The most obvious (continuation indent) does not seem to be the one:
It's Editor/ General/ Smart Keys/ Reformat on paste:
Setting it to Indent Block appears to fix the issue while keeping the auto-format feature working.
Related
I am fairly new to VsCode and HTML. I have it set to save on format and when I do it automatically places all elements on a new line. First of all, is this good practice? If so that's fine. If not, how do I stop it?
So I type this:
<p> My name is <b>Bob</b></p>
But it gets formatted to this:
<p>
My name is
<b>Bob</b>
</p>
Is it good practice to format code like this?
Seems like if the paragraph was really long with multiple elements within it then it could get quite confusing having a bunch of new lines right in the middle of the code.
If not then how do I stop VScode from formatting like this?
I have installed the prettier extension so I am not sure if its VScode or prettier that is actually making these changes.
Any help appreciated!
Thank you!
When you are in VSC, go to...
File > Preferences > Settings > Text Editor
Scroll down until you find:
Auto Indent and change full to none
maybe consider using prettier extension for formatting your code it take the load out of such indentation tasks..
Link to prettier extension LINK
What is the equivalent Atom Indent Guides like the one Bracket has showing vertical lines connecting matching beginning/opening and ending/closing brackets or keywords?
Atom supports "Indent Guides" and even names it the same, you can access the configuration by choosing Settings View: Open from the Command Palette
or by pressing Ctrl-, (Control + Comma). Scroll about two-thirds of the way down and there is a checkbox to toggle the Indent Guide on or off:
When enabled they look like this in the editor:
Also found an "improved" package in Atom if Atom's indent-guide isn't cutting it.
https://atom.io/packages/indent-guide-improved
Repo seems to be updated.
UPDATE: show indent guide option is now under Editor tab, in settings.
Screenshot:
Haha. I encountered this issue today too. If I understand your question correctly, you want to know how to enable this feature?
Go to preferences/settings and then scroll down and check 'show indent guide'.
Example
I have toggled every option that seems to make sense and have searched for an hour, but I can't find a solution. I'm sure I'm just missing some magic word, and the solution is probably simple, but how do you make PyCharm automatically unindent closing HTML tags?
For example, if I type:
<div>
Test
</
PyCharm will automatically fill in the div>, but it will leave the indent hanging.
Thanks in advance.
Update: Part of the reason why I was particularly annoyed by this problem was that I was unable to backspace to the appropriate indent level before typing the closing tag, so to put the tag on the correct level, I had to Shift+Tab or press Home then Backspace.
I found this answer that pointed me to Settings -> Editor -> General -> Smart Keys, where I set Backspace -> Unindent to To nearest indent position, instead of To proper indent position, which dramatically reduced the annoyance level of the original issue.
I'll leave this open, as automatically unindenting closing tags (or automatically setting them to the "proper indent position") would still be the most ideal solution.
PyCharm automatically adds the closing tag when you type the starting tag. So when i type <div> there will be </div> directly added.
I've tried various fixes with this, and it is really annoying me now.
Whenever I open a file as html, the default syntax for the file changes to HTML (RAILS). I can flip it back to HTML by the little select list in the corner, but it reverts. I've tried changing syntax specific files, setting extensions, etc. I even grepped HTML (RAILS) in my Sublime root folder recursively, and found nothing.
The thing that makes it hard to pin down, is that there is no extension difference. No matter which syntax highlighting I choose, the tag is the same.
I don't need syntax highlighting or autocomplete for HTML, but I do really like how matching tags are underlined in HTML syntax highlighting, and without it, I often miss unmatched tags, and cause lots of extra work for myself.
Any guesses on what this is / how to restore HTML to proper clean HTML highlighting?
(Note: The behaviour is identical for HTML and HTML5 and as I discussed in this post, I can't get tag matching to work in HTML5 anyway. That problem preceeded this one, but using HTML instead of HTML5 was an acceptable fix - that no longer works.)
In case anyone else has this bizarre issue, I've solved it.
There is a package installed (dont' remember if it was installed from the beginning, or if I added it) called Syntax Matcher. I commented out the following lines in a file called SyntaxHighlighter.py:
if self.ext == '.html':
self.set_syntax('HTML (Rails)', 'Rails')
return True
And the problem was solved instantly.
I am using MonoDevelop on Mac to write MonoTouch apps. Automatica code indenting/formatting works great while I am typing.
The problem is that when I copy and paste code snippets, in many cases I lose the formatting and lines are combined together, indenting is lost, and it is a huge pain to implement the tabs, spacing, and line breaks manually. Is there anyway I can use a command in monoDevelop to automatically indent and apply the formatting to existing code.
I thought maybe Edit|Format|Format Document/Selection would work, but these commands don't have any affect on the code at all.
Any help?
To format the entire document in one keystroke: control-I
To format a selection: Edit->Format->Format Selection
To customize the formatting: MonoDevelop->Preferences->Source Code->Code Formatting
You actually need to select all your text, and then go to Edit->Format->Format Document. It doesn't seem to work otherwise.
For me on macOS, the shortcut for "auto-format" is CTRL + i.
You can change the shortcut if you want. To change it, go to Preferences -> Key Bindings, then type "format" in the search box and edit the "Format Document" shortcut/key binding.