Author Topic: Showing the Adaptive Formatting Results window  (Read 2838 times)

Ian P

  • Community Member
  • Posts: 59
  • Hero Points: 2
Showing the Adaptive Formatting Results window
« on: October 19, 2010, 06:58:33 pm »
Hi,

I'm having a problem with adaptive formatting in that its constantly getting it wrong for the files that I'm currently working on. That's OK and expected because of the content in them, but the problem is that I'm having to remember to manually override it every time I open a file.

Once upon a time I used to get the Adaptive Formatting Results confirmation window popping up to ask me to confirm its choices, and that's what I want to happen now, but its not happening. I'm assuming that somewhere along the way I must have checked the "don't show this again" option on it, so now I want to undo that and have it shown again, but I can't for the heck of me find out how. The help for Adaptive Formatting talks about the results windows and says "select Don't show me this again to suppress the dialog from appearing in the future" but doesn't say how to later make it appear again.

I did find a def_warn_adaptive_formatting setting in vusrdefs.e that was set to 0, and I tried to change that to 1, but I can't find any way to get vusrdefs.e re-compiled to update vusrdefs.ex (loading it doesn't work). def_warn_adaptive_formatting also shows up under "Set Macro Variable" but changing it from 0 to 1 in there didn't seem to do anything.

So how do I get the Adaptive Formatting Results window to show again?

Ian



Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Showing the Adaptive Formatting Results window
« Reply #1 on: October 19, 2010, 08:42:56 pm »
What version are you using?

Ian P

  • Community Member
  • Posts: 59
  • Hero Points: 2
Re: Showing the Adaptive Formatting Results window
« Reply #2 on: October 19, 2010, 08:52:26 pm »
Sorry, forgot to say its 2009.

Also, it looks like setting def_warn_adaptive_formatting via "Set Macro Variable" did actually work because I'm now seeing the Adaptive Formatting Results window opening when I start editing a new file for the first time.

However, it is not showing the Adaptive Formatting Results window when I re-open a file that I've been editing recently, which is what made me think the above had not worked. Is there a way to override that?

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Showing the Adaptive Formatting Results window
« Reply #3 on: October 20, 2010, 02:30:24 pm »
Are there any particular settings you expect to see?  It is possible that some of our automatic restoration of settings is getting in the way.  If we saved the settings the last time you had the file open, and those settings were set by Adaptive Formatting, then when AF runs again, it will find settings that match the settings it found last time (and then not prompt you).  Clear as mud?

We don't save/restore all the buffer settings, but a few of the ones that we do save overlap with the settings that AF looks for.  All this is speculation, as I haven't been able to reproduce your issue.  Setting def_warn_adaptive_formatting back to 1 seems to make the confirmation prompt come back for me.

Ian P

  • Community Member
  • Posts: 59
  • Hero Points: 2
Re: Showing the Adaptive Formatting Results window
« Reply #4 on: October 20, 2010, 07:04:53 pm »
OK, after a bit of trying this with various files it looks like the problem is that the Adaptive Formatting is not working properly with .h files but works OK with .c files.

In language manager for C/C++ I have Adaptive Formatting enabled and syntax indent, tabs and indent with tabs checked for it. The file extension manager confirms that .c and .h are both associated with the C/C++ language. And what I'm seeing is:

1. Editing a .c file I close it and then reopen it. Then I insert some text and enter a new line and the Adaptive Formatting Results window pops up.

2. Editing a .h file I close it and then reopen it. Then I insert some text and enter a new line and it just goes ahead and inserts spaces for the indent. What's more there are no lines starting with spaces anywhere in this file and all indent in it uses tabs. In the Document menu Adaptive Formatting is ticked and Indent with Tabs is not (if I check the latter it does not stay checked after closing/reopening the file).

I tried a few .c and a few .h files and see the same in each case.

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Showing the Adaptive Formatting Results window
« Reply #5 on: October 21, 2010, 03:03:03 pm »
Could you post a couple of the .h files that you are talking about?  If you can't post them to the forums here, could you email them to me at sgaskins (at) slickedit (dot) com?

Ian P

  • Community Member
  • Posts: 59
  • Hero Points: 2
Re: Showing the Adaptive Formatting Results window
« Reply #6 on: October 21, 2010, 09:01:45 pm »
OK, I've attached a file that is showing this problem. Its actually an extract from a larger file but this simplified version shows it quite well and paring it down has revealed some new info on the problem. It doesn't appear to be a .h versus .c thing, but actually something to do with the content. Here is what I see with it:

The file contains two c struct declarations, the first being excluded by a "#if 0 ... #endif".

1. Open the file as it as and try to insert a new line into the 2nd struct - the Adaptive Formatting Results confirmation window is not shown and spaces are inserted for the indent.

2. Undo that change.

3. Change the "#if 0" to #if 1" so the first struct is now included and save the change.

4. Close the file, re-open it and repeat #1. Now the Adaptive Formatting Results confirmation window pops up.

So something to do with that first struct being included is affecting whether Adaptive Formatting confirmation is asked for.

Thanks.
Ian
« Last Edit: October 21, 2010, 11:50:09 pm by Ian P »

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Showing the Adaptive Formatting Results window
« Reply #7 on: October 22, 2010, 02:34:25 pm »
Aha!  At last I understand.

The reason that this seems to affect .h files is because they are (generally) shorter.  If there is not enough file for Adaptive Formatting to analyze, it will simply punt and go with whatever settings you have for the language.  So in your first step, it's inserting spaces because that's the setting specified in Tools > Options > Languages > Application Languages > C/C++ > Indent.  Without that block at the top, there is not enough code for AF to examine to determine any settings.  Once you include the top block, AF has enough to chew on to say that this file is indenting with tabs.

Ian P

  • Community Member
  • Posts: 59
  • Hero Points: 2
Re: Showing the Adaptive Formatting Results window
« Reply #8 on: October 22, 2010, 04:22:53 pm »
Ah, OK. And yes, I noticed yesterday that if I checked "insert tabs" for the language then it would do that rather than spaces.

Thanks,
Ian