fsharp / emacs-fsharp-mode

F# Emacs mode
Apache License 2.0
205 stars 62 forks source link

auto indentation bug #211

Open laynor opened 4 years ago

laynor commented 4 years ago

Description

I cannot get fsharp-mode to correctly indent nested arrays

Repro steps

Try to type something like

[
      [
             12
             13
      ]
]

Expected behavior

Would expect the TAB key to propose the correct indentation for the integer values.

Actual behavior

The cursor can only move to the beginning of line or at the first tab stop, with these results:

[
      [
      12
      13
      ]
]

Known workarounds

manually indent the first array element

Related information

laynor commented 4 years ago

commenting out some lines in fsharp-compute-indentation seems to solve this issue: At line 505:

                    (goto-char open-bracket-pos)
                    ;; (setq placeholder (point))
                    ;; (fsharp-goto-initial-line)
                    ;; (fsharp-goto-beginning-of-tqs
                    ;;  (save-excursion (nth 3 (parse-partial-sexp
                    ;;                          placeholder (point)))))
                    (+ (current-indentation) fsharp-indent-offset))))

However, I do not know if this change breaks something else.

juergenhoetzel commented 4 years ago

Thanks for report. I have to investigate this later: I'm about to port fsharp mode to lsp. I hope we can use textDocument/rangeFormatting in the near future.