Skip to content

Commit

Permalink
Don't add several listeners for each editor
Browse files Browse the repository at this point in the history
Related to, although not a solution for, #35.
  • Loading branch information
belcar-s committed May 23, 2022
1 parent 83660e0 commit e927b60
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/commands/sidebar_find_symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,11 @@ class SymbolDataProvider implements TreeDataProvider<Element> {
disposable = createEventListener(updateSymbols);
};

for (const textEditor of nova.workspace.textEditors) {
updateSymbolsAndManageDisposable(
nova.workspace.onDidAddTextEditor((textEditor) => {
return updateSymbolsAndManageDisposable(
textEditor.onDidStopChanging.bind(textEditor),
);
}

nova.workspace.onDidAddTextEditor((textEditor) =>
updateSymbolsAndManageDisposable(
textEditor.onDidStopChanging.bind(textEditor),
)
);
});
}

getChildren(element: Element | null) {
Expand Down

0 comments on commit e927b60

Please sign in to comment.