From 42aba2df200a09bf03af1986f7d4a92046c4f85c Mon Sep 17 00:00:00 2001 From: Steven de Oliveira Date: Thu, 26 Oct 2023 17:15:42 +0200 Subject: [PATCH] sourceFormat as an enum --- package.json | 19 ++++++++++++++++++- src/lsp/superbol_free_lib/project.ml | 6 ++++-- src/vscode/vscode-json/manifest.ml | 7 +++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 108a21736..5c3b0a277 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,24 @@ "description": "The list of copybooks paths" }, "sourceFormat": { - "description": "The source format of the code" + "description": "The source format of the code", + "items": "string", + "enum": [ + "default", + "gnucobol", + "cobol85", + "cobol2002", + "cobol2014", + "acu", + "bs2000", + "gcos", + "ibm", + "mf", + "mvs", + "realia", + "rm", + "xopen" + ] }, "dialect": { "description": "The COBOL dialect used" diff --git a/src/lsp/superbol_free_lib/project.ml b/src/lsp/superbol_free_lib/project.ml index 86c3b4de8..f74a62a38 100644 --- a/src/lsp/superbol_free_lib/project.ml +++ b/src/lsp/superbol_free_lib/project.ml @@ -154,8 +154,10 @@ let contributes = Manifest.PROPERTY.array "copybooks" ~description:"The list of copybooks paths" ; - Manifest.PROPERTY.string "sourceFormat" - ~description: "The source format of the code" ; + Manifest.PROPERTY.enum "sourceFormat" + ~cases:Cobol_config.DIALECT.all_canonical_names + ~description: "The source format of the code" + ; Manifest.PROPERTY.string "dialect" ~description: "The COBOL dialect used" ; diff --git a/src/vscode/vscode-json/manifest.ml b/src/vscode/vscode-json/manifest.ml index 142d1dce3..1c88d601b 100644 --- a/src/vscode/vscode-json/manifest.ml +++ b/src/vscode/vscode-json/manifest.ml @@ -357,6 +357,13 @@ module PROPERTY = struct Some (`A (List.map (fun s -> `String s) strings))) ~items: (`String "string") + let enum ?default ~cases = + property + ~type_:(`String "string") + ~enum:cases + ?default + ~items:(`String "string") + end type configuration = {