Xpages source formatting - xpages

I wonder if there is anything more advanced for source formatting of Xpages than what is built-in to the editor. In particular I would like to remove white space from the code.
Anything out there?

I use the "Clear all blank lines" option in the DDE File > Preferences > XML > XML Files > Editor. There are a couple options there you may find of use, such as ensuring "Insert whitepsace before closing empty end-tags" is un-checked and whether you choose to "Preserve whitespace in tags with PCDATA content". It may not be "advanced", but is usually serves me well.
Reminder, XPage design element formatting (XPages, Custom Controls) is for readability only, as they get compiled into Java classes on project build (visible in Project Explorer, under Local > xsp).

Related

Microsoft Visual Studio 2022 - Stop All and Any Formatting

I absolutely hate that Microsoft Visual Studio reformats my code. I'm constantly fighting with it. Over the years I've tried several versions and numerous settings but nothing stops the blighter. It insists on reformatting everything and as a general rule making a mess.
Automated re-indenting and alignment when applying brackets\braces or pasting in C#, Razor, HTML and JS files are my main pain points.
Seriously, it's a productivity issue and it drives me nuts 🥜. I know this question has been asked many, many times before, but surely, in this day and age there's a way to simply turn it ALL off?! Please tell me somewhere out there somebody knows how to do this.
Reference: Using Microsoft Visual Studio 2022 17.3.0. Community Edition. No plugins (Resharper etc.). All settings reset to defaults (using Tools > Import and Export Settings Wizard, Reset all Settings)
Side note: I know other IDEs exist but some projects just need MSVC and I'm not looking to change editors. Although I'd accept answers which recommend a plugin guaranteed to solve the problem.
This will not fully solve the issue but hopefully will already help so I'll post it as an answer.
Even without Resharper there are a lot of options under Text Editor settings and this allows you to control (to a certain extent) how the IDE formats your code, but sometimes it's option A or B and not "both" or "any". This means depending on what you type formatting will happen anyway, however as most people always format in a particular way, spending some time tweaking this is worth so once it is done it will be much less painful. Also the vast majority of settings is per specific language and not in the same structure, which does not make it easier. For C# - Braces for example, here's where to start:
Settings > C# > Code Style > Formatting > New Lines: all "Place open brace..." settings
Regarding the other main pain point (pasting) these should help:
HTML
Settings > Text Editor > HTML > Advanced: Set "Format on paste" to False.
JS
Settings > Text Editor > Javascript/Typescript > Formatting > General > Automatic Formatting: Uncheck "Format on paste"
C#
Settings > Text Editor > C# > Code Style > Formatting > General: Uncheck "Automatically format on... (all options to disable all)

What can I do so MD files would be more visible in Notepad++?

I have a problem. Content of files in md file format is barely visible in Notepad++.
I use "Solarized" style/theme. I cannot see a way to change the look just for md files alone.
Files written in python, txt, C++ are handled OK. Just MD files are causing issues.
Image attached: image
Is there a way to do something about it?
I don't think Notepad++ has a built-in "Language" for Markdown. You've probably installed a plugin, or somehow imported a user-defined language. To make adjustments, go to the menu Language > Define Your Language... and examine the dialog.
Make sure you choose "Markdown" from the drop-down box at the top of that dialog window.
Under the tab "Folder & Default", click the "Styler" button for "Default Style". Select a nice neutral grey or whatever suits your fancy with that theme. If there are other colors which are difficult to read, they can be adjusted similarly in the other tabs.

Spell check contents of Rich Text Content Control

I am having an issue with Word 2013 and spell checking the contents of Rich Text Content Controls.
I am currently working on a project where text is inserted (via a Word Add-In) into a pre-defined document template which makes use of Rich Text Content Controls. The inserting of the data into the content controls all works great, but I am having an issue where the newly inserted text within the content controls is not being spell checked by Word 2013.
I have read numerous posts on line which suggest that 'grouping' the content controls in the document resolves the issue, but haven't been able to implement this fix.
Text outwith the content controls is being spell checked, but any text within the content controls is not.
Steps to reproduce:
Open Word 2013 and create a new blank document.
Ensure that the DEVELOPER tab is enabled (if not, see instructions here)
On the DEVELOPER tab, enable Design Mode under the Controls group.
Still on the DEVELOPER tab, under Controls, add a new Rich Text Content Control.
Amend the default "Click here to enter text." so that it contains a spelling mistake.
On the DEVELOPER tab, exit Design Mode.
On the REVIEW tab, choose Spelling & Grammar. You should observe that the deliberate spelling mistake within the content control is not recognised.
James, the text you edit in the Rich Text Content Control is what is called the Placeholder Text. This text is to be defined by the 'content' developer.
This text won't be part of the Spelling & Grammar review as the Placeholder Texts are 'constants' defined by the developer, hence the reason why they are under the Developer tab.
So it is advised to first put the texts that you want to use in a Placeholder in a normal document, do the spell check and copy them over and apply to the Placeholder Text.
I think it is fairly reasonable not to include the Placeholder texts in Spelling & Grammar as:
It will take time to process the fixed assets
End users may not have access to the Placeholder Texts to edit the 'mistakes'

