Skip to content

Try to send unmodified file paths from the >>> include section#155

Closed
juodumas wants to merge 1 commit intomadox2:mainfrom
juodumas-forks:improve-file-path-handling-in-include-section
Closed

Try to send unmodified file paths from the >>> include section#155
juodumas wants to merge 1 commit intomadox2:mainfrom
juodumas-forks:improve-file-path-handling-in-include-section

Conversation

@juodumas
Copy link
Contributor

When sending file paths from the >>> include section, try to send file paths as the user typed them instead of expanding them:

  • When the user provides an absolute path, send it as-is, but replace home dir with ~ to avoid sending the username to API providers.
  • When the user provides a relative path, send it as a relative path.
  • When the user provides a glob under a relative path, keep the resulting path relative to the current working dir.

This is an attempt to improve #149 based on comments here e375e05#commitcomment-153576019

When sending file paths from the `>>> include` section, try to send file
paths as the user typed them instead of expanding them:
* When the user provides an absolute path, send it as-is, but replace
  home dir with `~` to avoid sending the username to API providers.
* When the user provides a relative path, send it as a relative path.
* When the user provides a glob under a relative path, keep the
  resulting path relative to the current working dir.

try harder
""")
messages = parse_chat_messages(chat_content)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed this (and another one below) because it looks like a leftover.

@madox2
Copy link
Owner

madox2 commented Mar 14, 2025

Hi, thank you for the PR!

When the user provides an absolute path, send it as-is, but replace home dir with ~ to avoid sending the username to API providers.

I am not sure, will this work on windows?

I would be also fine if all paths are handled just "as is".

@Konfekt
Copy link
Contributor

Konfekt commented Mar 14, 2025

One OS independent manner could be `vim.eval('fnamemodify(...)') since it's used anyway, but I guess Python can handle it as well, but maybe requires more care

@madox2 madox2 closed this in facdd6e Mar 21, 2025
@madox2
Copy link
Owner

madox2 commented Mar 21, 2025

@Konfekt @juodumas I made the paths to be handled "as is" - absolute or relative - depending on what is used in include section. Hope that works for both of you

@juodumas
Copy link
Contributor Author

Thanks for finishing this @madox2

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.

3 participants