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

Cannot edit a file if the file is named justfile #9703

Closed
drzymalanet opened this issue Feb 22, 2024 · 6 comments · Fixed by #9778
Closed

Cannot edit a file if the file is named justfile #9703

drzymalanet opened this issue Feb 22, 2024 · 6 comments · Fixed by #9778
Labels
A-language-support Area: Support for programming/text languages C-bug Category: This is a bug

Comments

@drzymalanet
Copy link
Contributor

Summary

My edits to the justfile are overwritten. If I change the name, it works. If i create a brand new file named justfile with helix, I can put the file contents into the file, but after reopening and saving, file changes are not saved.

Reproduction Steps

I tried this:

mkdir -p /tmp/test
cd /tmp/test
hx justfile
# Create file contents, then `:wq`
hx justfile
# Change anything and then `:wq`
cat justfile
# Observe that the file did not change.

Repeat the same with a differently named file and it will work. It seems to me that the justfile syntax highlighter is causing the problem but I don't know.

Helix log

When creating the file named justfile:

2024-02-23T00:46:11.334 helix_view::document [ERROR] Formatter error: error: Unknown start of token:
 ——▶ justfile:1:8
  │
1 │ bbbbbbb;
  │        ^

The bbbbb is not what I was adding to the file. It seems that the formatter is in a different dimension.

Platform

Linux

Terminal Emulator

GNOME Terminal 3.28.3

Installation Method

nixpkgs

Helix Version

helix 23.10

@drzymalanet drzymalanet added the C-bug Category: This is a bug label Feb 22, 2024
@the-mikedavis
Copy link
Member

This would be caused by the external formatter rather than the tree-sitter parser:

formatter = { command = "just", args = ["--dump"] }

I can't reproduce this but we should remove that line anyways: just --dump doesn't format stdin, it reads justfile. External formatters should take input from stdin and print the formatted output to stdout

@drzymalanet
Copy link
Contributor Author

@the-mikedavis I have copied the languages.toml file you've mentioned into my helix config dir:

  • Removing that line did not help
  • Setting auto-format = false did fix the issue.

@kirawi
Copy link
Member

kirawi commented Feb 23, 2024

The configs are merged, so you'd have to unset it to "" rather than delete it.

@drzymalanet
Copy link
Contributor Author

@kirawi Yes I figured that out.

@the-mikedavis @kirawi Can we revert commit 0eec518 ?

@the-mikedavis
Copy link
Member

Yep please send a PR

@the-mikedavis the-mikedavis added the A-language-support Area: Support for programming/text languages label Feb 23, 2024
drzymalanet added a commit to drzymalanet/helix that referenced this issue Mar 1, 2024
This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.
@drzymalanet
Copy link
Contributor Author

@the-mikedavis @kirawi @rokf @kpbaks @archseer @rokf
Hello, #9778 is ready.

@the-mikedavis the-mikedavis linked a pull request Mar 1, 2024 that will close this issue
archseer pushed a commit that referenced this issue Mar 2, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue #9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
Desdaemon pushed a commit to Desdaemon/helix that referenced this issue Mar 4, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
shortc pushed a commit to shortc/helix that referenced this issue Mar 31, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
postsolar pushed a commit to postsolar/helix that referenced this issue Apr 4, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
mtoohey31 pushed a commit to mtoohey31/helix that referenced this issue Jun 2, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
Vulpesx pushed a commit to Vulpesx/helix that referenced this issue Jun 7, 2024
* Fix bug 9703 by commenting out the wrong command

This fixes issue helix-editor#9703 by removing the wrong formatting command for justfiles.

* Fix indentation width for justfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants