How to disable code formatting for copyright notice - intellij-idea

How can I manage to prevent the intellij-formatter to destroy my copyright notice, every time it tidies up my source code? The copyright comes from a template and starts with the first line of my source files, so there is no formatter-on/off option.
Well, crawling the topics I find a lot of (useful) information on how to disable formatting for specific regions of your source. But when it comes to copyright there's lack of information, though. I do not want to disable javadoc-formatting, there should be another solution out there. Any ideas on this?

There is a setting Generate "<p>" on empty lines under
Settings > Editor > Code Style > Java > JavaDoc > Other
Uncheck the checkbox.

use something like this:
//#formatter:off
your code / copyright
//#formatter:on
between off and on the code/copyright should be skipped for formatting
//#formatter:off deactivates the formatter
//#formatter:on activates the formatter again

You could try out the Copyright plugin.
https://plugins.jetbrains.com/plugin/88?pr=
It should be able to preserve your copyright notice at the top of your source files, and also apply it to new files or to existing files that are missing the notice on-the-fly whenever you reformat or check in a file.

While I was not able to preserve the proper layout with block comments, i figured out another suitable solution:
I used line comment formatting for the copyright header.
Thank you guys for your quick suggestions!

Related

Auto fold code on open file by a certain comment in vscode

Is there any extension available that has the ability to automatically fold possible code fragments like a switch when there is a certain comment in the appropriate line?
I think that one is exactly what you are looking for:
https://marketplace.visualstudio.com/items?itemName=bobmagicii.autofoldyeah
But! I never tried it

Change contrast in PhpStorm

I don't know, it may be off topic question. I am using Darcula theme in PhpStorm. I need to add more contrast (darker background, brighter text) in PhpStorm.
I googled a lot but I could not find appropriate answer for changing that. Is there any way to do that?
While this post is dated, searching for an answer to what I believe to be a similar problem brought me here. In my case I could not easily read the line numbers on my display. The contrast was too weak.
I will answer this with the steps I took as it may help others who stumble onto this:
To configure it I opened Settings/Preferences dialog, and under the Editor node, clicked Colors & Fonts and then the General section. In this section I was able to find Code => Line number (in my case). In the case of the OP the section will be Text => Default text.
There you can change the colors and contrast directly to your liking.
#Dom: Thx for your answer. It helped me to enhance the contrast.
In the IntelliJ IDEA 2018 Version you can find this under:
File > Settings > Editor > Color Scheme > General
From there choose:
Text > Default Text

Why won't my console display the copyright symbol ©?

I am trying to write a C# console application the displays the copyright symbol ©. According to this StackOverflow answer that should be possible. However, on my Windows 8 console display I get the lowercase letter c printed out. What could be wrong?
Found the solution. Add this before your Console.WriteLine commands:
Console.OutputEncoding = Encoding.UTF8;
That same sample you linked to works if I do that.
Credit for the solution: How to make console be able to print any of 65535 UNICODE characters
Marking this as community wiki since I'm not really the one who knew the answer.
Are you using a custom font for your console? If so, that font may not have support for the (c) character.

Notepad++ stopped color-coding my source code... How to fix?

