Eclipse formatting cause CSS to stop working - eclipse

I have following CSS in my style.css:
.btfl-alert-warning:not(.selectize-control):not(.selectize-dropdown-content):not(.selectize-dropdown)
{
//some properties
}
Now, when I use Eclipse formatting, eclipse make space between 'not' and parenthesis and I get something like this:
.btfl-alert-warning:not (.selectize-control ):not (.selectize-dropdown-content
):not (.selectize-dropdown ) {
}
After using formatter second time it looks much worse, but the point is after adding this 'space' this selector just stop work. I checked all CSS formatter options in Eclipse but nothing helped me.
Do you have any idea how to prevent ruining this CSS?

You could go to Preferences -> CSS -> Code Style:
Then modify it as you want it to show.
In the case you can't make it in the CSS(Code Style), you might don't apply the format in eclipse, it is fine to do all the work in Eclipse, once you finish when you have a production ready CSS/HTML/JS/.... you can use atom from GitHub to apply format to your CSS/HTML/JS/.... use the plugins from AtomLinter
I hope this helps you.

I ended up using additional css file called style_do_not_format.css which contains only that css and comment about not formatting this file because it cause css to stop work. In my style.css file i use
#IMPORT url("style_do_not_format.css");

Related

monaco-editor: vertical line padding

Inspired by IntelliJ's 3 panel merge conflict view, I am trying to build something similar for vscode. I figured out, that I can integrate three complete customizable monaco-editors within a vscode Webview. But I cannot figure out, how monaco-editor applies the line padding in its diff-view like in the picture below (as I don't want to have a two-way but a 3-way diff using the internal diff-view is not an option for me):
Is it done through custom lineNumbers: lineNumber => isPaddingLine ? '' : lineNumber - someOffset, and inserting empty lines ("padding lines") at the related place and apply a deltaDecorations to those lines?
I hope there is a more easy way, which does not need the "padding lines" hack. Ideally I could just add something to a deltaDecoration like padding-bottom: $Xem
If I have just overlooked a way with vscode's api to achieve something like that, that would be of course more welcome than to deal directly with monaco-editor.
Thx a lot for any help / ideas :)
I finally found it :) IViewZone is the used magic.
And https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-listening-to-mouse-events is a nice example

TinyMCE: paste_enable_default_filters retain colors, img and font-size

Using TinyMCE 4.4. i like to get rid of pasted MS-Word-stuff. "paste_enable_default_filters" is a pretty tool for this. But i also like to prevent img, colors, font-size and -docorations on pasting. Since paste_enable_default_filters = true is set, paste_data_images and paste_word_valid_elements seems to be suppressed.
Any idea is welcome!
The Paste plugin has many options to help you control what is pasted and what is removed: https://www.tinymce.com/docs/plugins/paste/
In particular you may want to look at paste_word_valid_elements:
https://www.tinymce.com/docs/plugins/paste/#paste_word_valid_elements
...as this will allow you to control what tags are brought over during the paste.
You may also find value in paste_retain_style_properties:
https://www.tinymce.com/docs/plugins/paste/#paste_retain_style_properties
...as this will allow you to determine which styles should be retained during a paste.
If you want to have more control (beyond what the options on the Paste plugin perform) you can always use paste_postprocess to perform your own custom logic on the pasted content:
https://www.tinymce.com/docs/plugins/paste/#paste_postprocess

Netbeans Code Templates Formatting syntax

