Skip to content

invalid parent_id when using add_node #331

Answered by MunifTanjim
Otterpatsch asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a rough draft for you to get started:

local Popup = require("nui.popup")
local Line = require("nui.line")
local Text = require("nui.text")
local Tree = require("nui.tree")

local popup = Popup({
  position = "50%",
  size = {
    width = 40,
    height = 20,
  },
  relative = "editor",
})

local tree = Tree({
  bufnr = popup.bufnr,
  get_node_id = function(node)
    -- this is telling NuiTree where we're storing the id
    return node.id
  end,
  prepare_node = function(node)
    -- You can format the text however you want here
    -- Maybe add some colors and styles etc.
    local lines = {}
    for _, raw_line in ipairs(vim.split(node.text, "\n")) do
      table.insert(lines, Line(…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@MunifTanjim
Comment options

@MunifTanjim
Comment options

@Otterpatsch
Comment options

@MunifTanjim
Comment options

Answer selected by Otterpatsch
@MunifTanjim
Comment options

@Otterpatsch
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #330 on February 12, 2024 17:36.