DamnWidget / anaconda

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
http://damnwidget.github.io/anaconda/
GNU General Public License v3.0
2.22k stars 260 forks source link

docstring tooltip is sometimes shown on save #344

Closed hyperknot closed 9 years ago

hyperknot commented 9 years ago

Many times (50% of the time, but it happens either always on or always not) anaconda shows a docstring tooltip when I save a file. It only happens if the cursor is over a doctstring-able variable/function.

I don't know what does it depend on, sometimes it happens, sometimes it doesn't.

DamnWidget commented 9 years ago

Couldn't reproduce it

hyperknot commented 9 years ago

This tooltip thing goes even crazier from time to time. I made a screen capturing of the behaviour when it was just always displaying docstring tooltips, all the time, without me pressing any buttons, not even saving. Then after removing a character it displayed it again: https://youtu.be/2j5OUGclsTA

DamnWidget commented 9 years ago

Hi. I still can't reproduced that behavior in none of my boxes so it's really hard to fix something that I can't test. I've seen the video and I agree that's pretty annoying.

Which other plugins do you have installed in your Sublime Text along with anaconda?

While we find the possible cause for that behavior in your environment you will want to disable the tooltips setting enable_signatures_tooltip": false at any of your configuration levels.

hyperknot commented 9 years ago

these are all my packages, I'll try to debug and see if disabling them helps:

    "installed_packages":
    [
        "Anaconda",
        "Compare Side-By-Side",
        "CSS Format",
        "Expand Tabs on Save",
        "HexViewer",
        "HTMLBeautify",
        "INI",
        "JavaScriptNext - ES6 Syntax",
        "Jinja2",
        "JsFormat",
        "JSHint",
        "JSONLint",
        "LESS",
        "Less2Css",
        "Neon Color Scheme",
        "Package Control",
        "Plist Binary",
        "Pretty JSON",
        "Python Flake8 Lint",
        "Python Improved",
        "Theme - Soda",
        "URLEncode"
    ]
hyperknot commented 9 years ago

I found it! It's Expand Tabs on Save, an other very useful package for Python developers.

The whole package is only 10 lines of Python code, I believe you can even integrate the functionality into Anaconda if you'd like. It'd be a great feature for Anaconda (very useful to convert tabs to spaces in the Python world), and this bug could be taken care of.

https://github.com/bubenkoff/ExpandTabsOnSave-SublimeText/blob/master/ExpandTabsOnSave.py

BTW, the code of that plugin is just super super simple, all it does is it runs view.run_command('expand_tabs') in an on_pre_save hook. I think Anaconda should handle this situation easily, there must be other plugins doing something in a on_pre_save hook.

DamnWidget commented 9 years ago

I guess the expand action fires the on_modified trigger in Sublime Text 3, not much that can be done in anaconda really.

hyperknot commented 9 years ago

I guess there must be a workaround, why would an on_modified trigger a docstring window? I believe if you'd integrate this feature into Anaconda itself, you can control exactly when is it called thus avoid the bug. But what with all other plugins which call something similar?

DamnWidget commented 9 years ago

The tooltip is shown after a successful linting of the buffer, the linter is triggered on modifications if you have it configured to run always in the background.

hyperknot commented 9 years ago

But I explicitly disabled the linting: with "anaconda_linting": false,

DamnWidget commented 9 years ago

Oh, you are right, I forgot that I decoupled that functionality and now is independent from the linting process.

DamnWidget commented 9 years ago

This has been fixed already (at least for this case) and will be available in the next release (probably tomorrow or next Saturday).

hyperknot commented 9 years ago

Cool, looking forwards to trying it!