eclipse editor is not formatting code as specified - eclipse

Although my eclipse html editor is configured to add indentation
it is not indenting my html file correctly. I am trying to use ctrl+shift+F and save action. Could some one please help me how to enable indentation on saving or formatting.

This might be the problem. Check the current formatter for HTML files in your machine. For example I have default Formatter for C/C++ source files. Its is named as K&R[built-in].
See below
Like this you can also check the formatter for HTML file and click on Edit button. New window will popup showing the all details of this formatter. Go to Indentation tab. In General settings group, change the tab policy option from Tab to Spaces then enter the indentation size, save and exit then check.

Related

CodeSandbox editor has stopped auto completing the corresponding JSX closing tags?

CodeSandbox editor used to auto generate the corresponding close tag for the current tag.
For example:
<div> // THEN IT WOULD AUTO GENERATE THE </div> TAG
But don't know exactly when, it stopped doing that, and I have to write it manually. Is there a way to enable this autocomplete again?
In the codesandbox.io go to:
File -> Preferences -> Settings
In the Search Settings box type Javascript Autoclosing Tags.
Enable that feature by checking the Checkbox.
Just posting an updated answer since the UI has changed for codesandbox. I believe this answer is now slightly better:
Press cmd+, (ctrl+, on a windows) with the editor focused (this opens the vscode settings)
You should see a settings page like so:
In the Search Settings box type Javascript Autoclosing Tags
Toggle the checkbox on
In my case the auto completion works if a change the extension of the file to .jsx and if I start typing the tag without the <.

Disable colors and format to source code in Eclipse

Is it possible to disable formatting and colors to source code in Eclipse.
I want my java code look like the poor notepad (black and white, etc). don't ask why, I just need answers. Thanks.
I don't think there is a quick way to do this as it is such an unusual thing to do. But you can change the syntax coloring options in the Preferences in 'Java > Editor > Syntax Coloring'.
Changing syntax coloring options as suggested earlier is a good way to achieve that.
You can also consider just not using the Java editor and using the plain text editor instead: to do so, either open your files with right-click > Open With > Other... and select the regular Text Editor. From the Editor Selection dialog, you should be able to override the default editor for your Java files to this Text Editor.
Note that the text editor doesn't provide completion, or documentation on hover, but you'll still get validation/problem reporting.

How do I disable brace highlighting in JetBrains RubyMine?

I want to disable brace contents highlighting in RubyMine. It's very distracting. Instead of having the entire string highlighted I only want the braces themselves highlighted and if that is not possible I need it disabled. Is this possible?
Things I've done already to no success:
Enabled/disabled all highlight options under Settings/General to no
effect. I'm running RubyMine v8.0.3.
Read the documentation.
jetbrains.com/idea/help/highlighting-braces.html?search=highlighting
I've also read this document that states how to disable highlighting
of usages by simply pressing escape - it does not work.
jetbrains.com/idea/help/highlighting-usages.html#3
current brace highlighting that I need disabled
Your file type seems to be HAML.
In Settings, go to Editor > Colors & Fonts > HAML. In the lower right area, you see demo code in HAML. Look for the right spot in the code and click on it.
You will probably click on the second line because there is some code in braces. In this case, RubyMine will select the entry Injected code in the list. The check box Use inherited attributes tells you that this settings is inherited.
Now you have to choose:
If you want to change the setting for Editor > Colors & Fonts > HAML - Injected code, switch off Use inherited settings, then switch off "Background".
If you want to the settings for injected code in all languages: Click on the link "General" (on the right). RubyMine will switch to Editor > Colors & Fonts > General - Injected language frament. Now switch off "Background"
Before modifing anything, you have to create a new scheme. The default scheme is read only. Click on Save As..., choose a name and press 'OK'.
Open the Settings/Preferences dialog.
In the Editor page of the IDE Settings, select the check box Highlight usages of element at caret to enable automatic usage highlighting.

Only one editor per file in eclipse?

Eclipse PDE documentation claims:
You can think of the input object as the document or file that is
being edited. Changes made in an editor are not committed until the
user saves them.
Only one editor can be open for any particular editor input in a
workbench page. For example, if the user is editing readme.txt in the
workbench, opening it again in the same perspective will activate the
same editor. (You can open another editor on the same file from a
different workbench window or perspective).
Obviously it is possible to open a file using different editors - for example .java file using default java editor, and then text editor (by 'open with'). Is this part of the documentation wrong? Or is IEditorInput different for these two editors? I'm just wondering.
It was like that originally, and I think their point was double-clicking on an already open file will just bring it to the front, not open a new editor with the same information. Tht's still true, but that's not the whole truth :-)
I believe that section needs to be expanded, as I'm pretty sure the capability you refer to has been there for years as well. There's a "New Editor" entry in the editor tab context menu that allows you to open the same file in the same type of editor too.

How to set default editor tab in Eclipse?

I'm using the HTML editor resp. the Structured Text Editor in Eclipse. It always opens in the tab Visual/Source:
Is it possible to tell Eclipse it should always open this editor in the Source tab?
You seem to use a plugin which associates with HTML files. For example Eclipse normally loads XML files for the first time with Design tab, and once you switch to source tab, it remembers the next time to open any document associated with XML Editor in Source tab. I don't know remembering is up to Eclipse or up to the plugin associated with the file, but a quick workaround would be:
to right click on the HTML file in package explorer > Open With > choose another editor (e.g. text editor). This only associates with current file. If you want to change file association for all HTMLs:
goto Preferences (under menu Window) > General > Editor > File Associations and change HTML file association there.
In Eclipse goto Windows-->Preferences-->Type Editors change the associated editors for File Types after that click on OK
You didn't say what version of Eclipse you're using. My HTML / Structured Text editors didn't have the tabs the same as yours. I'm using 3.4.2.
You can extend that editor by writing your own plug-in for Eclipse. Outside of the 'create a plug-in project' stuff, start by finding the extension points for the target editor. Then your plug-in can just register as an extension and add a new property instead of writing a whole editor. The property should show up on a preference page and then your code can take care of switching the active view of the editor to the 'Source' tab based on that property.
Right click the file and then "open with" and open it in another HTML or texteditor.
And then map this editor as the default editor for this filetype by right clicking the document and setting the file extension.
I always do this to get rid of the memory greedy WYSIWYG editors.