From edd363ac2e2f496af4459ae409110c5440f7f0ca Mon Sep 17 00:00:00 2001 From: "DESKTOP-36KV42A\\guill" Date: Sun, 20 Aug 2017 19:10:18 -0300 Subject: [PATCH] Bug fix checking if the syntax file was created or not --- Deviot.py | 12 ++++-------- commands/deviot_rebuild_syntax.py | 2 +- libraries/syntax.py | 9 ++++++++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Deviot.py b/Deviot.py index 0a92197..69f9599 100644 --- a/Deviot.py +++ b/Deviot.py @@ -14,6 +14,7 @@ from .platformio.update import Update from .beginning.pio_install import PioInstall from .libraries.tools import get_setting, save_setting, set_deviot_syntax +from .libraries.syntax import Syntax from .libraries.paths import getBoardsFileDataPath, getMainMenuPath, getPluginPath from .libraries.preferences_bridge import PreferencesBridge from .libraries.project_check import ProjectCheck @@ -30,6 +31,9 @@ def plugin_loaded(): # Search updates Update().check_update_async() + # check syntax files + Syntax().check_syntax_file() + menu_path = getMainMenuPath() compile_lang = get_setting('compile_lang', True) @@ -38,14 +42,6 @@ def plugin_loaded(): TopMenu().make_menu_files() save_setting('compile_lang', False) - # check if the syntax file exist - deviot_syntax = getPluginPath() - syntax_path = path.join(deviot_syntax, 'deviot.sublime-syntax') - - if(not path.exists(syntax_path)): - active_window().run_command('deviot_rebuild_syntax') - - class DeviotListener(EventListener): def on_load(self, view): set_deviot_syntax(view) diff --git a/commands/deviot_rebuild_syntax.py b/commands/deviot_rebuild_syntax.py index 07c5254..a664c95 100644 --- a/commands/deviot_rebuild_syntax.py +++ b/commands/deviot_rebuild_syntax.py @@ -9,4 +9,4 @@ class DeviotRebuildSyntaxCommand(WindowCommand): def run(self): from ..libraries.syntax import Syntax - Syntax() \ No newline at end of file + Syntax().create_files_async() \ No newline at end of file diff --git a/libraries/syntax.py b/libraries/syntax.py index d97746a..7f14812 100644 --- a/libraries/syntax.py +++ b/libraries/syntax.py @@ -23,7 +23,14 @@ def __init__(self): global _ _ = I18n().translate - self.create_files_async() + def check_syntax_file(self): + """ + Check if the syntax file exits, if not create it + """ + deviot_syntax = getPluginPath() + syntax_path = path.join(deviot_syntax, 'deviot.sublime-syntax') + if(not path.exists(syntax_path)): + self.create_files_async() def create_files_async(self): """New thread execution