diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-02-15 15:51:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-02-15 15:51:57 +0800 |
commit | c28f8c8635105010e54033b2f47065c291590264 (patch) | |
tree | e48d5feb914cb8d8c6b79085bffe83f3503b8424 | |
parent | e94d02039797fd71a0af1c8d857888ba1a7b7c14 (diff) | |
download | lua-language-server-c28f8c8635105010e54033b2f47065c291590264.zip |
fix empty object
-rw-r--r-- | doc/en-us/config.md | 18 | ||||
-rw-r--r-- | doc/pt-br/config.md | 22 | ||||
-rw-r--r-- | doc/zh-cn/config.md | 22 | ||||
-rw-r--r-- | doc/zh-tw/config.md | 18 | ||||
-rw-r--r-- | tools/configuration.lua | 6 |
5 files changed, 12 insertions, 74 deletions
diff --git a/doc/en-us/config.md b/doc/en-us/config.md index dab1a456..2d519824 100644 --- a/doc/en-us/config.md +++ b/doc/en-us/config.md @@ -2161,22 +2161,6 @@ integer 500 ``` -# workspace.supportScheme - -Provide language server for the Lua files of the following scheme. - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore Ignore files list in `.gitignore` . @@ -2207,4 +2191,4 @@ Array<string> ```jsonc [] -``` +```
\ No newline at end of file diff --git a/doc/pt-br/config.md b/doc/pt-br/config.md index 4682fa0d..24cf8d3b 100644 --- a/doc/pt-br/config.md +++ b/doc/pt-br/config.md @@ -698,7 +698,7 @@ object<string, string> ```jsonc { /* - 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` + 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Any", /* @@ -946,7 +946,7 @@ object<string, string> ```jsonc { /* - 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` + 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Warning", /* @@ -2161,22 +2161,6 @@ integer 500 ``` -# workspace.supportScheme - -Provide language server for the Lua files of the following scheme. - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore Ignore files list in `.gitignore` . @@ -2207,4 +2191,4 @@ Array<string> ```jsonc [] -``` +```
\ No newline at end of file diff --git a/doc/zh-cn/config.md b/doc/zh-cn/config.md index 6bf64e3e..991932b6 100644 --- a/doc/zh-cn/config.md +++ b/doc/zh-cn/config.md @@ -698,7 +698,7 @@ object<string, string> ```jsonc { /* - 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` + 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Any", /* @@ -945,7 +945,7 @@ object<string, string> ```jsonc { /* - 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` + 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Warning", /* @@ -2160,22 +2160,6 @@ integer 500 ``` -# workspace.supportScheme - -为以下 scheme 的lua文件提供语言服务。 - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore 忽略 `.gitignore` 中列举的文件。 @@ -2206,4 +2190,4 @@ Array<string> ```jsonc [] -``` +```
\ No newline at end of file diff --git a/doc/zh-tw/config.md b/doc/zh-tw/config.md index 8084374b..83cef315 100644 --- a/doc/zh-tw/config.md +++ b/doc/zh-tw/config.md @@ -2160,22 +2160,6 @@ integer 500 ``` -# workspace.supportScheme - -為以下 `scheme` 的lua檔案提供語言伺服。 - -## type - -```ts -Array<string> -``` - -## default - -```jsonc -["file","untitled","git"] -``` - # workspace.useGitIgnore 忽略 `.gitignore` 中列舉的檔案。 @@ -2206,4 +2190,4 @@ Array<string> ```jsonc [] -``` +```
\ No newline at end of file diff --git a/tools/configuration.lua b/tools/configuration.lua index b152927f..10bf6e08 100644 --- a/tools/configuration.lua +++ b/tools/configuration.lua @@ -32,8 +32,10 @@ local function getDefault(temp) if default == nil and temp.hasDefault then default = json.null end - if type(default) == 'table' and getType(temp) == 'object' then - setmetatable(default, json.object) + if type(default) == 'table' + and not next(default) + and getType(temp) == 'object' then + default = json.createEmptyObject() end return default end |