From 689cf3b3c76c9d91c3fe46724e74f1bc6d83e515 Mon Sep 17 00:00:00 2001 From: Igor Bogoslavskyi Date: Tue, 10 May 2016 16:12:36 +0200 Subject: [PATCH] moved to having only relative includes --- EasyClangComplete.py | 13 +++++-------- plugin/completion/base_complete.py | 4 ++-- plugin/completion/bin_complete.py | 6 +++--- plugin/completion/lib_complete.py | 26 +++++++++++++------------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/EasyClangComplete.py b/EasyClangComplete.py index 677f8633..62940d14 100644 --- a/EasyClangComplete.py +++ b/EasyClangComplete.py @@ -16,19 +16,16 @@ import sublime_plugin import os import imp -import sys import logging import os.path as path from threading import Thread -sys.path.append(path.dirname(__file__)) - -from plugin import tools -from plugin import error_vis -from plugin import plugin_settings -from plugin.completion import lib_complete -from plugin.completion import bin_complete +from .plugin import tools +from .plugin import error_vis +from .plugin import plugin_settings +from .plugin.completion import lib_complete +from .plugin.completion import bin_complete # reload the modules imp.reload(tools) diff --git a/plugin/completion/base_complete.py b/plugin/completion/base_complete.py index 0b0acce4..9223edc7 100644 --- a/plugin/completion/base_complete.py +++ b/plugin/completion/base_complete.py @@ -12,7 +12,7 @@ from os import path from os import listdir -from plugin.error_vis import CompileErrors +from .. import error_vis log = logging.getLogger(__name__) @@ -67,7 +67,7 @@ def __init__(self, clang_binary): self.version_str, info) log.info(" Found clang version: %s", self.version_str) # initialize error visuzlization - self.error_vis = CompileErrors() + self.error_vis = error_vis.CompileErrors() def remove(self, view_id): """called when completion for this view is not needed anymore. diff --git a/plugin/completion/bin_complete.py b/plugin/completion/bin_complete.py index c58684ca..7d2eb4a9 100644 --- a/plugin/completion/bin_complete.py +++ b/plugin/completion/bin_complete.py @@ -15,8 +15,8 @@ from os import path -from plugin.error_vis import FORMAT_BINARY -from plugin.completion.base_complete import BaseCompleter +from .. import error_vis +from .base_complete import BaseCompleter log = logging.getLogger(__name__) @@ -200,7 +200,7 @@ def complete(self, view, cursor_pos, show_errors): log.info(" clang process output: \n%s", output_text) if show_errors: self.error_vis.generate(view, output_text.splitlines(), - FORMAT_BINARY) + error_vis.FORMAT_BINARY) self.error_vis.show_regions(view) # we could stop here, but we continue as sometimes there are still # valid completions even though there were errors encountered diff --git a/plugin/completion/lib_complete.py b/plugin/completion/lib_complete.py index 40bfa049..8bd04e29 100644 --- a/plugin/completion/lib_complete.py +++ b/plugin/completion/lib_complete.py @@ -11,20 +11,20 @@ from os import path -from plugin.error_vis import FORMAT_LIBCLANG -from plugin.tools import PKG_NAME -from plugin.completion.base_complete import BaseCompleter +from .. import error_vis +from .. import tools +from .base_complete import BaseCompleter log = logging.getLogger(__name__) cindex_dict = { - '3.2': PKG_NAME + ".clang.cindex32", - '3.3': PKG_NAME + ".clang.cindex33", - '3.4': PKG_NAME + ".clang.cindex34", - '3.5': PKG_NAME + ".clang.cindex35", - '3.6': PKG_NAME + ".clang.cindex36", - '3.7': PKG_NAME + ".clang.cindex37", - '3.8': PKG_NAME + ".clang.cindex38", + '3.2': tools.PKG_NAME + ".clang.cindex32", + '3.3': tools.PKG_NAME + ".clang.cindex33", + '3.4': tools.PKG_NAME + ".clang.cindex34", + '3.5': tools.PKG_NAME + ".clang.cindex35", + '3.6': tools.PKG_NAME + ".clang.cindex36", + '3.7': tools.PKG_NAME + ".clang.cindex37", + '3.8': tools.PKG_NAME + ".clang.cindex38", } @@ -149,7 +149,7 @@ def init(self, view, includes, settings, project_folder): if settings.errors_on_save: self.error_vis.generate( view, self.translation_units[view.id()].diagnostics, - FORMAT_LIBCLANG) + error_vis.FORMAT_LIBCLANG) self.error_vis.show_regions(view) def complete(self, view, cursor_pos, show_errors): @@ -196,7 +196,7 @@ def complete(self, view, cursor_pos, show_errors): if show_errors: self.error_vis.generate( view, self.translation_units[view.id()].diagnostics, - FORMAT_LIBCLANG) + error_vis.FORMAT_LIBCLANG) self.error_vis.show_regions(view) def update(self, view, show_errors): @@ -220,7 +220,7 @@ def update(self, view, show_errors): if show_errors: self.error_vis.generate( view, self.translation_units[view.id()].diagnostics, - FORMAT_LIBCLANG) + error_vis.FORMAT_LIBCLANG) self.error_vis.show_regions(view) return True log.error(" no translation unit for view id %s")