helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.62k stars 2.5k forks source link

Languages.toml shouldn't have a todo.txt autoformatter #10113

Closed heldrida closed 7 months ago

heldrida commented 7 months ago

Summary

Hi, after updating to latest version helix 24.3 (2cadec0b) and editing my daily note taking file, noticed that Helix modified it. Unfortunately the file is named "todo.txt" which matches to an autoformatter which targets "todo.txt".

This is a local file that I happen to use for note taking + todo list. I did not lost the data but the text is now "sorted" in such way that I lost the significance of notes.

I believe that this is bad user experience and we should not have this autoformater targeting "todo.txt".

Reproduction Steps

Edit a file with any content which is named todo.txt

hx todo.txt

Save

:w

The text should be sorted, which means that if you have text it'll be all over the place.

Helix log

~/.cache/helix/helix.log ``` please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines ```

Platform

macOS

Terminal Emulator

alacritty

Installation Method

brew

Helix Version

helix 24.3 (2cadec0b)

archseer commented 7 months ago

It's the intended behaviour of todo.tx though: https://github.com/todotxt/todo.txt/blob/master/README.md#complete-tasks-2-format-rules

heldrida commented 7 months ago

@archseer I find this quite odd. If "todo.xt" is a thing, then should be opt-in by the user. If I want to sort my text, I can do it myself as Helix allows me to pipe to sort, I don't need an overqualified "todo.txt" plugin like behaviour meddling with my basic text files, which happens to match some opinionated obscure plugin.

nathanielknight commented 1 month ago

I've also been bitten by this (e.g. I had my tasks sorted within each priority bucket and then that information was discarded by the formatter).

It's not clear to me from the linked definition that the file should necessarily be sorted: it mentions sorting lines as an example of something a user might want (which Helix can, of course, easily do), but the stated goal is:

A user can manipulate the file contents in a plain text editor in sensible, expected ways.

Anyways, here's a silly hack you can add to your languages.toml file to disable this feature:

[[language]]
name = "todotxt"
formatter = { command = "cat" }