From 462f017a2ab8408d1723283ee2dff7b34eb4af4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= <sumneko@hotmail.com>
Date: Mon, 25 May 2020 16:29:18 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=20setting=20=E7=9A=84=20sche?=
 =?UTF-8?q?ma?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .vscode/launch.json |  17 ++
 setting.json        | 394 ++++++++++++++++++++++++++++++++++++++++++++
 setting.lua         |  15 ++
 3 files changed, 426 insertions(+)
 create mode 100644 setting.json
 create mode 100644 setting.lua

diff --git a/.vscode/launch.json b/.vscode/launch.json
index 31144c9..d9d926a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -18,6 +18,23 @@
                 "stderr",
             ],
         },
+        {
+            "name": "导出配置文件",
+            "type": "lua",
+            "request": "launch",
+            "stopOnEntry": false,
+            "program": "${workspaceRoot}/setting.lua",
+            "arg": [
+            ],
+            "luaexe": "${workspaceFolder}/server/bin/Windows/lua-language-server.exe",
+            "path": "${workspaceFolder}/?.lua;${workspaceFolder}/server/script/?.lua;${workspaceFolder}/server/script/?/init.lua",
+            "consoleCoding": "utf8",
+            "sourceCoding": "utf8",
+            "outputCapture": [
+                "print",
+                "stderr",
+            ],
+        },
         {
             "type": "extensionHost",
             "request": "launch",
diff --git a/setting.json b/setting.json
new file mode 100644
index 0000000..8f3a860
--- /dev/null
+++ b/setting.json
@@ -0,0 +1,394 @@
+{
+    "$schema": "",
+    "description": "Setting of sumneko.lua",
+    "properties": {
+        "Lua.color.mode": {
+            "default": "Semantic",
+            "enum": [
+                "Grammar",
+                "Semantic"
+            ],
+            "markdownDescription": "%config.color.mode%",
+            "markdownEnumDescriptions": [
+                "%config.color.mode.Grammar%",
+                "%config.color.mode.Semantic%"
+            ],
+            "scope": "resource",
+            "type": "string"
+        },
+        "Lua.completion.callSnippet": {
+            "default": "Disable",
+            "enum": [
+                "Disable",
+                "Both",
+                "Replace"
+            ],
+            "markdownDescription": "%config.completion.callSnippet%",
+            "markdownEnumDescriptions": [
+                "%config.completion.callSnippet.Disable%",
+                "%config.completion.callSnippet.Both%",
+                "%config.completion.callSnippet.Replace%"
+            ],
+            "scope": "resource",
+            "type": "string"
+        },
+        "Lua.completion.enable": {
+            "default": true,
+            "markdownDescription": "%config.completion.enable%",
+            "scope": "resource",
+            "type": "boolean"
+        },
+        "Lua.completion.keywordSnippet": {
+            "default": "Replace",
+            "enum": [
+                "Disable",
+                "Both",
+                "Replace"
+            ],
+            "markdownDescription": "%config.completion.keywordSnippet%",
+            "markdownEnumDescriptions": [
+                "%config.completion.keywordSnippet.Disable%",
+                "%config.completion.keywordSnippet.Both%",
+                "%config.completion.keywordSnippet.Replace%"
+            ],
+            "scope": "resource",
+            "type": "string"
+        },
+        "Lua.develop.debuggerPort": {
+            "default": 11412,
+            "markdownDescription": "%config.develop.debuggerPort%",
+            "scope": "resource",
+            "type": "integer"
+        },
+        "Lua.develop.debuggerWait": {
+            "default": false,
+            "markdownDescription": "%config.develop.debuggerWait%",
+            "scope": "resource",
+            "type": "boolean"
+        },
+        "Lua.develop.enable": {
+            "default": false,
+            "markdownDescription": "%config.develop.enable%",
+            "scope": "resource",
+            "type": "boolean"
+        },
+        "Lua.diagnostics.disable": {
+            "items": {
+                "type": "string"
+            },
+            "markdownDescription": "%config.diagnostics.disable%",
+            "scope": "resource",
+            "type": "array"
+        },
+        "Lua.diagnostics.enable": {
+            "default": true,
+            "markdownDescription": "%config.diagnostics.enable%",
+            "scope": "resource",
+            "type": "boolean"
+        },
+        "Lua.diagnostics.globals": {
+            "items": {
+                "type": "string"
+            },
+            "markdownDescription": "%config.diagnostics.globals%",
+            "scope": "resource",
+            "type": "array"
+        },
+        "Lua.diagnostics.severity": {
+            "markdownDescription": "%config.diagnostics.severity%",
+            "properties": {
+                "ambiguity-1": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "duplicate-index": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "duplicate-method": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "emmy-lua": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "empty-block": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "global-in-nil-env": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "lowercase-global": {
+                    "default": "Information",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "newfield-call": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "newline-call": {
+                    "default": "Information",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "redefined-local": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "redundant-parameter": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "redundant-value": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "set-const": {
+                    "default": "Error",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "trailing-space": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "undefined-env-child": {
+                    "default": "Information",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "undefined-global": {
+                    "default": "Warning",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "unused-function": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "unused-label": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "unused-local": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                },
+                "unused-vararg": {
+                    "default": "Hint",
+                    "enum": [
+                        "Error",
+                        "Warning",
+                        "Information",
+                        "Hint"
+                    ],
+                    "scope": "resource",
+                    "type": "string"
+                }
+            },
+            "scope": "resource",
+            "title": "severity",
+            "type": "object"
+        },
+        "Lua.runtime.path": {
+            "default": [
+                "?.lua",
+                "?/init.lua",
+                "?/?.lua"
+            ],
+            "items": {
+                "type": "string"
+            },
+            "markdownDescription": "%config.runtime.path%",
+            "scope": "resource",
+            "type": "array"
+        },
+        "Lua.runtime.version": {
+            "default": "Lua 5.3",
+            "enum": [
+                "Lua 5.1",
+                "Lua 5.2",
+                "Lua 5.3",
+                "Lua 5.4",
+                "LuaJIT"
+            ],
+            "markdownDescription": "%config.runtime.version%",
+            "scope": "resource",
+            "type": "string"
+        },
+        "Lua.workspace.ignoreDir": {
+            "default": [
+                ".vscode"
+            ],
+            "items": {
+                "type": "string"
+            },
+            "markdownDescription": "%config.workspace.ignoreDir%",
+            "scope": "resource",
+            "type": "array"
+        },
+        "Lua.workspace.ignoreSubmodules": {
+            "default": true,
+            "markdownDescription": "%config.workspace.ignoreSubmodules%",
+            "scope": "resource",
+            "type": "boolean"
+        },
+        "Lua.workspace.library": {
+            "markdownDescription": "%config.workspace.library%",
+            "scope": "resource",
+            "type": "object"
+        },
+        "Lua.workspace.maxPreload": {
+            "default": 300,
+            "markdownDescription": "%config.workspace.maxPreload%",
+            "scope": "resource",
+            "type": "integer"
+        },
+        "Lua.workspace.preloadFileSize": {
+            "default": 100,
+            "markdownDescription": "%config.workspace.preloadFileSize%",
+            "scope": "resource",
+            "type": "integer"
+        },
+        "Lua.workspace.useGitIgnore": {
+            "default": true,
+            "markdownDescription": "%config.workspace.useGitIgnore%",
+            "scope": "resource",
+            "type": "boolean"
+        }
+    },
+    "title": "setting",
+    "type": "object"
+}
\ No newline at end of file
diff --git a/setting.lua b/setting.lua
new file mode 100644
index 0000000..7fd11a1
--- /dev/null
+++ b/setting.lua
@@ -0,0 +1,15 @@
+local fs = require 'bee.filesystem'
+
+require 'utility'
+local json = require 'json'
+local configuration = require 'package.configuration'
+
+local setting = {
+    ['$schema'] = '',
+    title       = 'setting',
+    description = 'Setting of sumneko.lua',
+    type        = 'object',
+    properties  = configuration,
+}
+
+io.save(fs.path'setting.json', json.encode(setting))
-- 
GitLab