Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

"p" Throws Exception When Valid Node Passed

Offen Anfängerfreundlich
#3,362 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
lua
Bereich
cli

Rechercherichtung

Beginne in lua/nvim-tree/actions/fs/clipboard.lua in do_paste (um Zeile 363), wo eine Methode namens as auf einem nil-Wert aufgerufen wird, und verfolge dann, wie der über api.fs.paste (lua/nvim-tree/api/impl.lua:165) übergebene Knoten zu diesem Aufruf gelangt. Prüfe, wie clipboard.lua den kopierten- versus den geschnitten-Zustand unterscheidet und welches Knotenfeld sie dort erwartet; die Clean-Room-Reproduktion im Issue-Text ist der schnellste Weg, den Fix zu bestätigen. Erledigt, wenn das Einfügen eines gültigen Knotens über api.fs.paste keinen E5108 mehr wirft.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug
Description

When calling paste with a valid {node}

5108: Lua: ...nvim-tree.lua.dev/lua/nvim-tree/actions/fs/clipboard.lua:363: attempt to call method 'as' (a nil value)
stack traceback:
        ...nvim-tree.lua.dev/lua/nvim-tree/actions/fs/clipboard.lua:363: in function 'do_paste'
        ...nvim-tree.lua.dev/lua/nvim-tree/actions/fs/clipboard.lua:451: in function 'paste'
        ...acker/start/nvim-tree.lua.dev/lua/nvim-tree/api/impl.lua:165: in function 'paste'
        /tmp/nd/config/nvim/nd.lua:74: in function </tmp/nd/config/nvim/nd.lua:70>
Neovim version
NVIM v0.12.5
Build type: RelWithDebInfo
LuaJIT 2.1.1788856981
Operating system and version

Linux 7.2.8-arch1-2

Windows variant

No response

nvim-tree version

478c69c

Clean room replication
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvt-min/site]])
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup({
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  })
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing nvim-tree and dependencies.")
  vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]])
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  local function on_attach(bufnr)
    local function opts(desc)
      return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
    end

    local api = require("nvim-tree.api")

    api.map.on_attach.default(bufnr)

    vim.keymap.set("n", "p", function()
      local explorer = api.tree.get_nodes()
      local node = explorer.nodes[2]
      -- print(vim.inspect(node, { depth = 1 }))
      api.fs.paste(node)
    end, opts("Paste"))
  end

  require("nvim-tree").setup({
    on_attach = on_attach,
  })
end
Steps to reproduce

:NvimTreeOpen

c
p

Expected behavior

copied node should be pasted into the node below

Actual behavior
E5108: Lua: ...art/nvim-tree.lua/lua/nvim-tree/actions/fs/clipboard.lua:363: attempt to call method 'as' (a nil value)
stack traceback:
        ...art/nvim-tree.lua/lua/nvim-tree/actions/fs/clipboard.lua:363: in function 'do_paste'
        ...art/nvim-tree.lua/lua/nvim-tree/actions/fs/clipboard.lua:451: in function 'paste'
        ...ck/packer/start/nvim-tree.lua/lua/nvim-tree/api/impl.lua:165: in function 'paste'
        ...neovim-functionaltest/.github/ISSUE_TEMPLATE/nvt-min.lua:48: in function <...neovim-functionaltest/.github/ISSUE_TEMPLATE/nvt-min.lua:44>
Vorherrschende Sprache
Lua
Sterne
8.7k
Forks
639
Ø Merge
8 Std. 25 Min.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nvim-tree/nvim-tree.lua

Alle Issues in nvim-tree/nvim-tree.lua

Ähnliche Issues

Weitere Issues zu Lua

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.