Skip to content

Getting error on import API module: field < copy > #1461

Closed
@kevinm6

Description

@kevinm6

Description

(First, great work on this plugin, I really like it and use everyday).

I tried to improve my nvim-tree config replacing some nvim-tree.lib with the relatives from the new Api module.
But on trying I’m always getting an error in import that module, specifically this field copy in api!

The error is : attempt to index field copy (a function value)

Neovim version

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Operating system and version

macOS 12.0.1

nvim-tree version

86b9da5

Minimal config

local ok, nvim_tree = pcall(require, "nvim-tree")
if not ok then return end

local api = require "nvim-tree.api"

local function trash_file()
  local node = api.get_node_under_cursor()

  -- code
  api.tree.reload()
end

local function vsplit_preview()
  local node = api.get_node_under_cursor()

  if node.link_to and not node.nodes then
    api.tree.open(node.link_to)
  else
    api.tree.open(node.absolute_path)
  end
  api.tree.focus()
end

Steps to reproduce

nvim

Expected behavior

No response

Actual behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions