It is currently Thu Sep 19, 2019 3:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Detect Indentation
PostPosted: Sat Aug 24, 2019 10:58 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 359
Location: Germany
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/editor/codebasics#_autodetection

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download -- Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: Detect Indentation
PostPosted: Sat Aug 24, 2019 4:40 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 3573
Location: Utah, USA
You can create a tool that cönverts the idents on load/save.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Detect Indentation
PostPosted: Sat Aug 24, 2019 7:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 359
Location: Germany
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.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download -- Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: Detect Indentation
PostPosted: Sat Aug 24, 2019 7:43 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jul 23, 2011 1:13 am
Posts: 215
Location: Germany
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:
Procedure test(a.i)
    If a=#True      
  Debug "true"
         Else
  Debug a
      EndIf    
   EndProcedure


Top
 Profile  
Reply with quote  
 Post subject: Re: Detect Indentation
PostPosted: Sun Aug 25, 2019 7:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 359
Location: Germany
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.

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download -- Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye