I'd like to remove Bite Order Masks from my
UTF-8 files in Intellij IDEA, how can I do this?
The problem is that if I'm trying to do it via other editors (e.g. Akelpad),
when I modify the file later in IDEA it somehow remembers that BOM
was present and adds it to my file again (((
Tested on PHPStorm 8:
Right click on a file in the project tree,
click on "Remove BOM"
(Not sure if it exists on the base platform, comments will be helpful)
There is no such action to remove BOM from UTF-8 files in IntelliJ IDEA. There was a bug that BOM is removed, but it was fixed a long time ago.
When you remove BOM externally, make sure the file is synchronized with editor, try File | Synchronize.
If IntelliJ IDEA still thinks that this file has BOM, please file an issue with the steps to reproduce.
Intellij Idea has an option, File->Remove Bom, but it looks doesn't work very well, I got "This file has mandatory Bom" error
The following tips work for me
1) create new empty file (for example: temp123.java)
2) make sure that code-page/encoding for that file is UTF-8
3) copy whole content from original to newly created file (select all, copy, go > to another tab, paste) and save
I referenced link below, can be combined with Intellij Idea File->File Encoding-> Reload/Convert to UTF-8
IDEs Support: Remove BOM from file - how ?
I had the same Problem.
I found this issue and a "works for me"-fix:
http://youtrack.jetbrains.com/issue/IDEA-86880#comment=27-386505
Hope it helps
Related
I'm using PhpStorm and for some reason in all of my projects the header.php file got messed up. It's just greyed out and PhpStorm doesn't recognize the PHP in the specific files named header.php. The rest is working fine.
It's driving me crazy and I can't figure it out. I already checked file templates, reset it to default. Nothing helps.
I would appreciate any solution, thanks.
Go to Settings/Preferences | Editor | File Types
Locate Text entry in top table
Locate and remove header.php (or very similar one) pattern from bottom table and remove it.
Right now you have somehow told IDE to treat such file as Plain text and it does it for all files named header.php regardless of their location (quite likely it happened when you were creating new header file and forgot to enter .php part).
I created a file named "auth_actions.dart" in a dart project(either angular or not). The file content would have text colour being plain white, without any highlighted.
If I rename it to "auth_action.dart" or "auth_actionss.dart", the highlight will come back.
I did some experiments even from some random projects downloaded from github, all of them had this issue.
Anyone know how to fix it? Does anyone see the same issue using the name "auth_actions.dart"?
I assume you accidentally added the file to
Preferences > Editor > File Types > Recognized File Types > Text
Remove it from Registered Patterns to get hightlighting again.
You could accidentally mark it as plain text (the option is in the right-click menu). In this case, the option to mark it back as a Dart file is also in the context menu.
I have intellij 13.1.3 Ultimate and have been using it for my PHP projects. All my files.php are nicely hightlighted for php.
This morning I had to create a new file called "report.php". At first I create it with right click > new > file, but this gave me no hightlighting. So I deleted it and tried again with a right click > new > php file with same result. Now what ever the way I create it, it thinks the file is txt (it seems so) and there is no code highlighting. It's pretty frustrating.
I have tested the creation of a new file with a different name "reports.php" but this time with right click> new > PHP file, and it came nicely highlighted. i tried to rename the file to "report.php" but it came back to no highlighting!!
It seems Intellij is stuck with the name report.php being a type text.
I tried to delete the file, restart the IDEA, recreate it the right way, no luck.
I tried power save mode on, and off. No luck.
I tried File > invalidate cache/restart, ... no luck.
I'm out of options here...
Is there a way to FORCE intellij to interpret a file? Is the name "report" a reserved word?!?!?
How can it be so stupid...
edit: I also tried the suggestion in : IntelliJ: how to force editor to treat a file as javascript? but php is not in the list of the Template data language
Also in settings > file types, I saw two Php file entries. One with no extention, and one properly configured. I deleted the bad one but it reappears after a restart of the IDEA!
Please go to Settings | Editor | File Types and remove the association of "report.php" with the text file type. (The erroneous association was created because of a bug in IntelliJ IDEA, but unfortunately we don't currently have specific steps to reproduce for it.)
Webstorm doesn't recognize one of my .js files as a JavaScript file so I'm losing syntax highlighting and being able to add break points. I've looked in the workspace.xml file and the file in question seems to have similar settings to other .js files that work correctly.
If I change the name of the file it works ok. So somehow Webstorm is stuck on misinterpreting the type of a file that has this name. Where else can I edit the project?
So I see three possible reasons for the problem:
The file was marked as 'Plain text'
There is a pattern for 'Text files' file type that matches this file (or back: file type 'JavaScript' exclude this file name). See image below
There is a custom plugin that overrides default behavior for files with this name (unlikely)
Updated: after several years I've found one more reason for the behavior and most likely it the main source of the issues. When you create a file without any extensions the "Register New File Type Association" is appeared. And you can accidentally specify a new file type, for some file name. It is can be fixed with (2) but it is the reason why the pattern was added there.
Note: the solution works for all IDEA-based IDEs: IntelliJ IDEA, WebStorm, RubyMine, PyCharm, PhpStorm.
File -> Settings -> Editor -> FileTypes -> Text files -> check for "ContentRepository.js" pattern there and remove it.
If the file was marked as "Plain Text", then this can be fixed as follows:
Right click on the file.
One of the menu options is "Mark as Javascript" . Just below "Delete".
Click that. Your file is now recognized as javascript by WebStorm.
Since WebStorm was not allowing screenshots after right click so couldn't add it here.
My problem was with Auto-detect file type by context
For me this did the trick
1) Preferences
2) Editor
3) FileTypes
4) Search for javascript
5) Add *.js to registered patterns
You can also try "Template data languages" (in file > settings) which will force a specific language synatax high-lighting on a specific file or folder. See screenshot below
For a block of code you can also use "language injection". Simply high-light the block of code, wait for the little lamp to appear then select the bottom choice and then the language you need (screenshot also attached)
In case it is helpful elsewhere (OMG this was scary).
For some reason IntelliJ was not recognizing any .js file in my project (even after .idea removal (rm -rf .idea)).
I went to Webstorm (in my case RubyMine): Webstorm > Preferences ... > Editor > File Types then went to Recognized Filed Types, picked Javascript (but whatever file type you are missing will do), then added back a Registered Patterns entry of *.js
Of course, press Apply and then Ok.
Wow, scary stuff. but solved my problem, hope it does for someone else.
I was always trying to add .js as a recognised file types, but somehow .js was added to Ignored Files and Folders.
I just removed .js from Ignored Files and Folders and it worked for me.
Preferences
Editor
FileTypes
Ignored Files and Folders
Remove *.js
2022 update!
Right click on file and choose JavaScript
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.