Accessing the BracketMatcher object from its package


#1

Hi there,

I am new to atom and I am trying to extend a feature from the existing bracket-matcher package. I want to use BracketMatcher’s methods to find the beginning and closing brackets for the scope I am in. Then I want to apply styling to the code that sits between the brackets (using code in my own package).

I’d rather not create a new BrcketMatcher object if one already exists, but I don’t think that the bracket-matcher package exports the instance it creates. Any guidance would be appreciated.

Thanks


#2

I can’t help you but you might get an answer on the bracket-matcher repo.


#3

Why not extend the bracket-matcher package itself?


#4

Is there a more correct way of doing that rather than atom.packages.resolvePackagePath('bracket-matcher')?


#5

I meant that you should create a Pull Request for the bracket-matcher package with the enhancement you want and work with the maintainers to have it added.


#6

Ah, sorry I misunderstood. I agree that would be a good course of action, however I worry that this feature might fall outside of the scope of bracket-matcher. I will look into proposing the feature if I cannot find another way to make this its own package.


#7

I need to do it too, someone have a solution? I think about create a bracket-matcher pull isn’t the rigth way…


#8

I disagree. If there is some extension or even extension point you need added to the bracket-matcher package, a Pull Request is exactly the correct way to go. The only other real option is forking it.

For an example of adding an extension point to an existing package, see my Pull Request on the tree-view package to add a service that allows for extending the icons displayed in the tree view for files: