How to replace a tree-view method in my package?


#1

Hi everyone,

I’m writing a package that re-enables permanent deletion of files. To do this, I want to overwrite the tree-view method removeSelectedEntries. But the current documentation doesn’t give me the slightest clue of how I should do that…
It would be great if anyone could give me a hint.

Thanks!


#2
  • Short way: Fork tree-view and change the code
  • Long way:
    1. Fork tree-view
    2. Add specs for all of the below
    3. Add configuration option
    4. Update the code to respect the configuration option
    5. Submit a Pull Request

You could write a package that monkey-patches a default-installed package, but I personally wouldn’t recommend it.


#3

Lol, never thought of submitting a pull request. Thanks!


#4

Monkey-patching may be an option if you doesn’t intend to publish your code (like when patching something from your init script), but as @leedohm said, I wouldn’t recommend it either, the more Atom come close to 1.0 the less this kind of dirty trick will do.


#5

Submitted PR: https://github.com/atom/tree-view/pull/262


#6

I have some package break every other atom release. Monkey-patching is only one thing that can cause this. I have several monkey-patches in my packages and ironically they haven’t caused a problem.