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

feat: file completion for fs-action #1635

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

parisni
Copy link

@parisni parisni commented Dec 30, 2024

currently default fs-action (=popup) does not support completion.
It's possible to fallback on using the neovim native input by setting use_popups_for_input=false
However so far file completion is not activated for relevant action such as move, or create.

This PR enable by default the file-completion on native input actions.

Action includes:

  • move
  • create
  • rename
  • copy

action includes:
- move
- create
- rename
- copy
@@ -163,7 +163,7 @@ local function get_unused_name(
local new_path = parent_path and parent_path .. utils.path_separator .. new_name or new_name
get_unused_name(new_path, using_root_directory, name_chosen_callback)
end
end)
end, {}, "file")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file completion completes relative to the cwd of neo-tree, not relative to the file being renamed. For configs that use show_path="absolute" it's fine but the default is to prefill just the filename/dirname. I think you might be able to modify the buffer-local 'path' option and use file_in_path completion to get better completion?

Copy link
Author

@parisni parisni Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. First of all, I realize file completion for rename has no value. So only remains copy, add, add_directory and move to be relevant with file completion.

For configs that use show_path="absolute" it's fine

It's also perfect for show_path="relative"

but the default is to prefill just the filename/dirname

Yes currently the default does not work.

modify the buffer-local 'path' option

This sounds kind of hacky WDYT?
BTW the completion needs use_popups_for_input=false, so I wonder if it's worth adding the code you suggest or just activating (and documenting) file completion in case both are meet:

use_popups_for_input=false
show_path=relative|absolute

An other reason not to support show_path=none is most of the action here are relevant on the cwd. For eg, move has no value if not using absolute or relative path, you might wan't to move the file at least in the whole project, not only in the current node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants