|
| 1 | +local decorator_registry = require("nvim-tree.renderer.decorator.registry") |
1 | 2 | local notify = require("nvim-tree.notify") |
2 | 3 | local utils = require("nvim-tree.utils") |
3 | 4 | local view = require("nvim-tree.view") |
4 | 5 |
|
5 | 6 | local Class = require("nvim-tree.classic") |
6 | 7 | local DirectoryNode = require("nvim-tree.node.directory") |
7 | | - |
8 | | -local DecoratorBookmarks = require("nvim-tree.renderer.decorator.bookmarks") |
9 | | -local DecoratorCopied = require("nvim-tree.renderer.decorator.copied") |
10 | | -local DecoratorCut = require("nvim-tree.renderer.decorator.cut") |
11 | | -local DecoratorDiagnostics = require("nvim-tree.renderer.decorator.diagnostics") |
12 | | -local DecoratorGit = require("nvim-tree.renderer.decorator.git") |
13 | | -local DecoratorModified = require("nvim-tree.renderer.decorator.modified") |
14 | | -local DecoratorHidden = require("nvim-tree.renderer.decorator.hidden") |
15 | | -local DecoratorOpened = require("nvim-tree.renderer.decorator.opened") |
| 8 | +local DecoratorUser = require("nvim-tree.renderer.decorator.user") |
16 | 9 |
|
17 | 10 | local pad = require("nvim-tree.renderer.components.padding") |
18 | 11 |
|
@@ -56,21 +49,17 @@ function Builder:new(args) |
56 | 49 | self.signs = {} |
57 | 50 | self.extmarks = {} |
58 | 51 | self.virtual_lines = {} |
59 | | - self.decorators = { |
60 | | - -- priority order |
61 | | - DecoratorCut(self.explorer), |
62 | | - DecoratorCopied(self.explorer), |
63 | | - DecoratorDiagnostics(self.explorer), |
64 | | - DecoratorBookmarks(self.explorer), |
65 | | - DecoratorModified(self.explorer), |
66 | | - DecoratorHidden(self.explorer), |
67 | | - DecoratorOpened(self.explorer), |
68 | | - DecoratorGit(self.explorer), |
69 | | - } |
70 | 52 | self.hidden_display = Builder:setup_hidden_display_function(self.explorer.opts) |
71 | 53 |
|
72 | | - for _, user_decorator in ipairs(args.explorer.opts.renderer.user_decorators) do |
73 | | - table.insert(self.decorators, user_decorator.class()) |
| 54 | + -- lowest priority is registered first |
| 55 | + self.decorators = {} |
| 56 | + local decorator_args = { explorer = self.explorer } |
| 57 | + for _, d in ipairs(decorator_registry.registered) do |
| 58 | + if d:is(DecoratorUser) then |
| 59 | + table.insert(self.decorators, 1, d()) |
| 60 | + else |
| 61 | + table.insert(self.decorators, 1, d(decorator_args)) |
| 62 | + end |
74 | 63 | end |
75 | 64 | end |
76 | 65 |
|
|
0 commit comments