Indentation problem in some files

Upload it somewhere, Dropbox for example.

I can email the file to someone at ActiveState.

Then you have to wait for someone from ActiveState.

ping @careyh

@Gewurtzraminer also, please share your log file. (Help - Troubleshooting - View Log File). You can post it right there.

I guess so, thanks for your help so far :slight_smile:

Can you create a file with this problem? Or is it literally specific to that one file? (e.g. copy pasting all content from the problematic file into a new one doesn’t exhibit this problem; note I’d recommend using another program to do the copy-paste just to be safe)

  • I did a copy/paste in explorer to create “test.py”, opened it in komodo, and see the same indentation problem
  • Next I opened the file in visual studio, did a select all, opened test.py, pasted the file contents, and opened it in Komodo. The indentation is still at 24 spaces per tab.
  • Another test I performed: open the file in Komodo, select all, copy, file=>new file, and paste. The indentation looks good at this point. If i perform save-as to test.py the indentation goes back to big tabs.

before

after

What language do you use? Python or Python 3? Is this file under a project? You may want to check out Project prefs as well.

I’m using Python 2.7 at the moment.

Edit Menu => Preferences

Project Menu => Preferences

What about the logs? (Help - troubleshooting - view log file).

Also, try to execute this code in the console tab: require('ko/editor').scimoz().indent.

Number 23

Holy moly… I don’t know what’s going on there, but you can change it.
require('ko/editor').scimoz().indent = 4.

Are you sure your language is NOT Python 3? Have a look at right bottom of Komodo window.

Unfortunately, the command you suggested did not change the indentation. :disappointed:

1 Like

Ok, thanks. It’s very interesting why indent is such big then.

This sounds like a bug in our indentation auto-detection (the “allow file contents to override tab and indentation settings” checkbox). If you are able, could you open an issue on our bug tracker and attach the problematic file? If you cannot attach the problematic file due to privacy concerns, please send it to us at “support at activestate.com” and reference the github ticket number in the subject line. Thanks.

He did uncheck that Mitchell and said that it doesn’t help. However, I can see that this is checked in Prefs and probably in per-file settings, but not in Project settings. Maybe he didn’t re-open the file.

Bingo!

The problem was fixed once I unchecked “allow file contents to override tab and indentation settings” in preferences, closed the file, and re-opened.

This is not a great change to be making, though, since I need to edit files that are using spaces instead of tabs.

1 Like

Since Mitchell’s post is more informative than mine, I’ll mark his post as the solution. Regardless, please file a bug for that :slight_smile:

You can disable tabs on per-project settings and keep them everywhere exclude this project if you like using tabs.

That will work. Thanks for the help!

I was able to repeat this issue in Komodo IDE, version 10.2.2, build 89895, platform win32-x86.
Built on Fri Apr 28 17:11:08 2017.

Good news though: I found the only lines that had problems were those that had a (TAB)# comment.

By changing the (TAB)# … to (SPACES)# … the auto-indent worked immediately and 100% correct.

Still a bug though.

Komodo Edit, version 10.2.2, build 17703, platform linux-x86_64. Built on Sat Apr 29 00:10:22 2017.

I have a similar issue with a PHP file.
The indentation for tab chars was set in config for the editor, PHP file type AND the current file to be equal to 4 spaces.

It was showing as 8, I went to the config set it to 2 spaces, saved the config then set it back to 4, then it worked for me.

require('ko/editor').scimoz().tabWidth
Number 8

require('ko/editor').scimoz().tabWidth
Number 4