Sublime Forum

Get view from internal command, and regex group

#1

hi i’m working on an extension of this plugin: https://github.com/aziz/SublimeHyperClick

i need to call the view from inside a new resolver

import sublime
def __init__(self, view, str_path, current_dir, roots, lang, settings): #view from original calling file
        self.view = view
.......
def resolve(self):
        regions = self.view.find_all(self.vendor_dirs[0])

but if i use to bypass the import of the view

       regions = sublime.Window.active_view().find_all(self.vendor_dirs[0])

it say that active_view needs a parameter (even if in the documentation there is no parameters) and if i pass self it’s not the correct element.

i want to prevent to pass to all the methods the main view.

how i can archive it?

thanks

0 Likes

#2
sublime.active_window().active_view()

But, why can’t you use self.view?

1 Like

#3

thanks i will try!

i need to ask to the owner of the project the possibility to refactor the self.view() thing.

originally the code was:

def __init__(self, str_path, current_dir, roots, lang, settings):

because i try tu use it but it’s undefined in this method, even if i have import all the necessary parts.

0 Likes