Insert Elements into Outline-View (from Atom-IDE)


#1

Hello everyone,

I’m currently working on the java-bytecode-disassembler package for atom (https://atom.io/packages/Java-Bytecode-Disassembler) and trying to implement an Outline-View for it.
The current solution (which is not live) is using a right sidepanel (with addRightPanel()).
However, it is suggested I use the Outline-View panel provided by Atom-IDE as it provides a search bar, is nicer-to-look-at and is being actively developed.

My question is, how can I access the Outlline-view panel from Atom-IDE and add elements to it? The elements I’m trying to add are in html.

Thanks in advance.


#2

That’s the right dock. The docks work a lot like the center panes, particularly in how you open new items in them.


#3

Thank you :slight_smile:


#4

Ok, so I tried following:

const rightDock = atom.workspace.getRightDock();
const panes = rightDock.getPanes();
const item = {
    element: view.getMapPanel(),
    getTitle() {return 'Outline'}
};
panes[0].addItem(item);

and

const item = {
    element: view.getMapPanel(),
    visible: true,
    getTitle() {return 'Outline'},
    getDefaultLocation() {return 'right'},
};
atom.workspace.open(item);

Both led to pretty similar results, which is the creation of a right dock (named “Outline”) which displayed the elements returned from view.getMapPanel().

However, I wasn’t able to add elements to to the Outline-View provided by the Atom IDE (which can be seen on https://github.com/facebook-atom/atom-ide-ui/blob/master/docs/outline-view.md).
According to the docs there, I need to add function provideOutlines() which returns an OutlineProvider.
The situation is that I don’t have a grammar (which is required by OutlineProvider), but I have pre-formatted HTML (which is returned by view.getMapPanel()).

Would it be possible to add the elements returned by view.getMapPanel() (HTML) to be displayed in the Outline-View? And if yes, how?

Thanks in advance


#5

According to the code, OutlineProvider doesn’t require a grammar for its own use, but requires a list of grammar scopes so that it can know when it should be active. Since it turns on based on the presence of a specific scope, you definitely need to have a grammar active in the editor that contains the code your package is working on.