Skip to content

Commit d42ce16

Browse files
committed
Add bracket indentation semantics to (* *)
Background: ionide/ionide-fsgrammar#209 and ionide/ionide-fsgrammar#210 This comes from a comment regarding a pull request that I made on the ionide-fsgrammar repository, which removes the `(* *)` bracket pair from the "brackets" field of language-configuration.json. One issue with doing this is that we lose the bracket-like indentation that VSCode provides by default for all bracket pairs. Since I'd like to remove the block comment brackets from the `language-configuration.json` file, this pull request re-adds the same semantics to the indentation rules. In other words, when I hit Enter in the following configuration, cursor location represented by the white block: (*█*) It should indent the cursor and then put the `*)` on the next line with the same indentation level as the `(*` as follows: (* █ *) --- When I hit Enter with an unaccompanied `(*`: (*█ It should simply indent as follows: (* █ --- Lastly, an unaccompanied `*)` should outdent. That is, *)█ should become *)█
1 parent b0d2ebe commit d42ce16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Components/LanguageConfiguration.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ module LanguageConfiguration =
1212
jsOptions<IndentationRule> (fun o ->
1313
o.increaseIndentPattern <-
1414
Regex(
15-
"""^(\s*(module|type|let|static member|member)\b.*=\s*)$|^(\s*(with get|and set)\b.*=.*)$|^(\s*(if|elif|then|else|static member|member)).*$"""
15+
"""^(\s*(module|type|let|static member|member)\b.*=\s*)$|^(\s*(with get|and set)\b.*=.*)$|^(\s*(if|elif|then|else|static member|member|\(\*)).*$"""
1616
)
1717

18-
o.decreaseIndentPattern <- Regex("""^(\s*(else|elif|and)).*$"""))
18+
o.decreaseIndentPattern <- Regex("""^(\s*(else|elif|and|\*\))).*$"""))
1919

2020
let setLanguageConfiguration (triggerNotification: bool) =
2121
// Config always setted

0 commit comments

Comments
 (0)