Beispiel #1
0
    def on_query_completions(self, view, prefix, locations):
        prefs = preferences.load(view)
        debugMsg(prefs, "on_query_completions triggered");

        # don't do anything if not in a PHP source code file
        sel = view.sel()[0]
        pos = sel.end()

        # debugMsg(prefs, "scope_name="+str(view.scope_name(pos)))
        if view.score_selector(locations[0], "source.php") == 0:
            debugMsg(prefs, "not in a source.php scope")
            return []

        if prefs.autocomplete_enabled == False:
            debugMsg(prefs, "autocomplete_enabled was off")
            return []

        id = view.id()
        debugMsg(prefs, "on_query_completions id="+str(id))
        if id in completionsCache:
            _completions = completionsCache[id]
            del completionsCache[id]
            debugMsg(prefs, "_completions="+str(_completions))
            return _completions

        return []
Beispiel #2
0
 def on_post_save(self, view):
     prefs = preferences.load(view)
     if prefs.rescan_on_save == True:
         extension_types = prefs.php_extensions
         for extension in prefs.php_extensions:
             if view.file_name().endswith(extension):
                 self.rescanFile(prefs, view, view.file_name())
Beispiel #3
0
 def on_post_save(self, view):
     prefs = preferences.load(view)
     if prefs.rescan_on_save == True:
         extension_types = prefs.php_extensions
         for extension in prefs.php_extensions:
             if view.file_name().endswith(extension):
                 self.rescanFile(prefs, view, view.file_name())
Beispiel #4
0
    def on_query_completions(self, view, prefix, locations):
        prefs = preferences.load(view)
        debugMsg(prefs, "on_query_completions triggered")

        # don't do anything if not in a PHP source code file
        sel = view.sel()[0]
        pos = sel.end()

        # debugMsg(prefs, "scope_name="+str(view.scope_name(pos)))
        if view.score_selector(locations[0], "source.php") == 0:
            debugMsg(prefs, "not in a source.php scope")
            return []

        if prefs.autocomplete_enabled == False:
            debugMsg(prefs, "autocomplete_enabled was off")
            return []

        id = view.id()
        debugMsg(prefs, "on_query_completions id=" + str(id))
        if id in completionsCache:
            _completions = completionsCache[id]
            del completionsCache[id]
            debugMsg(prefs, "_completions=" + str(_completions))
            return _completions

        return []
Beispiel #5
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     scan_dirs = prefs.getProjectScanDirs(self.view)
     db_file = prefs.getDBFilePath(self.view)
     sublime.status_message("PHPCI: scanning project")
     phpdaemon.runAsyncRemoteCommandInPHPDaemon(
         prefs, 'scanProject', [scan_dirs, prefs.exclude_patterns, db_file])
Beispiel #6
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     view = self.view
     view.run_command('auto_complete', {
         'disable_auto_insert': True,
         'api_completions_only': True,
         'next_completion_if_showing': False,
     })
Beispiel #7
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     view = self.view
     view.run_command(
         'auto_complete', {
             'disable_auto_insert': True,
             'api_completions_only': True,
             'next_completion_if_showing': False,
         })
Beispiel #8
0
    def on_modified(self, view):
        if view.settings().get('syntax') != 'Packages/PHP/PHP.tmLanguage':
            return

        prefs = preferences.load(view)
        self.queueBackgroundAutocompletions(prefs, view)
        # self.triggerAutocomplete(view)

        # show autocompletions in one second if there are any to show
        def _callback():
            if view.id() in completionsCache:
                self.triggerAutocomplete(prefs, view)
        sublime.set_timeout(_callback, 1000)
Beispiel #9
0
    def on_modified(self, view):
        if view.settings().get('syntax') != 'Packages/PHP/PHP.tmLanguage':
            return

        prefs = preferences.load(view)
        self.queueBackgroundAutocompletions(prefs, view)

        # self.triggerAutocomplete(view)

        # show autocompletions in one second if there are any to show
        def _callback():
            if view.id() in completionsCache:
                self.triggerAutocomplete(prefs, view)

        sublime.set_timeout(_callback, 1000)
