Accessing the BracketMatcher object from its package

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.


1 Like

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

Why not extend the bracket-matcher package itself?

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

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.

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.

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

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: