Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to indent when adding new line #336

Open
rinfz opened this issue Sep 5, 2023 · 0 comments
Open

Error trying to indent when adding new line #336

rinfz opened this issue Sep 5, 2023 · 0 comments

Comments

@rinfz
Copy link

rinfz commented Sep 5, 2023

Description

I receive the following error when hitting RET after an open bracket: fsharp--compute-indentation-open-bracket: End position is smaller than start position.

Repro steps

Given the code

let f () =
    Response.ofHtml(

Press RET so we can add the closing bracket on the following line. Cursor resets to col 0 on that line and the error is added to messages buffer.

Same behaviour when trying to build nested lists within ofHtml call:

let f () =
    Response.ofHtml(
        Templates.html5 "en" [

Press RET after [ will raise the error too.

Expected behavior

Cursor moves to next line with correct indentation applied: (+ (current-indentation) fsharp-indent-offset).

Actual behavior

Cursor moved to next line and no indentation is added. An error is raised.

Known workarounds

Comment out the call to (fsharp-goto-initial-line) at the end of fsharp--compute-indentation-open-bracket.

If you include that call, it will cause the cursor to move to col 0 on the Response.ofHtml( line and the cursor position will be before the bracket position causing an error. Without it, the cursor stays on the position of the bracket and can move to the next line correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant