How to change the associated file type?

Hi,

I just checked out my Rails project using Subversion. I noticed that all of the files in the "/script" directory were of unknown file type - except "server", which was designated as a "text" file. I don't know why this one file was singled out, but it was.

I set all of the files in "/script" to be type "Ruby" so that they appear correctly color-coded in the editor pane.

My question is this: Is there any way to change the associated type for individual files once they have been assigned? This isn't that big a deal for "script", but I'm thinking that if you somehow assigned the wrong type to a file it would be nice if you could change it to the correct one.

Thanks,
Larry

8 comments
Comment actions Permalink

Hello Larry,

The associations between file names and file types can be configured in Settings
| File Types.

I just checked out my Rails project using Subversion. I noticed that
all of the files in the "/script" directory were of unknown file type
- except "server", which was designated as a "text" file. I don't know
why this one file was singled out, but it was.

I set all of the files in "/script" to be type "Ruby" so that they
appear correctly color-coded in the editor pane.

My question is this: Is there any way to change the associated type
for individual files once they have been assigned? This isn't that big
a deal for "script", but I'm thinking that if you somehow assigned the
wrong type to a file it would be nice if you could change it to the
correct one.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


1
Comment actions Permalink

Hello Larryh,

I just checked out my Rails project using Subversion. I noticed that all of the files in the "/script" directory were of unknown file type - except "server", which was designated as a "text" file. I don't know why this one file was singled out, but it was.


I set all of the files in "/script" to be type "Ruby" so that they appear correctly color-coded in the editor pane.


My question is this: Is there any way to change the associated type for individual files once they have been assigned? This isn't that big a deal for "script", but I'm thinking that if you somehow assigned the wrong type to a file it would be nice if you could change it to the correct one.

Please refer to RubyMine web help at http://www.jetbrains.com/ruby/webhelp/. See section RubyMine /  Procedures /  Configuring the IDE /  Creating and Registering File Types
Also please refer to our blog at: http://blogs.jetbrains.com/ruby/2009/06/did-you-know-searching-for-help/

Regards,
Oleg

0
Comment actions Permalink

Hi Oleg and Dmitry,

Thanks for your replies, however, I don't think they answered my question. I did search (and read) the docs for information about associated file types and did find the information that you pointed out. However, that discusses creating new types and associating classes of files to a certain type.

My question concerns changing the associated type for one file. For example, for some reason Rubymine associated "/script/server" to be a "text" file when it is not; it is a Ruby file. I'd like to be able to, say, right click on this one file and change its incorrect file type ("text") to the correct one (*Ruby").

Is there a way to do this?

Thanks,
Larry

P.S. I aplogize if the links that you sent me contain this information; if they do, I missed it.

0
Comment actions Permalink

Hello,

My question concerns changing the associated type for one file. For example, for some reason Rubymine associated "/script/server" to be a "text" file when it is not; it is a Ruby file. I'd like to be able to, say, right click on this one file and change its incorrect file type ("text") to the correct one (*Ruby").


Is there a way to do this?

In RubyMine you cannot change this using just right click, go to File | Settings | File Types, select Text files from Recognized File Types, remove pattern "server" from there and add it to Ruby files.

Regards,
Oleg

2
Comment actions Permalink

Shoot. I'm sorry, Oleg, I didn't see the entry "server" listed under "Text Files". There are a bunch of "*.~~~" designations (e.g. *.bat, *.cgi, *.log) at the top and I just assumed all entries were like that. Which means I didn't move that little thing on the right (I think it's called a scrollbar, right? ;-) to see the "server" entry down at that bottom.

Thanks for being patient with your replies,
Larry

0
Comment actions Permalink

I'd like to add a request here. TextMate/E-texteditor have a great feature which let you _pick_ the file type for a specific file. For example, I have a file that's XML, but I need to put a lot of Ruby Code in it - so it'd be nice having the ability to switch between recognized file types/highlighting/etc.

Thanks!

0
Comment actions Permalink

the ability to switch between recognized file types/highlighting/etc.

Each such switch will lead to project reindexing.

For example, I have a file that's XML, but I need to put a lot of Ruby Code in it

Is it something like erb? Because if you just changed it file type to Ruby you will see lot's of ruby syntax errors related to xml part of file. Also formatter, and codeinsight features wont work well. E.g. for erb files we have special support and RubyMine understand such file structure which contains 2 languages.

aronchick wrote:

I'd like to add a request here. TextMate/E-texteditor have a great feature which let you _pick_ the file type for a specific file.

According to above comments there is no sense in such switcher in RubyMine.

0
Comment actions Permalink

Indeed, there is a GREAT sense in such a feature. We do write executable scripts in rubymine and insofar we have to use more intelligent tools like textmate. It is a bad joke, still your intelligent platform and jet brains can't derive executable file type from its first line. Well, we have regular brains and can do it, but you also do not let us change it for a reason that you are having problems with it. Why, aren't we paying our subscriptions for you working on it?

We can help you then. To derive the type of the executable file while opening it with the editor, you have just:

1. Check it has x flag set. 

2. If it has, read the first line. If it matches to something like =~ /#!.*ruby/ - it is a ruby script in a form of the unix executable file

Make us a big favor and prove your brains are that fast and the idea is intelligent ;) Or let us hook our extensions to file type discovery so we can add some more brains and intelligence ;)

0

Please sign in to leave a comment.