Mono-D icon indicating copy to clipboard operation
Mono-D copied to clipboard

Syntax highlighting is incorrect after "Format on Save"

Open Kelet opened this issue 11 years ago • 11 comments

Sometimes syntax highlighting acts like a string literal is unterminated even when it is, after using the Format on Save option and saving the file.

Steps to reproduce:

  1. Enable Format on Save which is in options on Text Editor => Behavior
  2. Open source code which contains a string literal
  3. Make a trivial change such as adding or deleting a newline
  4. Save the file
  5. Repeat steps 3-4 until problem manifests

You should see that the string will be highlighted like it is unterminated, even though it is.

Temporary fix: Disable Format on Save

This problem seemingly manifested itself between versions 0.5.5.5 and 0.5.5.7. Although I'm not positive on this.

Kelet avatar Dec 31 '13 17:12 Kelet

Hi. Any chances to fix it? Windows, Xamarin Studio 5.9.4, Mono-D 2.13.3

monod_colors

dmi7ry avatar Jun 20 '15 03:06 dmi7ry

@dmi7ry is this related to the 'format on save'-issue or is it misbehaving due to your key typings?

aBothe avatar Jun 20 '15 13:06 aBothe

yes, it is "format on save"

dmi7ry avatar Jun 20 '15 13:06 dmi7ry

so it's basically the "\\asdf" that causes the trouble. I can reproduce it here as well. [Edit] Although not deterministically.

aBothe avatar Jun 20 '15 14:06 aBothe

I suspect that it's a corruption of the highlighted-segments-tree cache. Force-invalidating the cache on having saved & formatted a document will then probably fix this, as under normal conditions, escape backslashes and string literals are rendered properly (aren't they?)

aBothe avatar Jun 21 '15 17:06 aBothe

Oh and please excuse my long time needed to actually handle this. I really hope it's at least work-arounded now, as I don't want to dig down the editor's internals :P

aBothe avatar Jun 21 '15 18:06 aBothe

Just checked 2.13.4. Unfortunately, the behavior has not changed.

dmi7ry avatar Jun 21 '15 18:06 dmi7ry

I've cloned your GMS-macros project and tried to reproduce it at the very same code location, so to press <Space> and save multiple times in a row - nothing happens, everything is in order.

I'm on Linux though - or it's something with the dark UI theme.

aBothe avatar Jun 21 '15 19:06 aBothe

I tried to change themes before wrote here - any theme has bug. Possible it differ for Windows and Linux.

dmi7ry avatar Jun 21 '15 19:06 dmi7ry

so it's basically the "\asdf" that causes the trouble. I can reproduce it here as well.

strings like x" .... " also:

code_color

dmi7ry avatar Jul 03 '15 18:07 dmi7ry

Hi, Alex. What can be done for fix it?

dmi7ry avatar Jul 01 '16 16:07 dmi7ry