Closed duianto closed 3 years ago
M-x list-processes fills with python code when a anaconda-mode process is started.
M-x
list-processes
anaconda-mode
anaconda-mode 24769 run *anaconda-mode* /dev/pts/2 python -c from __future__ import print_function # CLI arguments. import sys assert len(sys.argv) > 3, 'CLI arguments: %s' % sys.argv server_directory = sys.argv[-3] server_address = sys.argv[-2] virtual_environment = sys.argv[-1] # Ensure directory. import os server_directory = os.path.expanduser(server_directory) virtual_environment = os.path.expanduser(virtual_environment) if not os.path.exists(server_directory): os.makedirs(server_directory) # Installation check. jedi_dep = ('jedi', '0.13.0') service_factory_dep = ('service_factory', '0.1.5') missing_dependencies = [] def instrument_installation(): for package in (jedi_dep, service_factory_dep): package_is_installed = False for path in os.listdir(server_directory): path = os.path.join(server_directory, path) if path.endswith('.egg') and os.path.isdir(path): if path not in sys.path: sys.path.insert(0, path) if package[0] in path: package_is_installed = True if not package_is_installed: missing_dependencies.append('>='.join(package)) instrument_installation() # Installation. def install_deps(): import site import setuptools.command.easy_install site.addsitedir(server_directory) cmd = ['--install-dir', server_directory, '--site-dirs', server_directory, '--always-copy','--always-unzip'] cmd.extend(missing_dependencies) setuptools.command.easy_install.main(cmd) instrument_installation() if missing_dependencies: install_deps() del missing_dependencies[:] try: import jedi except ImportError: missing_dependencies.append('>='.join(jedi_dep)) try: import service_factory except ImportError: missing_dependencies.append('>='.join(service_factory_dep)) # Try one more time in case if anaconda installation gets broken somehow if missing_dependencies: install_deps() import jedi import service_factory # Setup server. assert jedi.__version__ >= jedi_dep[1], 'Jedi version should be >= %s, current version: %s' % (jedi_dep[1], jedi.__version__,) if virtual_environment: virtual_environment = jedi.create_environment(virtual_environment, safe=False) else: virtual_environment = None # Define JSON-RPC application. import functools import threading def script_method(f): @functools.wraps(f) def wrapper(source, line, column, path): timer = threading.Timer(30.0, sys.exit) timer.start() result = f(jedi.Script(source, line, column, path, environment=virtual_environment)) timer.cancel() return result return wrapper def process_definitions(f): @functools.wraps(f) def wrapper(script): definitions = f(script) if len(definitions) == 1 and not definitions[0].module_path: return '%s is defined in %s compiled module' % ( definitions[0].name, definitions[0].module_name) return [[definition.module_path, definition.line, definition.column, definition.get_line_code().strip()] for definition in definitions if definition.module_path] or None return wrapper @script_method def complete(script): return [[definition.name, definition.type] for definition in script.completions()] @script_method def company_complete(script): return [[definition.name, definition.type, definition.docstring(), definition.module_path, definition.line] for definition in script.completions()] @script_method def show_doc(script): return [[definition.module_name, definition.docstring()] for definition in script.goto_definitions()] @script_method @process_definitions def goto_definitions(script): return script.goto_definitions() @script_method @process_definitions def goto_assignments(script): return script.goto_assignments() @script_method @process_definitions def usages(script): return script.usages() @script_method def eldoc(script): signatures = script.call_signatures() if len(signatures) == 1: signature = signatures[0] return [signature.name, signature.index, [param.description[6:] for param in signature.params]] # Run. app = [complete, company_complete, show_doc, goto_definitions, goto_assignments, usages, eldoc] service_factory.service_factory(app, server_address, 0, 'anaconda_mode port {port}') ~/.emacs.d/anaconda-mode/0.1.13 127.0.0.1 melpa.org -- open -- -- (network connection to melpa.org)
anaconda-mode-20200728.103, (Version: 0.1.13 in anaconda-mode.el)
GNU Emacs 26.3.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12) of 2019-10-31
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
Fixed with #407
M-x
list-processes
fills with python code when aanaconda-mode
process is started.System Info
anaconda-mode-20200728.103, (Version: 0.1.13 in anaconda-mode.el)
PopOS 20.04
GNU Emacs 26.3.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12) of 2019-10-31
Windows 1903
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29