helix-editor / helix

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

format_selections mangles the surrounding text #11231

Open Armavica opened 1 month ago

Armavica commented 1 month ago

Summary

The command = (format_selections) mangles the text in some instances.

Reproduction Steps

I created a file bug.py with the following contents:

fig, axs = plt.subplots(6, 6, figsize=(12, 12), layout="constrained", sharex="col", sharey="row")
y = 0
z = 0

With one empty line at the end (otherwise it works fine).

I applied = on the first line, it made this:

fig, axs = plt.subplots(
    6, 6, figsize=(12, 12), layout="constrained", sharex="col", sharey="row"
y = 0
z = 0

Notice the missing parenthesis. Coming back to the first file, if I do instead x= on the first line, it eats the second line:

fig, axs = plt.subplots(
    6, 6, figsize=(12, 12), layout="constrained", sharex="col", sharey="row"
)
z = 0

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

Linux

Terminal Emulator

GNOME Terminal

Installation Method

source

Helix Version

helix 24.7 (079f5442)

kirawi commented 1 month ago

What formatter are you using?

Armavica commented 1 month ago

How can I check? Is this helpful?

> hx --health python
Configured language servers:
  ✓ pylsp: /usr/bin/pylsp
Configured debug adapter: None
Configured formatter: None
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓

> pylsp --version
pylsp v1.10.1