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

fix: opening file starting with a plus #2509

Merged
merged 1 commit into from
May 14, 2023

Conversation

Conni2461
Copy link
Member

fix #2502

@@ -165,6 +165,9 @@ action_set.edit = function(prompt_bufnr, command)
-- prevents restarting lsp server
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
filename = Path:new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
if filename:sub(1, 1) == "+" then
filename = "\\" .. filename
end
Copy link
Contributor

@jamestrew jamestrew May 14, 2023

Choose a reason for hiding this comment

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

Can't we put the vim.fn.fnameescape after the Path:new?

      filename = Path:new(filename):normalize(vim.loop.cwd())
      filename = vim.fn.fnameescape(filename)
      pcall(vim.cmd, string.format("%s %s", command, filename))

I think this might be more robust

Copy link
Member Author

Choose a reason for hiding this comment

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

i am pretty sure we already had this and i broke things (like this was early telescope), but we could try again.

Copy link
Contributor

@jamestrew jamestrew May 14, 2023

Choose a reason for hiding this comment

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

I'm not sure if vim.fn.fnameescape inside the Path:new is serving much purpose.
edit: just missed your reply before posting this - this wasn't meant as a response to your reply

Copy link
Member Author

Choose a reason for hiding this comment

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

so fnameescape breaks $types.d.ts in cwd e.g.

I dont know what the inner fnameescape does ^^

Copy link
Contributor

Choose a reason for hiding this comment

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

so fnameescape breaks $types.d.ts in cwd e.g.

really? I'm not experiencing this
touch "$types.d.ts" followed by

:lua vim.cmd(string.format("e %s", vim.fn.fnameescape("$types.d.ts")))

Copy link
Member Author

Choose a reason for hiding this comment

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

seems like the issue is that we do the fnameescape twice, once outside and once inside Path, thats why it wasnt working, when i just tested it

@Conni2461
Copy link
Member Author

lets try it, but i am not gonna backport it yet, gonna wait one day

@Conni2461
Copy link
Member Author

I can't seem to reproduce any errors/files that dont seem to open correctly.

Thanks for the help :)

@Conni2461 Conni2461 merged commit ebf9339 into nvim-telescope:master May 14, 2023
@Conni2461 Conni2461 deleted the fix/file_with_plus branch May 14, 2023 20:27
Conni2461 added a commit that referenced this pull request May 24, 2023
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.

Filenames beginning with a +
2 participants