Can't set breakpoint; .rb file is not recognized as Ruby file

Hi I have a file in /lib which for some reason is not recognized as a Ruby file, despite a .rb extension - in other words, it does not have the ruby file icon; it just has a plaintext file icon.  It's successfully being used by the app but I need to set a breakpoint in this file, and since RubyMine doesn't seem to see it as part of the app, it won't let me set a breakpoint there.

Does anyone know how to fix this?   I'd prefer not to take the silly step of deleting it from the project and committing the change, then adding it back again as a "new" file.

Thanks
Shannon

4 comments
Comment actions Permalink

Hi Shanon,

Few place to check:

  1. (Not sure if it is applicable to RubyMine, but it is for PhpStorm) Find that file in Project View panel, right click and see if "Mark as Ruby?" (or something like that) menu item is preset (should be just below "Delete"). This is to check if you accidentally have not marked that file as plain text.
  2. Settings | File Types | Text files -- check for patterns that can match that file name
0
Comment actions Permalink

Thanks for the quick answer.  Unfortunately, I had already tried search for some type of "mark file as Ruby" setting with Right-click, in the File menu, in the Edit menu, in Project....  If there is such a setting for Rubymine, it isn't in the right-click menu or any other menu that I was able to find.

Also *.rb files are already indicated as Ruby files in File Types.

This was interesting and possibly revealing though:

I went to delete the file.
I unchecked Safe Delete.
RubyMine prompted me whether to delete it from Subversion and I said no.
Then I selected New -> Ruby class
I entered the name of the class (which was the same as the old class), and I immediately got the following error dialog:

com.intellij.psi.i,pl.source.PsiPlainTextFileImpl cannot be cast to org.jetbrains.plugins.ruby.ruby.lang.psi.RFile

I got the error again even when I repeating the above steps except for responding 'yes" to deleting from Subversion, and committing the change first.

[Edit:   as a follow-up, I cannot seem to find any file on disk that contains this setting for this particular file.   I have removed the line concerning it from .idea/workspace.xml and this does not solve the issue.   I would appreciate some help from developer support.

Edit2:  the only thing that I could do was to rename the class.
]

-Sn

0
Comment actions Permalink
Also *.rb files are already indicated as Ruby files in File Types.

Does not matter -- if there is more specific pattern then it will take over more generic *.rb. For example -- if you add index.rb pattern to Text files in Settings | File Types, then ALL index.rb files in your projects will be treated as text files.

com.intellij.psi.i,pl.source.PsiPlainTextFileImpl cannot be cast to org.jetbrains.plugins.ruby.ruby.lang.psi.RFile

Based on error descriptio I would suggest:

  1. File | Invalidate Caches...
  2. If nothing -- then once again -- double/triple check that there is no pattern that could match such name in Settings | File Types | Text files


No more other bright ideas. I mean -- you can always backup and delete project settings (.idea subfolder) and recreate the project settings again to see if this will help, but I feel it will not make difference here.

0
Comment actions Permalink

Oh I understand now, I thought you just meant to check that *.rb was part of the pattern matching.

Yes it turns out that file (and a few others) were/are listed specifically as being text files.  

Thank you

0

Please sign in to leave a comment.