XML attributes order in Android Studio

I'm facing problem with keeping proper order of XML attributes in Android Studio. As you can see below, the style attribute is between layout_* attributes, but I want it to be ordered by name (like in Eclipse). I'm using standard Intellij code formatter and the Android Studio gives users ability to set your own rules regarding XML ordering. The settings are located in Code Style -> XML -> Arrangement, but it seems not to work or I'm using it wrong. Any ideas how to order XML attributes by name using default code formatter?
<TestView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
style="#style/BackgroundLight"
android:layout_height="wrap_content">
</TestView>
Finally got it.
Choose File > Settings > Code Style > XML > Set from > Predefined Style > Android
Set File > Settings > Editor > Formatting > Show "Reformat Code" dialog
Run formatting on a XML file (CTRL+ALT+L by default)
You will see a popup window, set the Rearrange entries flag
Disable Reformat Code dialog in the settings
This way every XML file formatting will set the attributes in a proper order.
Edit:
Starting with Android Studio 0.2.6 release the XML Android style formatting is set by default, but you still have to set the Rearrange Entries flag manually.
http://tools.android.com/recent/androidstudio026released
Automatically apply the Android XML code style if a code style hasn't
already been customized. This will make it possible to automatically
order XML attributes (check the "Rearrange Entries" checkbox in the
"Code > Reformat Code..." dialog.)
UPDATE: the method I described below is an official way to fix this known issue, see: https://developer.android.com/studio/releases
After updating to the newest Android Studio v3.4.2 I found that it doesn't format XML code properly anymore. For instance, attributes ordering didn't work in layouts. It did indentation and namespaces ordering only.
I don't know the reason why it was broken after an update but was lucky to fix this:
Go to Settings (CMD + , ) on Mac.
Type format in Search box and click on Editor -> XML setting.
Click on the Android tab and make the same settings here as it's on a picture:
Settings on a picture quite normal, but of course you can tune this tab setting up to you.
Go to the Arrangement tab and you will see something like this:
The reason why attributes are not getting sorted - sorting rules are empty.
To fix this:
Choose Scheme and play with Default IDE and Project options. Switching between them may help.
Or choose Scheme which suites your needs and then click on Set from... blue text in right upper corner -> Predefined Style -> Android. You will see restored rules in the window:
I also chose Force rearrange - Always
To save result – click Apply.
Also you can click on a gear icon near Scheme and copy settings or even restore defaults.
P.S. To me standard rules are comfortable, but it can be customized further. Here is an article which may help doing this: https://medium.com/#VeraKern/formatting-xml-layout-files-for-android-47aec62722fc
Go to your layout XML
Try Ctrl + alt + shift + L then find checkbox label is Rearrange code and checked its.
To delete empty lines between them:
Preferences > Code Style > XML > Other > Keep blank lines: 0
And then just reformat your XML files.
There is a plugin for IntelliJ which might do what you're after...
http://plugins.jetbrains.com/plugin/?idea&pluginId=6546
File > Settings > Editor > XML > Arrangement Select Scheme and choose Default

How do I open a new tab when searching in Aptana Studio 3?

Kind of a newbie question.
Sometimes I use the project-wide search feature, and my search results appear listed in the window below, along with the related hierarchy placement.
Let's say I double click a file. It opens. Fine.
However, if I double-click again on another file in the search results window, it will replace the file I just opened. It's impossible for me to open multiple search results, short of manually opening them from the project view.
It wasn't always this way - it worked when I first installed the program, but something changed about three days in and I can't do it anymore.
Thanks!
Go to Preferences > General > Search and uncheck Reuse editors to show matches.

Resources