Open jon-mcclung-sertainty opened 5 years ago
How can you get this given that we already have the auto-fixing on editing 😂
1. alpha
2. bravo
3. charlie
4. delta
Delete line 3
1. alpha
2. bravo
4. delta
Shift+⌥+F
1. alpha
2. bravo
4. delta
Also:
1. alpha
2. bravo
3. charlie
4. delta
Swap lines 2 and 3 (manually, ⌥+Up works fine)
1. alpha
3. charlie
2. bravo
4. delta
Shift+⌥+F
1. alpha
3. charlie
2. bravo
4. delta
How do you delete line 3? If it is cmd+x
, then it might be related to #267.
And for swapping lines, why not using keybindings since you know it...
Anyway, it is a valid small feature request.
I have editor.action.deleteLines
bound to Shift+Delete. Indeed, it does seem to be the same problem as #267, but the request I have is more broad in that it would fix any situation where the line numbers get wrong for any reason.
I see.
I though these settings would affect automatically renumbering ordered lists on format:
However that is not the case in v3.4.3. While I do not understand the engineering effort, I would like to see this feature.
The ordered list should always be up-to-date (renumbered) whether you edit it.
If you see an ordered list is not correctly updated, please tell us how to reproduce it.
Well that's easy:
Before CTRL+SHIFT+I
(format document):
|a|b|
|---|---|
1. x
1. y
1. z
After CTRL+SHIFT+I
(format document):
| a | b |
| --- | --- |
1. x
1. y
1. z
The table is reformatted but the list is not.
So, you just repeated this issue.
This is still a feature request (https://github.com/yzhang-gh/vscode-markdown/labels/Issue%3A%20Feature), and no one here knows how to implement it yet.
I'd recommend you silently click thumbs-up at the opening, and comment only when you have new knowledge to share.
Ordered list interacts with nearly everything in the CommonMark spec. Changing list markers can accidentally destroy a whole document without any obvious indication.
People are unlikely to examine documents carefully every time they format them. At least, they check the output much less often than when actively performing editing. Some even don't have version control, making it hard to recover from broken states.
Thus, it's dangerous to format lists during "Format Document", until someone finds a method that works correctly all the time.
@Lemmingh it seems you are not in the best mood. I appreciate the work on this project and I had no bad intentions.
The extra information is that the availability of the ordered list settings led me to believe that lists would be renumbered on document format.
If you're able to reformat lists when editing them automatically, I do not see why you can not do that when formatting a document. Perhaps because I have not seen the cases where, as you mention, renumbering ordered lists automatically destroys the whole document. If this is an issue, it can be implemented as opt-in rather than opt-out.
Like I mentioned, I do not understand the engineering effort required to implement this. I expect the code paths for formatting the document and renumbering lists to be different so it is probably non-trivial to do it well. I was not aware that giving a thumbs up to the original issue would help you prioritize this. I just wrote a comment instead. If you use thumbs up on the first post for feature issues as information to help prioritize them, maybe it is a good idea to add it to the https://github.com/yzhang-gh/vscode-markdown#contributing section.
Thanks again for the work.
[^1]: For example:
it seems you are not in the best mood
I'm sorry.
"Order list marker" + "Context-dependent indentation" + "Loose list" + "Container lazy continuation" + "Indented code block" + "Setext heading" => "Hell"
So, when slippery faults of formatting [^1] accumulate, a huge loose list, which is common in technical and academic writing, will decay to several flat broken ones.
"Destroy" might be a bit of an exaggeration, but reflects the outcome.
Then, we come to the presumption:
People are unlikely to examine documents carefully every time they format them. At least, they check the output much less often than when actively performing editing.
When focusing on a small portion, you can notice mistakes in adjacent lines quickly. When facing a long document, however, errors can remain for weeks.
Therefore, failures of document formatting are usually fatal and hard to trace.
The only proper way to format a Markdown document, to my knowledge, is regeneration. Now, we get back to some aged challenges:
It's difficult to produce "the smallest possible text edits" which preserve user's writing habits.
Parser?
What is the problem?
Auto-Format does not fix list numbers
How can I reproduce it?
Type in the following:
Type
Shift+⌥+F
The text stays the same.
I would like it to be converted to