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

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

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.
@@ -154,7 +156,6 @@ def test_parse_include_single_file_message():

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

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