Skip to content

Commit

Permalink
Bug fix checking if the syntax file was created or not
Browse files Browse the repository at this point in the history
  • Loading branch information
gepd committed Aug 20, 2017
1 parent 031b5ae commit edd363a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 4 additions & 8 deletions Deviot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion commands/deviot_rebuild_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class DeviotRebuildSyntaxCommand(WindowCommand):

def run(self):
from ..libraries.syntax import Syntax
Syntax()
Syntax().create_files_async()
9 changes: 8 additions & 1 deletion libraries/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edd363a

Please sign in to comment.