Skip to content

Commit c28f8c8

Browse files
committed
fix empty object
1 parent e94d020 commit c28f8c8

File tree

5 files changed

+12
-74
lines changed

5 files changed

+12
-74
lines changed

doc/en-us/config.md

+1-17
Original file line numberDiff line numberDiff line change
@@ -2161,22 +2161,6 @@ integer
21612161
500
21622162
```
21632163

2164-
# workspace.supportScheme
2165-
2166-
Provide language server for the Lua files of the following scheme.
2167-
2168-
## type
2169-
2170-
```ts
2171-
Array<string>
2172-
```
2173-
2174-
## default
2175-
2176-
```jsonc
2177-
["file","untitled","git"]
2178-
```
2179-
21802164
# workspace.useGitIgnore
21812165

21822166
Ignore files list in `.gitignore` .
@@ -2207,4 +2191,4 @@ Array<string>
22072191

22082192
```jsonc
22092193
[]
2210-
```
2194+
```

doc/pt-br/config.md

+3-19
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ object<string, string>
698698
```jsonc
699699
{
700700
/*
701-
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
701+
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
702702
*/
703703
"ambiguity-1": "Any",
704704
/*
@@ -946,7 +946,7 @@ object<string, string>
946946
```jsonc
947947
{
948948
/*
949-
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
949+
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
950950
*/
951951
"ambiguity-1": "Warning",
952952
/*
@@ -2161,22 +2161,6 @@ integer
21612161
500
21622162
```
21632163

2164-
# workspace.supportScheme
2165-
2166-
Provide language server for the Lua files of the following scheme.
2167-
2168-
## type
2169-
2170-
```ts
2171-
Array<string>
2172-
```
2173-
2174-
## default
2175-
2176-
```jsonc
2177-
["file","untitled","git"]
2178-
```
2179-
21802164
# workspace.useGitIgnore
21812165

21822166
Ignore files list in `.gitignore` .
@@ -2207,4 +2191,4 @@ Array<string>
22072191

22082192
```jsonc
22092193
[]
2210-
```
2194+
```

doc/zh-cn/config.md

+3-19
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ object<string, string>
698698
```jsonc
699699
{
700700
/*
701-
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
701+
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
702702
*/
703703
"ambiguity-1": "Any",
704704
/*
@@ -945,7 +945,7 @@ object<string, string>
945945
```jsonc
946946
{
947947
/*
948-
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
948+
优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1`
949949
*/
950950
"ambiguity-1": "Warning",
951951
/*
@@ -2160,22 +2160,6 @@ integer
21602160
500
21612161
```
21622162

2163-
# workspace.supportScheme
2164-
2165-
为以下 scheme 的lua文件提供语言服务。
2166-
2167-
## type
2168-
2169-
```ts
2170-
Array<string>
2171-
```
2172-
2173-
## default
2174-
2175-
```jsonc
2176-
["file","untitled","git"]
2177-
```
2178-
21792163
# workspace.useGitIgnore
21802164

21812165
忽略 `.gitignore` 中列举的文件。
@@ -2206,4 +2190,4 @@ Array<string>
22062190

22072191
```jsonc
22082192
[]
2209-
```
2193+
```

doc/zh-tw/config.md

+1-17
Original file line numberDiff line numberDiff line change
@@ -2160,22 +2160,6 @@ integer
21602160
500
21612161
```
21622162

2163-
# workspace.supportScheme
2164-
2165-
為以下 `scheme` 的lua檔案提供語言伺服。
2166-
2167-
## type
2168-
2169-
```ts
2170-
Array<string>
2171-
```
2172-
2173-
## default
2174-
2175-
```jsonc
2176-
["file","untitled","git"]
2177-
```
2178-
21792163
# workspace.useGitIgnore
21802164

21812165
忽略 `.gitignore` 中列舉的檔案。
@@ -2206,4 +2190,4 @@ Array<string>
22062190

22072191
```jsonc
22082192
[]
2209-
```
2193+
```

tools/configuration.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ local function getDefault(temp)
3232
if default == nil and temp.hasDefault then
3333
default = json.null
3434
end
35-
if type(default) == 'table' and getType(temp) == 'object' then
36-
setmetatable(default, json.object)
35+
if type(default) == 'table'
36+
and not next(default)
37+
and getType(temp) == 'object' then
38+
default = json.createEmptyObject()
3739
end
3840
return default
3941
end

0 commit comments

Comments
 (0)