Author Topic: #if 0 inactive code  (Read 3625 times)

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
#if 0 inactive code
« on: February 07, 2020, 04:54:21 PM »
I can't get #if 0 code slabs to color as inactive code... what did I miss...?

Thanks.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: #if 0 inactive code
« Reply #1 on: February 07, 2020, 07:03:32 PM »
Do you have the feature disabled?  Document > C/C++ Options... > Color Coding > Language > |x| Color Inactive...

Have you changed your color scheme?  Double-check that the inactive code colors have a background that you can clearly see.  Tools > Options > Appearance > Colors > Comments > Inactive*

Are you looking for this to work in a language that does not have built-in C-Preprocessing support?  What language are we dealing with here?

If none of the above are the problem, could you post some sample code?

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #2 on: February 07, 2020, 11:03:17 PM »
C code.

I have not changed to color scheme.

See attached pics.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: #if 0 inactive code
« Reply #3 on: February 07, 2020, 11:09:09 PM »
Only thing I can guess is that your code is actually in ANSI-C mode, so you might want to check those options.

Also, if you have changed to color coding in any manner so that #if is not detected as a preprocessing directive, that would break things too.

I would suggest trying this with is shiny new configuration to make sure the problem is not in your configuration.

Code: [Select]
vs +new -sc /tmp/shinynewconfig

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: #if 0 inactive code
« Reply #4 on: February 08, 2020, 07:54:23 AM »
I can't get #if 0 code slabs to color as inactive code... what did I miss...?

Thanks.
In the Document menu -> select mode(...)    - what mode is shown.
Did you install a new version just before the problem started?
Does the problem appear in more than one file?
With slick closed, try deleting vslick.sta.


joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #5 on: February 13, 2020, 08:56:13 PM »
Document->Select Mode (C/C++)

I did change the color for block matching highlighting.

Problem appears for all open C/C++ files.
« Last Edit: February 13, 2020, 08:59:13 PM by joecar »

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #6 on: February 13, 2020, 08:58:19 PM »
I deleted vslick.sta and inactive coloring still does not go.

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #7 on: February 13, 2020, 09:02:13 PM »
Code: [Select]
vs +new -sc /tmp/shinynewconfig
Doing this, inactive color shows up ok.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: #if 0 inactive code
« Reply #8 on: February 14, 2020, 12:56:12 AM »
That would mean the issue is in your configuration, either colors, or color coding.  I'll take a look at your user.cfg.xml if you attach it and see where the problem is.

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #9 on: February 14, 2020, 04:29:34 PM »
See attached, thanks.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: #if 0 inactive code
« Reply #10 on: February 14, 2020, 06:34:22 PM »
Uncheck Document > C/C++ Options... > Color Coding > Langauge > Preprocessing keywords can appear anywhere

This has an undesirable interaction with inactive code regions coloring.  Should not be a problem because C++ preprocessing can't just be anywhere, it has to be the first non-blank character.

I'll check into the interaction, because it should not break the normal case for coloring inactive code, but that fix would have to go in the next release, not hot-fixable.

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #11 on: February 14, 2020, 09:20:26 PM »
Ok, I unchecked that and inactive coloring on #if 0 is fixed.

Thanks, appreciate all your help.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: #if 0 inactive code
« Reply #12 on: February 17, 2020, 03:28:45 PM »
Just for curiosity's sake, was there a particular reason you had enabled that option?

joecar

  • Senior Community Member
  • Posts: 420
  • Hero Points: 9
  • engineer/gearhead
Re: #if 0 inactive code
« Reply #13 on: February 17, 2020, 03:36:22 PM »
I'm not sure why/how that got checked in the first place.
« Last Edit: February 17, 2020, 03:40:37 PM by joecar »