You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On windows, using Windows Terminal (new), in golang after closing curly brace open_below and/or open_above lost identation and start insert mode from first char of the line. But if before closing bracket is empty line, all works fine. Helix log doesnt represent much
pascalkuthe
changed the title
Open_below/above ignoring indetadion
Hybrid indentation can cause incorrect results at the end of indent scopes
Apr 11, 2024
Thanks for the clean reproduction case @pascalkuthe! The issue was caused by the code that decides whether a tree-sitter node is the first in a line: Previously, we checked this by looking at the syntax tree but that can go wrong if the tree-sitter grammar creates nodes that end with whitespace. The Go grammar inserts "newline" nodes for some reason, which causes Helix to treat the newline node as the beginning of the line & not the node afterwards (} in this case). The linked PR fixes this & also simplifies the code a bit.
In theory, this issue could also occur with the tree-sitter indent heuristic, but the necessary circumstances are a lot less likely (due to the way most indent queries are currently structured).
Summary
On windows, using Windows Terminal (new), in golang after closing curly brace open_below and/or open_above lost identation and start insert mode from first char of the line. But if before closing bracket is empty line, all works fine. Helix log doesnt represent much
Reproduction Steps
I tried this:
----some := 50
----if some > 34 {
--------fmt.Println("herhe")
----} <- cursor
open_below
I expected this to happen:
----some := 50
----if some > 34 {
--------fmt.Println("herhe")
----}
----<- cursor
Instead, this happened:
----some := 50
----if some > 34 {
--------fmt.Println("herhe")
----}
<- cursor
I tried this:
----some := 50
----if some > 34 {
--------fmt.Println("herhe")
----} <- cursor
open_below
As usually:
----some := 50
----if some > 34 {
--------fmt.Println("herhe")
----}
----<- cursor
Helix log
~/.cache/helix/helix.log
2024-04-10T19:44:20.771 helix_lsp::transport [ERROR] gopls err: <- StreamClosed
Platform
Windows
Terminal Emulator
wt 1.19.240322001
Installation Method
releases page
Helix Version
helix 24.3 (2cadec0)
The text was updated successfully, but these errors were encountered: