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 with colon #17281

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Fix opening file with colon #17281

merged 4 commits into from
Sep 17, 2024

Conversation

erickguan
Copy link
Contributor

Closes #14100

Release Notes:

  • Fixed unable to open file with a colon from Zed CLI

I didn't make change to tests for the first two commits. I changed them to easily find offending test cases. Behavior changes are in last commit message.

In the last commit, I changed how PathWithPosition should intreprete file paths. If my assumptions are off, please advise so that I can make another approach.

I also believe further constraints would be better for PathWithPosition's intention. But people can make future improvements to PathWithPosition.

Copy link

cla-bot bot commented Sep 2, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @fantasticfears on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

Note:
1. POSIX path supports `:` or `.` as filename
2. zed use `PathWithPosition` for parsing CLI path and in-editor navigation.

Assumptions and implementation:
1. I assume that `PathWithPosition` doesn't know if filepath exists or not.
   Users of the class should be mindful.
2. If a filepath has `:`, and position tag is not well-formatted, the
   implementation will match from right to left to interprete tags.
   This could make unpredictable behavior. Again, I assume that users
   of the class should be mindful.
@erickguan
Copy link
Contributor Author

@cla-bot check

Copy link

cla-bot bot commented Sep 2, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @fantasticfears on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

Copy link

cla-bot bot commented Sep 2, 2024

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 2, 2024
Copy link
Contributor

@jvmncs jvmncs left a comment

Choose a reason for hiding this comment

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

this looks like a good change to me. it resolves the initial error case and adds a lot of test coverage. even if there is still some undefined behavior with position tag parsing, I think that's preferable to what we have now, so I'm good to merge as-is

@jvmncs jvmncs merged commit ecd1830 into zed-industries:main Sep 17, 2024
9 checks passed
@erickguan erickguan deleted the fix-paths branch September 17, 2024 17:39
noaccOS pushed a commit to noaccOS/zed that referenced this pull request Oct 19, 2024
Closes zed-industries#14100

Release Notes:

- Fixed unable to open file with a colon from Zed CLI

-----

I didn't make change to tests for the first two commits. I changed them
to easily find offending test cases. Behavior changes are in last commit
message.

In the last commit, I changed how `PathWithPosition` should intreprete
file paths. If my assumptions are off, please advise so that I can make
another approach.

I also believe further constraints would be better for
`PathWithPosition`'s intention. But people can make future improvements
to `PathWithPosition`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong behaviour opening file that contains colon : in filename
2 participants