-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Hi,
First of all, thank you for this mode, it's been making C# editing on Emacs a pleasure over quite a few years and hopefully for many years to come :)
After switching to Emacs 27.1 I started to notice the string fontification problem that was fixed and seemed to disappear a few days ago (last week?) but now it seems to be back :(
When editing string-heavy code csharp-mode still sometimes gets lost and causes cc-mode to detect incorrect context, apply incorrect indentation as well as highlighting code following a certain point as strings.
Sometimes when the code is highlighted as string manual indentation (using tab) works, but electric indentation does not. Sometimes the code is treated fully as a string, in which case neither indentation works
correctly. Sometimes letting Emacs go idle for a few moments "fixes" cc-mode's understanding of the context and indentation starts to work again. When that happens calling font-lock-fontify-buffer
fixes the
highlighting as well.
I can't put the finger on what precisely triggers the issue, but in most cases it can be "fixed" by finding the end of some string above your current position, add a space after it and save the buffer.
The attached screenshot is a work-in-progress of a file I'm currently refactoring, you can see the syntax context shown in the echo area is incorrect. In this particular file, I need to go up around 80 lines to find the
"offending" string which triggers the misbehavior. You can find the WIP file here (you will need
to create .projectile
in the same directory before opening it in Emacs since OmniSharp Roslyn gets lost in the Xamarin.Android solution currently and you'd get plenty of errors without .projectile
)
I'm using the latest version of csharp-mode
available from MELPA (20201007.1738
) and the latest release of OmniSharp Roslyn (1.37.1) running under Mono/master (commit e0437b3ec11
)