Page 1 of 1

Detect Indentation

Posted: Sat Aug 24, 2019 10:58 am
by Sicro
I work with many third-party codes that have their own indentation style:
  • Tab as indentation character: Tab length: 2, 4 or 8 spaces
  • Space as indentation character: 2, 4 or 8 spaces
When I edit these codes, however, my indentation style specified in the PB editor is used and a mix of different indentation styles is created.

It would be good if the PB editor would optionally analyze the code after opening to detect the indentation style and temporarily adjust the indentation for this code accordingly.

https://code.visualstudio.com/docs/edit ... odetection

Re: Detect Indentation

Posted: Sat Aug 24, 2019 4:40 pm
by Demivec
You can create a tool that cönverts the idents on load/save.

Re: Detect Indentation

Posted: Sat Aug 24, 2019 7:06 pm
by Sicro
Yes, but then I have to re-program the PB editor's identation processing myself again, not just the identation style's detection function.

Currently I imagine the indentation of the line continuations difficult. But maybe I'm wrong and it's not that hard.

Re: Detect Indentation

Posted: Sat Aug 24, 2019 7:43 pm
by Derren
You just need to press Ctrl+A and then Ctrl+i and the IDE reformats the entire file using your preferred indentation.

Seemingly it also works if another type of indentation is used.
I have a real tab, with size 4 as indentation. And this code (with lots of different amounts of spaces) formats properly using the above-mentioned key combo.

Code: Select all

Procedure test(a.i)
    If a=#True		
  Debug "true"
         Else
  Debug a
      EndIf 	
   EndProcedure

Re: Detect Indentation

Posted: Sun Aug 25, 2019 7:53 pm
by Sicro
Derren wrote:You just need to press Ctrl+A and then Ctrl+i and the IDE reformats the entire file using your preferred indentation.
I am aware of this function. However, I don't want to change the indentation to my preferred indentation style, but to keep the indentation style of the current code.

I could temporarily change the indentation style in the PB settings according to the current code, but what do I do if I have multiple codes open in the PB IDE at the same time that have different indentation styles?

I am still for a native implementation of this requested feature.