Beispiel #10
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     # project = get_project(self.view)
     # debugMsg(prefs, 'poject is '+str(project))
     db_file_path = prefs.getDBFilePath(self.view)
     debugMsg(prefs, 'getDBFilePath = '+str(db_file_path))
Beispiel #11
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     phpdaemon.runAsyncRemoteCommandInPHPDaemon(prefs, 'debugSleep', [3])
Beispiel #12
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     phpdaemon.runRemoteCommandInPHPDaemon(prefs, 'quit', [])
Beispiel #13
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     scan_dirs = prefs.getProjectScanDirs(self.view)
     db_file = prefs.getDBFilePath(self.view)
     sublime.status_message("PHPCI: scanning project")
     phpdaemon.runAsyncRemoteCommandInPHPDaemon(prefs, 'scanProject', [scan_dirs, prefs.exclude_patterns, db_file])
Beispiel #14
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     self.rescanFile(prefs, self.view, self.view.file_name())
Beispiel #15
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     self.rescanFile(prefs, self.view, self.view.file_name())
Beispiel #16
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     # project = get_project(self.view)
     # debugMsg(prefs, 'poject is '+str(project))
     db_file_path = prefs.getDBFilePath(self.view)
     debugMsg(prefs, 'getDBFilePath = ' + str(db_file_path))
Beispiel #17
0
if __name__ == "__main__":
    

    if len(sys.argv) < 1:
        print "Call as %s" % sys.argv[0]
        sys.exit(1)

   
    if getattr(sys, 'frozen', None):
        basedir = sys._MEIPASS
    else:
        basedir = os.path.dirname(__file__)
           
    if os.path.isfile(os.path.join(basedir, "preferences.json")):
        preferences.load(os.path.join(basedir, "preferences.json"))
    else:
        preferences.load(os.path.join(basedir, "defaults.json"))
        
        
    setLogLevel(prefOrVal("main", "logLevel", INFO))
    setFileLog(os.path.join(basedir, "yajsig.log"), prefOrVal("main", "fileLogLevel", DEBUG))
    
    global qapp    
    qapp = QApplication([])


    try:

        if len(sys.argv) == 3:
            username = sys.argv[1]
Beispiel #18
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     phpdaemon.runAsyncRemoteCommandInPHPDaemon(prefs, 'debugSleep', [3])
Beispiel #19
0
 def run(self, edit):
     prefs = preferences.load(self.view)
     phpdaemon.runRemoteCommandInPHPDaemon(prefs, 'quit', [])
Beispiel #20
0
#!/usr/bin/python

# Simple script to gather used preferences from the code and make sure they are present in preferences.json, and/or filter for defaults.json

import re, glob, os, sys
import preferences

print "Loading preferences"

preferences.load("preferences.json")

prefre = re.compile('(?:pref|prefDir)\("([^"]*)", *"([^"]*)"')

found = {}

for f in glob.glob("*.py"):

    lines = open(f,"r").readlines()
    
    for l in lines:
        
        for m in prefre.findall(l):
        
            if m[0] != '':
                mod = m[0]
                val = m[1]
            else:
                mod = m[2]
                val = m[3]
        
        
Beispiel #21
0
    args = parser.parse_args()

    prefs = args.preferences
   
    if not os.path.isfile(prefs):    
        if not os.path.isabs(prefs):
            if os.path.isfile(os.path.join(basedir, "preferences.json")):
                prefs = os.path.join(basedir, "preferences.json")
            else:
                prefs = os.path.join(basedir, "defaults.json")
        else:
            log(ERROR, "Couldn't load preferences file '%s'!" % prefs)

    prefbase = basedir
    if prefs:            
        preferences.load(prefs)
        prefbase = prefs.rsplit(os.path.sep, 1)
        if len(prefbase) == 1:
            prefbase = '.'
        else:
            prefbase = prefbase[0]
            
    setLogLevel(pref("yajsis", "logLevel", INFO))
    setFileLog(os.path.join(prefbase, "yajsis.log"), pref("yajsis", "fileLogLevel", DEBUG))

    root = os.path.abspath(os.path.dirname(__file__))

    
    conf = {'/' :      {'tools.sessions.on': True },
            '/res':    {'tools.staticdir.on': True,
                        'tools.staticdir.dir': '%s/yajsis_resources' % root},