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: report correct amount of files opened and improved error message when Helix can't parse directory as file #12199

Merged
merged 6 commits into from
Dec 8, 2024

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Dec 6, 2024

When you open two of the same file with hx README:6 README:8, it will say Opened 2 files even though only 1 file will be opened (with 1 buffer). This PR fixes that, it will say Opened 1 file now.


The PR also provides context when Helix can't parse a directory as a file. For example, if you do hx README.md helix-term helix will think that helix-term is a file, and since it's a directory you will see an error message:

Error: unable to create new application

Caused by:
    expected a path to file, found a directory. (to open a directory pass it as first argument)

With this PR the error message is improved now:

Error: unable to start Helix

Caused by:
    expected a path to file, but found a directory: "/home/e/r/helix/helix-term". (to open a directory pass it as first argument)

This could happen accidentally, for example if I run hx * I might intuitively think that it'll open each file, but it also opens directories

(note: I also changed unable to create new application as I don't think it makes sense for someone who has no idea of Helix's internals)

@nik-rev nik-rev changed the title fix: report correct amount of files opened and improved context when Helix can't parse directory as file fix: report correct amount of files opened and improved error message when Helix can't parse directory as file Dec 6, 2024
@archseer archseer merged commit db1d842 into helix-editor:master Dec 8, 2024
6 checks passed
CedricMeu pushed a commit to CedricMeu/helix that referenced this pull request Jan 2, 2025
… when Helix can't parse directory as file (helix-editor#12199)

* feat: improve information on the amount of files loaded

* refactor: naming consitency Doc and not Buf

* fix: correct name of method

* chore: appease clippy

* feat: more human error information when Helix cannot start

* refatcor: use if guard on match arm
GladkihEgor pushed a commit to GladkihEgor/helix that referenced this pull request Jan 4, 2025
… when Helix can't parse directory as file (helix-editor#12199)

* feat: improve information on the amount of files loaded

* refactor: naming consitency Doc and not Buf

* fix: correct name of method

* chore: appease clippy

* feat: more human error information when Helix cannot start

* refatcor: use if guard on match arm
diucicd pushed a commit to diucicd/helix that referenced this pull request Jan 8, 2025
… when Helix can't parse directory as file (helix-editor#12199)

* feat: improve information on the amount of files loaded

* refactor: naming consitency Doc and not Buf

* fix: correct name of method

* chore: appease clippy

* feat: more human error information when Helix cannot start

* refatcor: use if guard on match arm
rmburg pushed a commit to rmburg/helix that referenced this pull request Jan 20, 2025
… when Helix can't parse directory as file (helix-editor#12199)

* feat: improve information on the amount of files loaded

* refactor: naming consitency Doc and not Buf

* fix: correct name of method

* chore: appease clippy

* feat: more human error information when Helix cannot start

* refatcor: use if guard on match arm
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.

4 participants