how to choose which editor should open file at idea - intellij-idea

I'm newly at Intellij Idea.
rmnHibernateConfiguration.hb is open as easy file. It shows gibberish:
��
I couldn't find how to open this file types as Hibernate file?
This settings isn't so intuitive as at eclipse.
How to change opening file preferences at idea?

Assuming you want to open it in IDEA (including any IDEA plug-ins), you configure it in File > Settings > [IDE Settings] > File Types. Also, some plug-ins may have a setting to define what file types to handle. But that is dependent on
If you want to open in an external program/application, you will need to write an external tool definition as ajp15243 suggests. You will not be able to double click (to the best of my knowledge) the file. But you can select it and then launch the external tool definition (you can map to a keyboard shortcut). The external tool definition can use one of the predefined macro to pass the selected file in as a parameter.

Look into Settings | File Types

Related

PlantUML file in IntelliJ autocomplete and color formatting not working [duplicate]

I have several django projects and several different files with name utils.py, however pycharm treats them as simple .txt files with no syntax highlighting or any other kind of parsing, how can I fix this?
Please see File | Settings (Preferences on Mac) | Editor | File Types.
Look for your file name mapped to the Text type or to the Auto-detect file type by content type.
Remove the incorrect mapping and it will fix the issue.
If you still can't find the wrong mapping in the IDE settings, locate the options/filetypes.xml file in the Configuration directory. Close the IDE and either edit this file to remove the incorrect mapping or delete this file to reset all the file types to the defaults.
You can also use Revert File Type Override / Override File Type file context menu actions.
As CrazyCoder answered, my file also landed in an unintended association. In my case it was "Auto-detect file type by content". You can just try to add your file to the desired file type (e.g. Python) and PyCharm will automatically try to move the association.
FYI, a quick action to reassociate a file's type will be available in the context menu of the Project tool window in IntelliJ IDEA 2021.2 (EAPs should be available publicly around May 2021).
In my case I had to right click the file in question (a django migration) and select Mark as Python.
I probably clicked Mark as Plain Text before by mistake.
I actually solved this by going to the Project section , and then clicking Override File Type by right clicking on the specific file. Then I selected the type of the file from the list of available file types.
That worked
For me, the file somehow forgot its type. This can be overridden by
Right click the file name --> Override File Type --> Select file type.

File named "auth_actions.dart" won't be highlighted in Intellij-idea

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.

File-based, not Folder-based, Projects in Atom?

I'm trying to switch to Atom as my programming editor so that I can gain handy features like linting for Perl, JavaScript, etc. However, over the last two decades, I've used a string of editors (UltraEdit, jEdit, BBEdit) that allowed me to add individual files from different folders into projects. My main coding project actually spans several remote SFTP servers and the "folders" in my BBEdit project do not necessarily correspond to any file structure on disk.
I cannot seem to figure out how to set up a project in this manner in Atom (or similar editors such as Brackets). Is there a way to configure Atom and its extensions to produce a result similar to an UltraEdit/jEdit/BBEdit/Komodo project? I thought about creating a new project directory and symlinking to the real files, but that seems like a hack at best.
I belive its File > Open Project or something like that. I personally like Sublime Text 3 but Atom and Sublime are the same.
The best solution I have found so far would be to install opened-files package. By default it persists all files you have opened (even after you close them) until you close atom editor. I don't think it would work well for bigger projects as it lists all the files under one tab in tree view.
If you want to persist open files you might want to use project-manager package. To keep files listed under 'Opened files' tab after you close them (and atom), you need to press bookmark icon next to tab name. Once you add the project it auto-saves file structure when you close atom. To add project to project-manager write project-manager save in command palette. To list all projects from project manager press shift-alt-P.

Webstorm not recognising JavaScript file

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

Transferring Intellij Live Templates Between Machines

I'm trying to figure out how to transfer the templates in the /.IdeaC10/config/templates/user.xml file to my coworker's machines.
If I copy into the user.xml file, then those changes seem to be getting squashed by Intellij, reverting to the old file contents.
Anyone know how to work around this?
EDIT:
Is there any way to do this by copying and pasting the xml? That would be preferrable...!
Use File | Imprort/Export Settings.
An improved and easier way
This allows you to share them easily between collegues.
You can select multiple live templates and then copy them (right click and select copy, or ctrl+c). This gives you XML-descriptions in your clipboard you can send to others.
Other can then take that XML, and paste it into a "Template Group". Right click one of the groups and select Paste. If the option is greyed out, you didn't select a group but something else.
If you have Settings Repository set you may find your Live Templates stored in
<your_user_home_directory>\
.IntelliJIdea<version>\
config\
settingsRepository\
repository\
templates
the technique of copying and pasting the xml file on another computer in the correct directory, function perfectly for me! But the name of my template file is android.xml for my Android developments. Maybe the file name "user" is protected. Try maybe with a different file name
You need to create the required custom template groups and update the relevant predefined groups as necessary and click OK. Based on these changes, IntelliJ IDEA generates the <group_name>.xml files, see Location of Custom Live Templates Definitions above.
Depending on the operating system you are using, the .xml files are stored at the following locations:
Windows: <your_user_home_directory>.IntelliJ IDEA<version_number>\config\templates
Linux: ~IntelliJ IDEA<version>\config\templates
OS X: ~/Library/Preferences/IntelliJ IDEA<version>/templates
Refer to Intellij Help article.