Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.x; Neo-tree shows nothing. #184

Closed
wookayin opened this issue Mar 19, 2022 · 17 comments
Closed

v2.x; Neo-tree shows nothing. #184

wookayin opened this issue Mar 19, 2022 · 17 comments
Labels
bug Something isn't working
Milestone

Comments

@wookayin
Copy link
Contributor

4831beb (HEAD -> v2.x, origin/v2.x)

My neotree config

Note: this was working OK in v1.x, the only change is hijack_netrw_behavior renaming:

  -- https://github.com/nvim-neo-tree/neo-tree.nvim#quickstart
  require('neo-tree').setup {
    filesystem = {
      hijack_netrw_behavior = "open_current",
      window = {
        width = 30,

        mappings = {
          ["r"] = "refresh",
          ["R"] = "rename",
        },
      },

      -- This is a useful feature to turn on,
      -- but should be disabled for a workaround until #111 is fixed
      follow_current_file = false,
      use_libuv_file_watcher = false,

      -- Append trailing slashes on directories (#112)
      components = {
        trailing_slash = function ()
          return {
            text = "/",
            highlight = "NeoTreeDirectoryIcon",
          }
        end,
      },
      renderers = {
        directory = {
          {"icon"},
          {"name", use_git_status_colors = false},
          {"trailing_slash"},
          {"diagnostics"},
          {"git_status"},
        }
      },
    },

    -- Layout (see #130)
    default_component_configs = {
      indent = {
        with_markers = true,
        indent_marker = "│",
        last_indent_marker = "└",
        indent_size = 2,
        padding = 0, -- extra padding on the left hand side
      },
      icon = {
        default = "",
      },
    },
  }

What happens: it literally shows nothing, on every :NeoTree-opening commands.

image

@cseickel
Copy link
Contributor

We don't actually have any commands that start with NeoTreeOpen. Did you create a custom command that is mapped to the lua api? There may have been a breaking change there that I forgot to list.

Does it work if you run these?

:NeoTreeFocus
:Neotree

@wookayin
Copy link
Contributor Author

wookayin commented Mar 20, 2022

Those are defined in plugin/neo-tree.vim which you haven't removed yet: g:neo_tree_remove_legacy_commands is not set for me.

image

Sorry for the confusion: custom commands I had are like:

command! -nargs=0 NeoTree      NeoTreeReveal
command! -nargs=0 NeoTreeOpen  NeoTreeReveal

Of course I did try all of them including the new command: :Neotree and it shows nothing on the file explorer buffer. I haven't investigated the bug by looking at the source code myself yet.

Actually even with the zero config (i.e., no setup {} or just bare setup {} call), the problem remains the same for me, and nothing special is printed in the log file.

@cseickel
Copy link
Contributor

Can you set the log level to trace and post a log here? It may give me a clue as to what's going on.

Also, can you open a terminal at the root of this repo and run make test? Here's is what it looks like for me:
image

@wookayin
Copy link
Contributor Author

I tried setting log level to TRACE but I don't see any debugging message. 8 Tests are just failing -- all saying like nothing is printed on the sidebar.

Testing:        /Users/wookayin/.dotfiles/vim/plugged/neo-tree.nvim/tests/neo-tree/sources/filesystem/filesystem_command_spec.lua
Fail    ||      Filesystem reveal command should reveal the current file in the sidebar
...

I actually found something: this has something to do with neovim itself. I was neovim nightly (NVIM v0.7.0-dev+1283-g77eb6f9dc in my case) where neotree is broken. However, with neovim 0.6.1 stable, the v2 branch works! Could you please try the plugin with nightly neovim?

@cseickel
Copy link
Contributor

I guess you are compiling from source because that commit is 3 hours old! It works on nightly, but that last commit looks like something that may break things.

I'll compile and take a look.

@cseickel
Copy link
Contributor

I checked out the same commit and compiled and I don't have the same problem, although my syntax highlighting is completely broken. Perhaps there is something in your config that is broken in a way that affects neo-tree?

With the logging, you do need to set log_to_file = true to get any messages below the debug level. See https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Troubleshooting for instructions.

@hbiel
Copy link
Contributor

hbiel commented Mar 20, 2022

I had this happen too. I see that your files are in a directory named ".dotfiles". If you press 'H' (as in shift + h) the files should be shown.

You can also set the filesystem filters to always show hidden files.

I don't know if this is the intended behaviour though.

@cseickel
Copy link
Contributor

I had this happen too. I see that your files are in a directory named ".dotfiles". If you press 'H' (as in shift + h) the files should be shown.

That has to be it! With 1.x, the fact that a directory should be hidden was ignored when that directory was a root directory. You could actually call that a bug, but it was also a more intuitive outcome. I'll reinstate that behavior now.

@cseickel cseickel added the bug Something isn't working label Mar 20, 2022
@cseickel cseickel added this to the v2.0 milestone Mar 20, 2022
@cseickel
Copy link
Contributor

The latest commit in main / v2.x fixes the issue of hiding the root folder. Please let me know if that was the cause of your issue @wookayin.

@wookayin
Copy link
Contributor Author

wookayin commented Mar 20, 2022

In my example above, the root directory was a working copy of the neo-tree.nvim repository: /Users/$USER/.dotfiles/vim/plugged/neo-tree.nvim. I still don't see any items after checking out the latest commit.

On /Users/$USER: it works
On /Users/$USER/.dotfiles: it works
On /Users/$USER/.dotfiles/vim: no results
On /Users/$USER/.dotfiles/vim/plugged: no results

Indeed any subdirectory under $USER/.dotfiles will fail to show neotree, even if it is not gitignored.

I feel like the root directory is visible because of the specific condition introduced in cab3a2e but it is not effective for any of the subtree. I don't think the fix was enough.

cseickel added a commit that referenced this issue Mar 20, 2022
@cseickel
Copy link
Contributor

OK, now I think it's right. Thanks for your help figuring it out.

@wookayin
Copy link
Contributor Author

@cseickel Thank you very much for the prompt fix! The 2.0-rc3 version works well!

@wookayin
Copy link
Contributor Author

BTW, don't you need to remove legacy NeoTreeSomething commands (by default unless an user explicitly bring them back?)

@cseickel
Copy link
Contributor

I would love too, but that constitutes a breaking change, and my promise is that there are no breaking changes without a deprecation period.

2.x is the deprecation period for those commands, and they will be completely removed in 3.x.

@wookayin
Copy link
Contributor Author

Yes thanks! I respect those decisions. You may also want to print deprecation warnings when those command are ran, but anyway we have this documented and announced so it should be fine..

@nyngwang
Copy link

nyngwang commented Mar 21, 2022

Probably related to this, at the current main branch:

sometimes it correctly show the folder structure, sometimes it shows an error:

Error executing vim.schedule lua callback: ...k/packer/start/neo-tree.nvim/lua/neo-tree/git/status.lua:58: atte
mpt to index local 'line' (a nil value)
stack traceback:
        ...k/packer/start/neo-tree.nvim/lua/neo-tree/git/status.lua:58: in function 'parse_git_status_line'
        ...k/packer/start/neo-tree.nvim/lua/neo-tree/git/status.lua:141: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Update: I just switch to the v2.x-branch and the bug is gone :) And I found the :Neotree migrations guide really helpful and easy to follow!

bug1.mov

@cseickel
Copy link
Contributor

@nyngwang That's a separate bug that is part of the async git_status feature. I recently made that the default setting in main but is hasn't been released to v2.x yet. I opened a new issue for this: #187.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants