Home Download Buy Blog Forum Support

switching projects changes tab spaces in python projects

switching projects changes tab spaces in python projects

Postby mbrazil on Wed May 29, 2013 3:30 am

I have three projects I switch between on a regular basis.

Didn't notice at first and it seem on a switch the tab spaces can change from 4 to 2.

I tried the following
- edit project
added this to the sublime-project file

"tab_size": 4

but makes no difference.
mbrazil
 
Posts: 9
Joined: Wed May 29, 2013 3:27 am

Re: switching projects changes tab spaces in python projects

Postby adzenith on Fri May 31, 2013 2:15 pm

What's your detect_indentation set to?
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: switching projects changes tab spaces in python projects

Postby mbrazil on Mon Jun 03, 2013 5:34 am

when i switch projects, the status bar says "Detect indentation: Setting indentation to 2 spaces"

Bottom right says

Spaces:2 Python


How exactly does it detect what spaces are to be used ? Is it based on file type of the first files that open ? (in this case would be .py)


adzenith wrote:What's your detect_indentation set to?
mbrazil
 
Posts: 9
Joined: Wed May 29, 2013 3:27 am

Re: switching projects changes tab spaces in python projects

Postby bizoo on Mon Jun 03, 2013 6:53 am

Heuristic algorithm based on first x lines of the file.
It's detected for each file you open, so could be different for each file.
Works pretty good but sometimes get fooled if file begin with a lot of line with more than one indent (like 1 line with 1 indent followed by 50 lines with 2 indent).

If you're sure all your files have the same indent settings, you can disabled it with:
Code: Select all
"detect_indentation": false
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: switching projects changes tab spaces in python projects

Postby mbrazil on Mon Jun 03, 2013 10:11 pm

thank you for the reply. The files do look fine. Its a django project.

Pretty new to sublime, where does the detect_indentation go ?

I did project-> edit and added it to the project.sublime-project file but it doesn't appear to do anything.

Code: Select all
{
   "folders":
   [
      {
         "path": "/home/mark/workspace/djangoProject",
         "file_exclude_patterns": [".*"],
          "detect_indentation": false
      }
   ]
}



bizoo wrote:Heuristic algorithm based on first x lines of the file.
It's detected for each file you open, so could be different for each file.
Works pretty good but sometimes get fooled if file begin with a lot of line with more than one indent (like 1 line with 1 indent followed by 50 lines with 2 indent).

If you're sure all your files have the same indent settings, you can disabled it with:
Code: Select all
"detect_indentation": false
mbrazil
 
Posts: 9
Joined: Wed May 29, 2013 3:27 am

Re: switching projects changes tab spaces in python projects

Postby adzenith on Tue Jun 04, 2013 1:52 pm

You can add it to your project, but don't put it under the "Folders" setting... put it next to it.
Code: Select all
{
    "detect_indentation":false,
    ...
}
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: switching projects changes tab spaces in python projects

Postby bizoo on Tue Jun 04, 2013 2:07 pm

adzenith wrote:You can add it to your project, but don't put it under the "Folders" setting... put it next to it.
Code: Select all
{
    "detect_indentation":false,
    ...
}

I put it in a "settings" section, but maybe it's not mandatory:
Code: Select all
{
   "folders":
   [
      {
         "path": "/home/mark/workspace/djangoProject",
         "file_exclude_patterns": [".*"]
      }
   ],
   "settings":
   {
      "detect_indentation": false
   }
}
bizoo
 
Posts: 889
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: switching projects changes tab spaces in python projects

Postby adzenith on Tue Jun 04, 2013 6:18 pm

I think you might have to do that, actually.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: switching projects changes tab spaces in python projects

Postby mbrazil on Tue Jun 04, 2013 11:14 pm

Success !

thank you.


bizoo wrote:
adzenith wrote:You can add it to your project, but don't put it under the "Folders" setting... put it next to it.
Code: Select all
{
    "detect_indentation":false,
    ...
}

I put it in a "settings" section, but maybe it's not mandatory:
Code: Select all
{
   "folders":
   [
      {
         "path": "/home/mark/workspace/djangoProject",
         "file_exclude_patterns": [".*"]
      }
   ],
   "settings":
   {
      "detect_indentation": false
   }
}
mbrazil
 
Posts: 9
Joined: Wed May 29, 2013 3:27 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 31 guests