From dbe1f48f95558aa5764c5ed0c87022291fb5800b Mon Sep 17 00:00:00 2001 From: rmu Date: Sun, 25 Feb 2024 04:06:25 +0400 Subject: [PATCH] ocaml: Small query improvements and fix autoclose brackets (#7769) Turns out auto-closing words was a bad idea. win**do**w, **struct**ure, **sig**n and so on They don't serve any purpose in `config.toml` nor `brackets.scm` at this point, so I removed them> Release Notes: - N/A --- crates/languages/src/ocaml-interface/brackets.scm | 3 --- crates/languages/src/ocaml-interface/config.toml | 5 +---- crates/languages/src/ocaml/brackets.scm | 5 ----- crates/languages/src/ocaml/config.toml | 8 +------- crates/languages/src/ocaml/highlights.scm | 3 ++- crates/languages/src/ocaml/indents.scm | 2 ++ 6 files changed, 6 insertions(+), 20 deletions(-) diff --git a/crates/languages/src/ocaml-interface/brackets.scm b/crates/languages/src/ocaml-interface/brackets.scm index 0929a696fd..f05821c17c 100644 --- a/crates/languages/src/ocaml-interface/brackets.scm +++ b/crates/languages/src/ocaml-interface/brackets.scm @@ -1,6 +1,3 @@ ("(" @open ")" @close) ("{" @open "}" @close) ("<" @open ">" @close) - -("sig" @open "end" @close) -("object" @open "end" @close) diff --git a/crates/languages/src/ocaml-interface/config.toml b/crates/languages/src/ocaml-interface/config.toml index fdbf1aad81..4df8074953 100644 --- a/crates/languages/src/ocaml-interface/config.toml +++ b/crates/languages/src/ocaml-interface/config.toml @@ -7,8 +7,5 @@ brackets = [ { start = "{", end = "}", close = true, newline = true }, { start = "<", end = ">", close = true, newline = true }, { start = "[", end = "]", close = true, newline = true }, - { start = "(", end = ")", close = true, newline = true }, - { start = "sig", end = " end", close = true, newline = true }, - # HACK: For some reason `object` alone does not work - { start = "object ", end = "end", close = true, newline = true }, + { start = "(", end = ")", close = true, newline = true } ] diff --git a/crates/languages/src/ocaml/brackets.scm b/crates/languages/src/ocaml/brackets.scm index 8aa7be2eaf..6afe4638fd 100644 --- a/crates/languages/src/ocaml/brackets.scm +++ b/crates/languages/src/ocaml/brackets.scm @@ -5,8 +5,3 @@ ("<" @open ">" @close) ("\"" @open "\"" @close) -("begin" @open "end" @close) -("struct" @open "end" @close) -("sig" @open "end" @close) -("object" @open "end" @close) -("do" @open "done" @close) diff --git a/crates/languages/src/ocaml/config.toml b/crates/languages/src/ocaml/config.toml index 313cbb46df..35e452ade0 100644 --- a/crates/languages/src/ocaml/config.toml +++ b/crates/languages/src/ocaml/config.toml @@ -9,11 +9,5 @@ brackets = [ { start = "[", end = "]", close = true, newline = true }, { start = "[|", end = "|", close = true, newline = true, not_in = ["string"] }, { start = "(", end = ")", close = true, newline = true }, - { start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] }, - { start = "begin", end = " end", close = true, newline = true }, - { start = "struct", end = " end", close = true, newline = true }, - { start = "sig", end = " end", close = true, newline = true }, - # HACK: For some reason `object` alone does not work - { start = "object ", end = "end", close = true, newline = true }, - { start = "do", end = " done", close = true, newline = true } + { start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] } ] diff --git a/crates/languages/src/ocaml/highlights.scm b/crates/languages/src/ocaml/highlights.scm index e5125b912e..41db5a403e 100644 --- a/crates/languages/src/ocaml/highlights.scm +++ b/crates/languages/src/ocaml/highlights.scm @@ -8,7 +8,8 @@ [(class_name) (class_type_name) (type_constructor)] @type -[(constructor_name) (tag)] @constructor +(tag) @variant ;; Polymorphic Variants +(constructor_name) @constructor ;; Exceptions, variants and the like ; Functions ;---------- diff --git a/crates/languages/src/ocaml/indents.scm b/crates/languages/src/ocaml/indents.scm index 807495dae1..10995d15ab 100644 --- a/crates/languages/src/ocaml/indents.scm +++ b/crates/languages/src/ocaml/indents.scm @@ -14,6 +14,8 @@ (field_declaration) (field_expression) + + (application_expression) ] @indent (_ "[" "]" @end) @indent