refactor(#2380): multi instance nvim-tree.marks
This commit is contained in:
committed by
GitHub
parent
48a9290757
commit
4e396b2624
@@ -1,5 +1,4 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local marks = require "nvim-tree.marks"
|
||||
|
||||
local M = {
|
||||
ignore_list = {},
|
||||
@@ -155,8 +154,11 @@ function M.prepare(git_status)
|
||||
status.bufinfo = vim.fn.getbufinfo { buflisted = 1 }
|
||||
end
|
||||
|
||||
for _, node in pairs(marks.get_marks()) do
|
||||
status.bookmarks[node.absolute_path] = node.type
|
||||
local explorer = require("nvim-tree.core").get_explorer()
|
||||
if explorer then
|
||||
for _, node in pairs(explorer.marks:get_marks()) do
|
||||
status.bookmarks[node.absolute_path] = node.type
|
||||
end
|
||||
end
|
||||
|
||||
return status
|
||||
|
||||
@@ -2,6 +2,7 @@ local git = require "nvim-tree.git"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local watch = require "nvim-tree.explorer.watch"
|
||||
local explorer_node = require "nvim-tree.explorer.node"
|
||||
local Marks = require "nvim-tree.marks"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -12,6 +13,7 @@ M.reload = require("nvim-tree.explorer.reload").reload
|
||||
---@field absolute_path string
|
||||
---@field nodes Node[]
|
||||
---@field open boolean
|
||||
---@field marks Marks
|
||||
|
||||
local Explorer = {}
|
||||
Explorer.__index = Explorer
|
||||
@@ -36,6 +38,7 @@ function Explorer.new(path)
|
||||
absolute_path = path,
|
||||
nodes = {},
|
||||
open = true,
|
||||
marks = Marks:new(),
|
||||
}, Explorer)
|
||||
explorer.watcher = watch.create_watcher(explorer)
|
||||
explorer:_load(explorer)
|
||||
|
||||
Reference in New Issue
Block a user