def run(self, edit):
     self.load_settings()
     try:
         language = self.get_language()
         default_def = self.settings.get("worksheet_defaults")
         repl_defs = self.settings.get("worksheet_languages")
         repl_def = dict(default_def.items() + repl_defs.get(language, {}).items())
         filename = self.view.file_name()
         if filename is not None:
             repl_def["cwd"] = path.dirname(filename)
         self.repl = repl.get_repl(language, repl_def)
     except repl.ReplStartError, e:
         return sublime.error_message(e.message)
示例#2
0
 def run(self, edit):
     self.load_settings()
     try:
         language = self.get_language()
         default_def = self.get_repl_settings()
         repl_defs = self.settings.get("worksheet_languages")
         project_repl_defs = self.project_settings.get("worksheet_languages", {})
         repl_def = dict(
             list(default_def) + list(project_repl_defs.get(language, repl_defs.get(language, {})).items()))
         filename = self.view.file_name()
         if filename is not None:
             repl_def["cwd"] = os.path.dirname(filename)
         self.repl = repl.get_repl(language, repl_def)
     except repl.ReplStartError as e:
         return sublime.error_message(str(e))
     self.remove_previous_results(edit)
 def prepare(self):
     try:
         language = self.get_language()
         default_def = self.get_repl_settings()
         repl_defs = self.settings.get("worksheet_languages")
         project_repl_defs = self.project_settings.\
             get("worksheet_languages", {})
         proj_def = project_repl_defs.\
             get(language, repl_defs.get(language, {})).items()
         repl_def = dict(list(default_def) + list(proj_def))
         repl_def['prefix'] = ''
         filename = self.input_buf.name
         if filename is not None:
             repl_def["cwd"] = os.path.dirname(filename)
         self.repl = repl.get_repl(language, repl_def)
     except repl.ReplStartError as e:
         self.error(str(e))
         return
     self.remove_previous_results()
 def prepare(self):
     try:
         language = self.get_language()
         default_def = self.get_repl_settings()
         repl_defs = self.settings.get("worksheet_languages")
         project_repl_defs = self.project_settings.\
             get("worksheet_languages", {})
         proj_def = project_repl_defs.\
             get(language, repl_defs.get(language, {})).items()
         repl_def = dict(list(default_def) + list(proj_def))
         repl_def['prefix'] = ''
         filename = self.input_buf.name
         if filename is not None:
             repl_def["cwd"] = os.path.dirname(filename)
         self.repl = repl.get_repl(language, repl_def)
     except repl.ReplStartError as e:
         self.error(str(e))
         return
     self.remove_previous_results()