Author Topic: SlickEdit Stopped Noticing Inactive Code  (Read 630 times)

GJB

  • New Community Member
  • Posts: 2
  • Hero Points: 0
SlickEdit Stopped Noticing Inactive Code
« on: February 26, 2018, 03:25:38 pm »
SlickEdit Pro 2015 (v20.0.3.0 64-bit), Windows 10

I've been using SlickEdit for just over a year, but this problem only appeared recently. In the past, SlickEdit noticed inactive code and grayed it out. For example,
#if TEST_CASE == 4
// do something
#else
// do something else
#endif
Depending upon the value of TEST_CASE, it would either gray-out "// do something" or gray-out "// do something else". About a week ago it stopped doing that; all code is colored as if it is active. No changes have been made to the SlickEdit Options, in fact I even tried importing an old copy of SlickEditOptions20.zip, but it did not change anything. I have checked Appearance | Colors | Inactive Code and it is set to a light gray.

Any ideas? Thanks.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2445
  • Hero Points: 351
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #1 on: February 26, 2018, 09:53:28 pm »
Do you have TEST_CASE defined in either of:

Document > C/C++ Options... > C/C++ Preprocessing Options...
or Project > Workspace Properties... > C/C++ Preprocessing...

It only grays out inactive code if it can absolutely prove true or false for the #if condition.

GJB

  • New Community Member
  • Posts: 2
  • Hero Points: 0
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #2 on: February 27, 2018, 12:49:43 pm »
I became aware of Preproprocessing Options after going through the Help file. But the point is that this worked without adding TEST_CASE to Preprocessing Options, and then it suddenly stopped working. As far as I know nothing changed. In fact, it still works on another installation of the same version of SlickEdit on another computer. So at some point SlickEdit was able to prove true or false without the need for Preprocessing Options, and then suddenly it wasn't. I'm just trying to get it back to where it was before.
Thanks.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2445
  • Hero Points: 351
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #3 on: February 27, 2018, 06:43:26 pm »
No release of SlickEdit has ever supported coloring expressions as inactive if it wasn't given the information necessary to evaluate the expression.

Most likely scenario is that you were working with a different workspace in the past that defined this C/C++ Preprocessing in the workspace preprocessing configuration, and your current workspace does not define it.

dunkers

  • Senior Community Member
  • Posts: 601
  • Hero Points: 27
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #4 on: March 09, 2018, 07:11:50 pm »
I'm seeing the same thing and also think it used to work. In my case I have a bit of code that goes:
Code: [Select]
#if defined (OPT1)
...
#elif defined (OPT2)
...
#elif define (OPT3)
...
#endif

In some other file only one of OPTn is defined. If I hover over each OPTn in this code, in the preview window I got 'no matching symbols' for those that aren't define, and the actual definition for the one that is. Slick thus knows which defines are defined or not, but doesn't grey out the ones that aren't.

Not sure how you can prove they are never defined somewhere SE can't see them, but that's not relevant - in this file, given what SE knows, they aren't defined and should be grey. If that turns out to be wrong, I can use the workspace preprocessing thing to set them as defined.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2445
  • Hero Points: 351
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #5 on: March 09, 2018, 08:32:19 pm »
Because SlickEdit does not do full preprocessing, and the actual definition of a symbol could be hidden somewhere in a header file, or passed on the command line, or in some other way unknown to SlickEdit, a #define is only treated as not defined, if there is a #undef (in the C/C++ preprocessing options or in the current file).

It treats a symbol as "maybe defined, maybe not defined", unless it can prove it one way or the other.

dunkers

  • Senior Community Member
  • Posts: 601
  • Hero Points: 27
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #6 on: March 09, 2018, 08:40:30 pm »
Can that not be changed (or reverted if it was different previously)? If SE has all the project files it has enough to go on, and if a define happens to be somewhere else, then is the time to spend effort in the workspace config, I feel. Or add the file it's in. Other IDEs that I use seem to manage it perfectly well without me doing anything at all, and I feel that SE is missing a useful trick by being so fussy and attacking the issue from the wrong end.

Edit: just noticed the release notes for 22.0.2 - maybe I should try that version before going further with this :)
« Last Edit: March 09, 2018, 08:43:04 pm by dunkers »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2445
  • Hero Points: 351
Re: SlickEdit Stopped Noticing Inactive Code
« Reply #7 on: March 09, 2018, 09:24:03 pm »
Here is my experience with this over the years. Unless you do full preprocessing, you are just going to guess wrong in different ways.  We do not do full preprocessing because of the performance hit that would cause.