Strange behavior

Today I ran into some strage behavior from IntelliJ Ultimate 11.1.3 on OS X. I went through some files and made edits to one line in each. At a certain point, however, I could no longer see my edits. In fact, I was even missing some edits that were pre-existing (before I opened the IDE & opened the project)... even though I had been looking at and copying the up-to-date code only moments before. Then I found that if I clicked on a line showing outdated code, it would suddenly appear with the updated code! I also notice that if I mouse-over one of the outdated lines, it shows the up-to-date code in a tooltip directly under the out-of-date line.

What on earth is happening here? It seems like IntelliJ is doing this on purpose, but I can't figure out what triggered it or how to fix it!


Edit:
Actually, the tooltip only appears if I mouse-over the string on the line. It does not appear if I mouse-over the other portions of the line. The tooltip, however, shows the entire updated line.
<% @title = "Edit Article %{name}" %>

Edit:
It appears that every time I close and open a problematic file, it reverts to showing the bad line again... The situation persists even if I quit and re-open the IDE. This is starting to look like a bug.

3 comments
Comment actions Permalink

I now believe this is an intentional but poorly implemented feature. The editor  automatically replaces any calls to I18n.t() with the actual translated  string from the YAML.

See my issue at http://youtrack.jetbrains.com/issue/RUBY-11914

0
Comment actions Permalink

IDEA is not actually replacing the key in the code. It merely shows the key's value via a code folding feature. The green background tells you that it is a substitution. This is because many people find it much easier to work when they know the actual value -- "Could not access server due to a timeout" -- rather than a key --"timeout.error".  Clicking on the value shows the actual code to allow for editing. See the Code Foldings for I18n Support blog entry for more details.

IDEA will also fold other code. For example anonymous classes. It puts a Folding.png in place of the code. Again, it is not removing the code form the file. Just hiding it from presentation to reduce the visual clutter. Hovering over it shows the code. Clicking on it will expand the region. You can also manually fold code blocks via Code > Folding.

If you do not like this feature, you can turn it off in the settings. File > Settings > IDE Settings > Editor > Code Folding - uncheck any options for which you do not want code folding to occur.

0
Comment actions Permalink

Right. I have seen IntelliJ's code folding before, but I was expecting some sort of cue, such as the ellipses that you mention. I was not aware that code folding could occur in-line.

Unfortunately, the Ruby plugin for IntelliJ doesn't obey the i18n folding setting that is exposed. Only RubyMine exposes the option to turn it off. You can follow the issue for more info.

0

Please sign in to leave a comment.