Author Topic: V21: Adaptive Formatting, Python, Tabs  (Read 4102 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
V21: Adaptive Formatting, Python, Tabs
« on: December 02, 2016, 05:45:18 PM »
Normally I have Slick set to always indent with spaces.
Today I'm editing an existing Python script that is indented with Tabs.I've got Adaptive formatting on, and all options for it are enabled, including tabs.

Yet, Slick always inserts spaces when I'm editing this Python file.
All existing indents are tabs.
All new indents are spaces.
Getting tabs/spaces correct is especially important for Python of course.

Then, I tried Beautify -> Edit Current Profile. I got this:
 Invalid object handle
stdprocs.ex 23739 _GetDialogInfoHtPtr(beaut_display_timer,380,0)   p_window_id: 5   p_object: OI_FORM   p_name:
beautifier.ex 7442 beautifier_schedule_deferred_update(-1,380,showBeautOptionsPanel)   p_window_id: 12   p_object: OI_EDITOR   p_name:
beautifier.ex 13816 _bc_update_preview_cb(380)   p_window_id: 12   p_object: OI_EDITOR   p_name:
dlgeditv.ex 7245 show(-xy -modal _beaut_options,Default,py)   p_window_id: 12   p_object: OI_EDITOR   p_name:
beautifier.ex 8347 _beautifier_edit_profile(Default,py,<empty>)   p_window_id: 12   p_object: OI_EDITOR   p_name:
beautifier.ex 8918 beautifier_edit_current_profile(py,Default)   p_window_id: 12   p_object: OI_EDITOR   p_name:


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #1 on: December 02, 2016, 10:44:41 PM »
What hotfix # do you have installed?

For the file that's giving you problems, if you run "adaptive-format-stats", does adaptive formatting think it's tabs or spaces?

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #2 on: December 02, 2016, 11:26:05 PM »
v21.0.1.0 64-bit, no hot fixes.
After running adaptive-format-stats it started indenting with tabs.
Even for other py files that are tab indented.


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #3 on: December 05, 2016, 02:14:17 PM »
I'll take a look at it, it almost sounds like we're not querying adaptive formatting when we're supposed to for Python, since it only changed the settings when you ran that command.

That stack too.  Thanks for the report.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #4 on: December 06, 2016, 07:37:27 PM »
Question: did you already have adaptive formatting turned on for Python when you got to the problem file, or did you have to turn it on once you ran into problems with that file?

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #5 on: December 06, 2016, 08:02:01 PM »
I think it was already on, but I can't swear to it.
I had it repro on 2 machines with similar, but not identical configuration.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #6 on: December 07, 2016, 02:42:07 PM »
The stack should be fixed in the next v21.0.1 hotfix.  It was timing related, but I've reproduced it a couple of times.

I have also reproduced the adaptive formatting problem, but not reliably, so it's going slow.  I'll let you know when there's a fix for that as well.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #7 on: December 07, 2016, 09:16:05 PM »
And a fix for the adaptive formatting problem will be in the v21.0.1 hotfix as well. 

Once the fix comes out, and you apply it, if the file still doesn't act right, turn adaptive formatting off, and then on again while you have the file open.  This will reset the bad adaptive formatting state that prevented that buffer from applying the inferred tab settings.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: V21: Adaptive Formatting, Python, Tabs
« Reply #8 on: June 04, 2017, 09:36:41 PM »
This just happened again.
I created a new Python file and pasted a bunch of text in it.

Slick got the adaptive stuff very wrong.
Running  adaptive-format-stats fixes it though.

This is with 21.0.3


When does slick do the adaptive analysis?