For no apparent reason, it just stopped. No more color-coding. Is there a mystery setting I accidentally turned off?
I had the same problem and discovered it was because I had enabled global foreground color under Global Styles.
Try out the following:
Select a language manually from the "Languages" menu.
In Settings/Preferences, check the File Associatons.
In worst case, reinstall.
In the Language menu select your corresponding language. For example H and then html
The solution for me was to go into the Style Configurator, select the 'Global Styles' from the Language selection box and uncheck the 'Enable global foreground colour' option. I am not sure why that was checked, but all of the code coloring worked after unchecking it. Thanks Richard!
Have a look in Settings -> Style Configurator. Maybe your styles got messed up somehow. You could try changing the selected style to see if it makes a difference.
I think the saved styles are stored in the "themes" directory under your Notepad++ installation directory, so you could also check that the files have not become corrupted in some way.
I had the same problem (I Googled "notepad++ file coloring quit" to find this discussion.) In my case the coloring quit mid file in a single file. I finally realized that adjacent string literals with one of them a macro was fooling Notepad++.
My code that broke it read:
Write_Supplemental_Configuration(privateData->new_config, FTP_ROOT_DIR"/lists.csv");
and the fix was to add a space after the macro:
Write_Supplemental_Configuration(privateData->new_config, FTP_ROOT_DIR "/lists.csv");
I tried replacing the macro FTP_ROOT_DIR with "foo" and the problem went away.
So in my case it was a macro that fooled the Notepad++ coloring.
watch out for the single quote that you copy from the web. if you get one of those "upper commas" instead of the tic mark it will confuse the code and kill the coloring (in SQL). just delete and replace.
Make sure that when you save the file it's saved as an .html instead of a .txt. This make a difference because the .html allows you to see the different colour codes whereas .txt doesn't.
Check, if you have saved the documents as .HTML and not as .txt
in the menu, choose Settings>Style configurator...
and in the list in the left pan select html, check if the colors for different tags are being shown in the color blocks. if yes, chosse a font and then save and exit.
Check only after you save the document in .html, whether it is working or not.
The language setting solved the issue for (all) 3 Javascript files (.js) which suffered from it, which previously were all recognized correctly as Javascript. For some reason it forgot they were Javascript files apparently!?
First type any thing and Save the file in any format you are working with (i-e; .cpp if c++, .js if JavaScript....etc)
And make sure global foreground color is disabled.
And it should work fine.
File > Save As > Format Type = Structured Query Language > Name the file with '*.sql'. THIS SHOULD BRING ALL THE COLOR CODES.....to differentiate your code and make it look pretty. J
If you want to display text in SQL format, then in menu select Language => S => SQL
Got to Setting -> Style Configuration and remove the global style checkbox
I just had the same thing happen to me. The only way I could fix it was to rename the file (I just added one character). Then open it with notepad++. The code was colored again. Then renamed the file back to the original name and it is still colored.
I have since found that if I close Notepad++ without closing the file first this happens. Try closing the file first then close Notepad++ then reopen the file.
This bug seems to be fixed as of version 7.8.6
If the coloring only stopped working for one file, you should check the extension name of your file. You might have accidentally saved the file as .txt
A couple years late here, but I'm pretty sure you're opening ".txt" files that contain your source code. Because the file doesn't have the language's extension, Notepad++ can't determine how to color-code it. You'll have to select the language under the "Language" tab.

How to Pretty print VBA code?

How do you copy VBA code into a Word document and retain the VBA editor color scheme?
You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included!
Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb, go to Language -> VB or Language -> V -> VB).
If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.
Then, go to Plugins -> NppExport. From there, you have three options you can consider:
Directly print from Notepad++
Copy all formats to clipboard
Export to RTF
Export to HTML
The first is self explanatory. The second one - "Copy all formats to clipboard" - will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word or your other favourite document editor, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.
There are two programs on cnet downloads, which are free to try. In case you did not try them, here are the links:
VB-VBA Code Formatter & Printer 2.2
VBAcodePrint 6.13.110
Smart Indenter could be what you're looking for? You'd load the result into Notepad++, set language to VB and save as .rtf/.doc (or print to file, can't remember off the top of my head).
For a more modern approach, Sublime Text users can install ExportHTML from Package Control. This has the added benefit of being able to include the line numbers, and changing the code coloration.
HTML files can be opened directly within Word.
Highlight supports a wide range of Operating Systems and 150+ languages including Visual Basic, although I'm not sure about VBA.
I would recommend this one: planetB
It works well with Internet Explorer (didn't work wit Firefox for me, not sure abt Chrome).
Plus it's online, so no need to install anything (the case of Company/University PC's)
Regards
Wheeliam
The following works with Visual Studio Code:
Start VS Code.
New file.
Copy & Paste the VBA code into the VS Code window.
In the lower right-hand corner, click on "Plain Text" and select "Visual Basic" instead. Note that the code is now syntax-highlighted.
Copy & Paste the formatted code into Word.