• Status Closed
  • Percent Complete
  • Task Type Bug Report
  • Category Enhanced Syntax Highlighting
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Votes
  • Private
Attached to Project: Codinion
Opened by wmj - 14.01.2017
Last edited by Martin Topfstedt - 18.02.2017

FS#87 - Syntax highlighting could be broken when editing document with conditional compilation instructions

While I was editing code files with #if...#else...#endif instructions, the highlighting feature became not working after inserting and deleting some characters.

Please check to see whether this issue could be fixed.

Closed by  Martin Topfstedt
18.02.2017 14:53
Reason for closing:  Fixed
Additional comments about closing:  Version
Martin Topfstedt commented on 16.01.2017 07:20


could it be that you added the file new to the project or renamed it or moved it around?

wmj commented on 18.01.2017 01:49

No new file was added to the project.

The solution had two projects, which contained identical code files, except the first project which had no conditional compilation and the second one had a condition, which differed effective range of the #if...#else...#endif instructions.

Martin Topfstedt commented on 19.01.2017 08:28

Ok, is the highlighting just inside the pre processor condition missing?

Martin Topfstedt commented on 08.02.2017 18:23



could you check if the highlighting is just wrong inside the preprocessor statements?

wmj commented on 09.02.2017 02:33

Yes, it was wrong just inside the preprocessor statements.

Martin Topfstedt commented on 12.02.2017 14:14


ok do they contain copies of the files or is one project linking the files of the other project? If they link the files Codinion determines which file is opened by the Project DropDown of the File Tab (Navigation Bar of the Text Editor). This bar is important, if the bar is disabled Codinion takes the first project it finds which contains that file.

Do you have the NavigationBar disabled? For that i have already a bug to find out how i can determine the active project without the ProjectDorop Down (FS#54)

wmj commented on 13.02.2017 01:34

Both projects shared the SAME code files.

The only difference was that project A and B used different compilation conditions.

NavBar was never disabled.

Martin Topfstedt commented on 15.02.2017 18:42


i found a bug where the highlighting got stuck when changing between projects through the navbar.

I attached a version where this shoulb be fixed.

wmj commented on 16.02.2017 00:38

Thank you for addressing this problem.

Another bug was found after installing the attached vsix above.

You can see that the NoWorking and Print method was not highlighted.

   shot1.PNG (60.6 KiB)
wmj commented on 16.02.2017 00:40

Steps to reproduce the above:

  1. New console project in VS 2015 update 3.
  2. Type the #if...#endif instruction.
  3. Type static void NoWorking() {} above the #if instruction. The typed content was not highlighted.
  4. Type static void Print() {....} below the #else instruction. The typed content was not highlighted either.
wmj commented on 16.02.2017 00:43

The workaround for the above problem can be saving the new solution to the disk and reopening it from VS.

wmj commented on 16.02.2017 00:49

Let's get back to the issue "Syntax highlighting could be broken when editing document with conditional compilation instructions".

MultiConfig.7z contains a solution with two projects, which have the same code file except that the MultiConfig.B project has a compiler condition "B" defined.

When I opened the solution, and clicked on the Program.cs under the first project, like A.png showed, the highlight was correct. But when I clicked the Program.cs under the MultiConfig.B project, like B.png, the highlight was not working as expected.

   MultiConfig.7z (14.8 KiB)
   A.PNG (62.2 KiB)
   B.PNG (62.5 KiB)
Martin Topfstedt commented on 17.02.2017 17:27

I think the problem is that for some reason in screenshot B the Project is still "MultiConfig" instead of "MultiConfig.B"

Furthermore, i found another bug that codinion didn't recognized project property changes (conditional symbols). It just worked with reloading the project for now. I have fixed this now.

Thanks for providing this small example.  I tried it with my newest version and it worked like expected, except the first time i loaded the solution there it didn't recognized the projects at all 0.o. I will investigate that and report back.


   B.PNG (66.1 KiB)
Martin Topfstedt commented on 17.02.2017 17:50

Ok, i could fix the loading problem as well. It was caused by already haveing a solution opened and than open a second solution which loads very fast :) and no events are send.

I attached a new version with the fixes.

wmj commented on 18.02.2017 03:25

Great! Thank you for the fix.

It seemed that the highlight was correct now :)


Available keyboard shortcuts


Task Details

Task Editing