Skip to content

Commit

Permalink
added auto unload conflictive plugins to prevent situations like #587,
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed Nov 17, 2016
1 parent 9662ea4 commit 9440acc
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
8 changes: 7 additions & 1 deletion Anaconda.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -635,5 +635,11 @@
"current_test": "",
"project_tests": ""
},
"swallow_startup_errors": false
"swallow_startup_errors": false,

/*
If this is set to true, anaconda will uload plugins that
make it malfunction intefering with it
*/
"auto_unload_conflictive_plugins": true
}
42 changes: 39 additions & 3 deletions anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sublime_plugin

from .anaconda_lib import ioloop
from .anaconda_lib.helpers import get_settings

from .commands import *
from .listeners import *
Expand Down Expand Up @@ -71,16 +72,51 @@ def monitor_plugins():
"""Monitor for any plugin that conflicts with anaconda
"""

view = sublime.active_window().active_view()
if not get_settings(view, 'auto_unload_conflictive_plugins', True):
return

plist = [
'Jedi - Python autocompletion', 'SublimePythonIDE', 'SublimeCodeIntel'
'Jedi - Python autocompletion', # breaks auto completion
'SublimePythonIDE', # interfere with autocompletion
'SublimeCodeIntel' # breaks everything, SCI is a mess
]
hllist = [
'MagicPython', # breaks autocompletion on [dot]
'Python 3' # breeaks autocompletion on [dot]
]

for plugin in plist:
if plugin in sys.modules:
[sublime_plugin.unload_module(m) for k, m in sys.modules.items() if plugin in k] # noqa
[
sublime_plugin.unload_module(m) for k, m in sys.modules.items()
if plugin in k
]
if plugin not in DISABLED_PLUGINS:
DISABLED_PLUGINS.append(plugin)

sublime.set_timeout_async(monitor_plugins, 30000)
for highlighter in hllist:
paths = os.listdir(sublime.packages_path()) + \
os.listdir(sublime.installed_packages_path())

for p in paths:
if highlighter in p:
fname = '{0}.sublime-settings'.format(highlighter)
s = sublime.load_settings(fname)
if all((s.has('auto_complete_triggers'), s.has('extensions'))):
break
auto_complete = [
{
'characters': '.',
'selector': 'source.python - string - constant.numeric', # noqa
}
]
s.set('extensions', ['py'])
s.set('auto_complete_triggers', auto_complete)
sublime.save_settings(fname)
break

sublime.set_timeout_async(monitor_plugins, 500000)


def enable_plugins():
Expand Down
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"2.1.3": "messages/2.1.3.txt",
"2.1.4": "messages/2.1.4.txt",
"2.1.5": "messages/2.1.5.txt",
"2.1.6": "messages/2.1.6.txt"
"2.1.6": "messages/2.1.6.txt",
"2.1.7": "messages/2.1.7.txt"
}
16 changes: 16 additions & 0 deletions messages/2.1.7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

|
_` | __ \ _` | __| _ \ __ \ _` | _` |
( | | | ( | ( ( | | | ( | ( |
\__,_| _| _| \__,_| \___| \___/ _| _| \__,_| \__,_|
The Sublime Text 3 Python IDE


Anaconda v2.1.7
===============

Welcome to new anaconda v2.1.7, what do you can find in this minor release?

## Enhancements

- Auto disable conflictive plugins while anaconda is active

0 comments on commit 9440acc

Please sign in to comment.