I'd like to know what's the syntax or the language used to format the code templates in netbeans ide. I mean, in the default templates I can see things like;
while (${EXP default="exp"})
{
${selection line}${cursor}
}
And:
// <editor-fold defaultstate="collapsed" desc="${comment}">
${selection}${cursor}// </editor-fold>
And I experimented and did this:
int ${IDX newVarName default="loop"};
for (${IDX} = 0; ${IDX} < ${SIZE int default="size"}; ${IDX}++)
{
${cursor}
}
And it works but I don't really know where the "${IDX}" or the "${SIZE int default="size"}" or the "${selection}${cursor}" comes from and what other statements can I use to format my templates.
Is this some scripting or programming language?
Where can I find this information?
I think Netbeans uses the template engine Freemarker for this. So all variables (= ${...}) are filled in by Netbeans at the time you use the template.
Unfortunately I don't have a full list of all default variables / methods you can use, but here are two of them listed:
${cursor}:
defines a position where the caret will be located after the editing
of the code template values finishes.
${selection}:
defines a position for pasting the content of the editor selection.
This is used by so-called 'selection templates' that appear as hints
whenever the user selects some text in the editor.
See here: http://wiki.netbeans.org/Java_EditorUsersGuide#How_to_use_Code_Templates
${IDX} looks like a custom variable you use.
See also:
- Code Assistance in the NetBeans IDE Java Editor: A Reference Guide (Code Template)
- Code Templates in NetBeans IDE for PHP
How_to_use_Code_Templates pretty much covers everything there is.
Looking at CodeTemplateParameter.java shows there is another hint called "completionInvoke" which requests showing of the code completion popup for the currently focused text component, but that is all.

Eclipse auto-formatter, disable auto line-wrapping of comment lines

I love eclipse auto formatting, but there's one feature that's driving me raging mad:
Since I use wrap-lines in my auto-formmatter, code like this:
private static Location _location = null; // this is a comment
turns into horrible, horrible code like this:
private static Location _location = null; // this
// is
// a
// comment
this is not only painful to watch, but not at all convenient to change back...
Is there any way to remove line-wrapping for comments, or at least fix so it doesn't look like an absolute mess?
Thanks
I think that the thing you are specifically asking about you can achieve by editing your formatter:
Window -> Preferences -> Java -> Code Style -> Formatter. There edit you click on Edit...
If you are using the default Eclipse formatter you will need to edit the profile name (you cna not edit built in profile).
Go to comments
Deselect line comment formatting.
That way no formatting of comments of the type // will be done.
This annoys me also. To fix the wrapped comments you can use the keyboard shortcut CTL+ALT+J to join the comments onto one line. The comment-indicator characters (// or *) will still be there but at least it will save you some steps. Then you can just run a find and replace for the comment-indicators.

Does the Eclipse editor have an equivalent of Emacs's "align-regex"?

I've been using Eclipse pretty regularly for several years now, but I admit to not having explored all the esoterica it has to offer, particularly in the areas of what formatting features the editors offer.
The main thing I miss from (X)emacs is the "align-regex" command, which let me take several lines into a region and then format them so that some common pattern in all lines was aligned. The simplest example of this is a series of variable assignments:
var str = new String('aString');
var index = 0;
var longCamelCaseObjectName = new LongNameObject();
After doing align-regex on "=", that would become:
var str = new String('aString');
var index = 0;
var longCamelCaseObjectName = new LongNameObject();
Now, you may have your own thoughts on stylistic (ab)use of white space and alignment, etc., but that's just an example (I'm actually trying to align a different kind of mess entirely).
Can anyone tell me off-hand if there's an easy key-combo-shortcut for this in Eclipse? Or even a moderately-tricky one?
You can set the formatter to do this:
Preferences -> Java -> Code Style -> Formatter. Click 'Edit' on the profile (you may need to make a new one since you can't edit the default).
In the indentation section select 'Align fields with columns'.
Then, in your code CTRL+SHIFT+F will run that formatter.
That will of course run all the other rules, so you may want to peruse the various options here.
Version 2.8.7 of the Emacs+ plugin now supplies a fairly complete align-regexp implementation in Eclipse
If you wish to do something more complex than just aligning fields (or anything else the Eclipse code formatter offers you) you are pretty much left with having to write your own plugin.
columns4eclipse is a nice option. It is an Eclipse plugin that allow you to do the alignments you mention in your question. I use it with Eclipse 4.3 and 4.5, it works well. I had made a gif video showing its use but my answer got deleted by a mod, so I let you try and see by yourself.
This plug-in does exactly what you want: OCDFormat
It works in all text files, not only Java.