Example #1
0
    def run(self, edit, args):
        """Insert require statement after the module exports are choosen."""
        module_info = get_module_info(args['module'], self.view)
        module_path = module_info['module_path']
        module_name = module_info['module_name']
        exports = args['exports']
        destructuring = utils.get_pref('destructuring')
        self.edit = edit

        snippet = RequireSnippet(module_name,
                                 module_path,
                                 should_add_var_name=True,
                                 should_add_var_statement=True,
                                 context_allows_semicolon=True,
                                 view=self.view,
                                 file_name=self.view.file_name(),
                                 exports=exports,
                                 destructuring=destructuring)

        content = snippet.get_formatted_code()
        position = self.view.sel()[0].begin()
        self.view.insert(self.edit, position, content)
    def run(self, edit, args):
        """Insert require statement after the module exports are choosen."""
        module_info = get_module_info(args['module'], self.view)
        module_path = module_info['module_path']
        module_name = module_info['module_name']
        exports = args['exports']
        destructuring = utils.get_pref('destructuring')
        self.edit = edit

        snippet = RequireSnippet(
            module_name,
            module_path,
            should_add_var_name=True,
            should_add_var_statement=True,
            context_allows_semicolon=True,
            view=self.view,
            file_name=self.view.file_name(),
            exports=exports,
            destructuring=destructuring
        )

        content = snippet.get_formatted_code()
        position = self.view.sel()[0].begin()
        self.view.insert(self.edit, position, content)
Example #3
0
 def get_many_exports_content(self):
     """Get content for many exports."""
     destruc = utils.get_pref('destructuring')
     if destruc is True:
         return self.get_many_exports_destructured()
     return self.get_many_exports_standard()
Example #4
0
 def get_many_exports_content(self):
     """Get content for many exports."""
     destruc = utils.get_pref("destructuring")
     if destruc is True:
         return self.get_many_exports_destructured()
     return self.get_many_exports_standard()
Example #5
0
 def get_many_exports_content(self):
     destruc = utils.get_pref('destructuring')
     if destruc is True:
         return self.get_many_exports_destructured()
     return self.get_many_exports_standard()