Set syntax for current file in PHPStorm - ide

Simple question: Can I make PHPStorm to display the current file with a certain syntax highlighting?
Maybe even make the IDE remember it for that particular file in that particular project?
Background: I got a Laravel .env file which I'd like to display with the highlighting for .ini files without generally setting that highlighting for all .env files.

Related

How to add a file to version control in IntelliJ?

When I create a new file in IntelliJ IDEA, it gets automatically ignored by Subversion, no matter what, and it is impossible to commit the file. While in Spring Tool Suite all I need to do is right click and select Team>Add to version control in order to commit that new file. I have try several approaches with no success since many options are disabled.
When I create a new file in IntelliJ IDEA, it gets automatically ignored by Subversion
What do you mean by automatically? There is no any automatic rules - file is either configured as ignored, or not. Make sure there is no svn:ignore property set on the folder (probably not since other tools work).
Also, make sure nothing wrong is added to Settings | Version Control | Ignored Files. The description looks like you have the entire project or sources folder added there as ignored
Finally I found a solution: the problem was that a parent directory was being ignored by SVN, so I searched directory by directory starting with the current directory until I found a parent directory that had a configuration to ignore all directories, for this task I used tortoise, just right click and select TortoiseSVN>Properties look for ignored files and delete the directory you want to synchronize, if no you donĀ“t find the directory look for (*).

How Can I Permanently Change File Extension Associations in IntelliJ IDEA 2017?

Simple deal. I change a file extension association in settings, and it works, but Intelli-J IDEA rather unintelligently changes the file extension back to what it was before I set it, everytime the IDE restarts.
I use the file extension for my own development purposes, and I don't need to open files of this type from within Intelli-J, unless I want to edit the file with IntelliJ's text editor.
For whatever reason, I don't get a choice, and cannot find an option to disable this automatic file extension association re-assignment.
How Can I Permanently Change File Extension Associations in IntelliJ IDEA 2017?

IntelliJ changes file type

I am having a quirky intellij problem.
I have a folder with a bunch of json files. When I add a specific json with name
LocalValueCode.json . InteliJ changes the file type to .file .
This only happens with this file specific filename. In file associations settings I have *.json as a pattern for my json files.
Has anyone encountered this issue before?
You need to go to Settings | Editor | File Types and make sure that this name is not associated with any incorrect file type.
I had a similar problem with a YAML file. I created the file but accidentially made it a text-type file. Then when creating YAML content in that file there was no syntax highlighting. Additionally, a bar was shown on the upper edge of the editor window stating that there are plugins for the file extension *.yml -- of which I had already one installed that worked perfectly with other YAML files.
A grep on the $HOME/.IdeaIC2018.3 directory with that filename found the .IdeaIC2018.3/config/options/filetypes.xml file that contained the following line:
<mapping pattern="cassandra-docker.yml" type="PLAIN_TEXT" />
After removing that line and restarting IntelliJ the YAML file was correctly recognized as YAML.
I just had this problem and I have an better answer, I'm leaving here for whomever might have the same issue.
If you go to Preferences > File types > Recognized file types (Text) > Registered patterns, you will find the file there registered as an association. Just remove the association and you should be fine.

Trying to create .htaccess file using ftp doesn't work

I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client

Intellij Idea problem with text file impossible to read

I have a problem using Intellij Idea.
I am absolutely unable to load text file as InputStream - it doesnt matter where do I put the file (main/java, main/resources...) it just can't find the file - in Eclipse everything works just fine.
I tried setings->compiler->resource patterns and added ?*.txt but that doesn't seem to work either.
Any help is appreciated.
If you load it as a File, make sure that Working Directory is properly set in IDEA Run/Debug Configuration, since it's the default directory where Java will look for a file when you try to access it like new File("file.txt"). Working directory should be set to the directory of your project containing .txt files.
If you load files as a classpath resource, then they should reside somewhere under Source root and will be copied to the classpath according to Settings | Compiler | Resource Patterns.
If you can't get it working, upload your project somewhere including IDEA project files so that we can point to your mistake.
Look at the image, notice that the txt files are in the project root, and not the source folders (in blue).
If you open the Project Structure dialog, and click on Modules and select your module - are the correct folders marked as Source Folders on the sources tab?
Link for how to get to Project Structure dialog
Also, if you print out the absolute path of that file you are trying to read, is that anywhere near where you expect it to be?
An easy way to figure out the same would be to try creating a file in the same fashion and see where it gets created in your project. You can put your input file at the same location and it should work just fine (if it doesn't, you should check your resource pattern which might be causing the file to be not copied over in the build output).
This method actually gives you the working directory of your intellij settings which is pointed out in the accepted answer. Just sharing as I had similar trouble and I figured out this way. :)