wistful / SublimeAutoPEP8

Automatically formats Python code to conform to the PEP 8 style guide using autopep8 and pep8 modules
144 stars 23 forks source link

Unable to edit settings or load user settings. #38

Closed sudoforge closed 8 years ago

sudoforge commented 9 years ago

Installing the package through Package Control does not unpack the package into Packages/, it simply leaves it in Installed_Packages/.

This causes a few issues:

In this quick example replicating the issue, I left braces around the list (the original object was a dictionary, but values were removed). This is not the cause of the issue.

autopep8-issue

ghost commented 8 years ago

i'm having the same problem, but i'm trying to add w191 to "ignore", because i like to use tabs and it keeps changing to 4 spaces. If anyone know a fix pls tell

wistful commented 8 years ago

@Tuganazy original autopep8 ignores W191 but tries to fix E101(indentation contains mixed spaces and tabs) and E111(indentation is not a multiple of four). You have to ignore these errors(E101,E111) as well to prevent converting tabs to spaces. More information here: autopep8 features, pep8 error codes.

ghost commented 8 years ago

i added all E1?? and it didn't work. also tried to all E401 to ignore imports in multiple lines and it keeps fixing it.

wistful commented 8 years ago

@bddenhartog thank you for your detailed feedback. I've created separate issue to handle keymap overriding(#39).

User's settings file should override default plugin's setting though. The parameter indent-size should work for any for ... in, def fun(): and other statements. To make it work for such objects as dict or list you should ignore E121(continuation line under-indented for hanging indent) error. More information is here: pep8 error codes

wistful commented 8 years ago

@Tuganazy, could you post here or on gist your example and settings?

ghost commented 8 years ago

@wistful, there you go https://gist.github.com/Tuganazy/7352d87b4370d323bd09 i'm just testing with: def asd(): return

and on the return line it swapes my tab by 4 spaces.

wistful commented 8 years ago

@Tuganazy, works for me with your config in ST2 and ST3. May be other plugin overrides tabs with spaces, or it might be sublime's settings.

ghost commented 8 years ago

i use CTRL+8 to preview , so i don't think its another plugin. You know what settings could be messing it up?

wistful commented 8 years ago

Probably it's SublimeAutoPEP8 in this case. Which settings have you changed: default or user? Plugin uses default settings and then overrides it with user settings.

wistful commented 8 years ago

@Tuganazy, please provide which version of sublime do you use(Help -> About Sublime Text) and which version of SublimeAutoPEP8 has been installed(Package Control -> List Package)

ghost commented 8 years ago

autopep8 v1.3 ST3 build 3083

the gist that i linked is what i have in the autopep8 > settings - user (default also doesn't let me edit it) it just looks like its not even loading the settings, i also tested the line lenght and i also doesn't work

wistful commented 8 years ago

@Tuganazy, could you please post your logs: 1) Restart ST3 2) Open SublimeAutoPEP8 user settings 3) Save the settings 4) Open Console(View -> Show Console) 5) Copy logs and post it on gist or other service

ghost commented 8 years ago

https://gist.github.com/Tuganazy/2285dd9d0ba53cbb3cae

wistful commented 8 years ago

@Tuganazy, I see that AutoPep8 plugin is loaded, but there is no records about reloading settings. The line reloading Packages/User/AutoPep8.sublime-settings should appear in the console if you open AutoPep8 User Settings and save the file(even if there are no changes).

ghost commented 8 years ago

@wistful Can you tell me how can i do a manual installation of the plugin? Maybe something i going wrong while installing

wistful commented 8 years ago

@Tuganazy, please follow next steps: update the plugin to the latest version 1.3.1 add new option "debug": true to the User config restart sublime text run preview or format command on your file copy all logs from the output console and put it with python code example here or into gist.

liujb commented 8 years ago

hi, wistful. I have this problem also. my version is ST3, mac os x, autopep3 version is 1.3.1. when I install bypackage control. tell me No such file or directionay. like `,I install manual, can editAutoPep8.sublime-settings` but can not format. hope reply. thanks

wistful commented 8 years ago

@liujb, could you please provide output from the ST3 console and path of not found path/directory?

sandeepklr commented 8 years ago

I am having a similar problem. Having changed max_line_length in User settings to 200, the plugin still shows E501 errors for a line that is just longer than 79 characters.

Setting the debug=true flag seems shows that the new config is picked up, however it doesn't seem to apply it.

ST3 console debug:

    plugin: version=1.3.1
    config: {'aggressive': 0, 'avoid_new_line_in_select_mode': False, 'list-fixes': '',
        'file_menu_search_depth': 3, 'select': '', 'format_on_save': False, 'indent-size': 4,
        'debug': True, 'max-line-length': 200, 'ignore': 'E501', 'syntax_list': ['Python']}

I also tried adding E501 to the list of ignored errors, but to no avail.

Screenshot of code line with E501 error in status bar.

screen shot 2015-10-12 at 2 53 47 pm

wistful commented 8 years ago

@sandeepklr, SublimeAutoPEP8 plugin doesn't highlight pep8 errors and warnings but only formats code. I'd suggest to take a look at other plugins.

wistful commented 8 years ago

Fixed in dev version: v1.3.2-rc2.

wistful commented 8 years ago

Fixed in stable version: v1.3.2.