is there a way to select the text contextually based on language syntax (for all supported languages):
lets say I have the following code:
# class block expression
@dataclass
class Foo:
text: str
count: int
f1 = Foo(text="foo", count=10) # single expression
for i in range(f1.count): # loop block expression
print(f"hello {f1.text}") # single expression
so when I put the cursor anywhere within the Foo
class body I would like to select the whole class code (base on the context around the cursor).
I could use regex, but that’s a lot of work and error prone to do manually. another option would be to use a tool like tree-sitter
but that is not native to sublime and requires special wirings to get it working.
I know that sublime has its own builtin syntax engine, however I’m not sure if it exposes any api for plugin developers to make use of.
(BTW, happy new year in advance)