emacs-fsharp-mode icon indicating copy to clipboard operation
emacs-fsharp-mode copied to clipboard

auto indentation bug

Open laynor opened this issue 6 years ago • 2 comments

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

  • Operating system Arch linux
  • Branch Installed from melpa
  • Emacs version 27.0.50
  • .NET Runtime, CoreCLR or Mono Version netcore 3.0.0 preview

laynor avatar Jul 20 '19 15:07 laynor

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.

laynor avatar Jul 23 '19 21:07 laynor

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.

juergenhoetzel avatar Jul 25 '19 21:07 juergenhoetzel