Skip to content

Commit 343f31c

Browse files
committed
runtime.special的配置
1 parent 5f2daa4 commit 343f31c

File tree

9 files changed

+105
-0
lines changed

9 files changed

+105
-0
lines changed

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,29 @@
398398
"scope": "resource",
399399
"type": "array"
400400
},
401+
"Lua.runtime.special": {
402+
"markdownDescription": "%config.runtime.special%",
403+
"patternProperties": {
404+
"": {
405+
"default": "require",
406+
"enum": [
407+
"_G",
408+
"rawset",
409+
"rawget",
410+
"setmetatable",
411+
"require",
412+
"dofile",
413+
"loadfile",
414+
"pcall",
415+
"xpcall"
416+
],
417+
"scope": "resource",
418+
"type": "string"
419+
}
420+
},
421+
"scope": "resource",
422+
"type": "object"
423+
},
401424
"Lua.runtime.version": {
402425
"default": "Lua 5.4",
403426
"enum": [

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"config.hover.viewString": "Hover to view the contents of a string (only if the literal contains an escape character).",
2626
"config.hover.viewStringMax": "The maximum length of a hover to view the contents of a string.",
2727
"config.runtime.path": "`package.path`",
28+
"config.runtime.special": "The custom global variables are regarded as some special built-in variables, and the language server will provide special support",
2829
"config.runtime.version": "Lua runtime version.",
2930
"config.signatureHelp.enable": "Enable signature help.",
3031
"config.workspace.ignoreDir": "Ignored directories (Use `.gitignore` grammar).\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",

package.nls.zh-cn.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"config.hover.viewString": "悬停提示查看字符串内容(仅当字面量包含转义符时)。",
2626
"config.hover.viewStringMax": "悬停提示查看字符串内容时的最大长度。",
2727
"config.runtime.path": "`package.path`",
28+
"config.runtime.special": "将自定义全局变量视为一些特殊的内置变量,语言服务将提供特殊的支持。\n下面这个例子表示将 `include` 视为 `require` 。\n```json\n\"Lua.runtime.special\" : {\n \"include\" : \"require\"\n}\n```\n",
2829
"config.runtime.version": "Lua运行版本。",
2930
"config.signatureHelp.enable": "启用参数提示。",
3031
"config.workspace.ignoreDir": "忽略的目录(使用 `.gitignore` 语法)。\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",

package/configuration.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,29 @@ local config = {
2727
"?/?.lua"
2828
}
2929
},
30+
["Lua.runtime.special"] = {
31+
scope = 'resource',
32+
type = 'object',
33+
markdownDescription = '%config.runtime.special%',
34+
patternProperties= {
35+
[''] = {
36+
type = "string",
37+
scope = "resource",
38+
default = "require",
39+
enum = {
40+
'_G',
41+
'rawset',
42+
'rawget',
43+
'setmetatable',
44+
'require',
45+
'dofile',
46+
'loadfile',
47+
'pcall',
48+
'xpcall',
49+
}
50+
}
51+
}
52+
},
3053
["Lua.diagnostics.enable"] = {
3154
scope = 'resource',
3255
type = 'boolean',

package/nls-example.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@ return {
4040
"!temp/*.lua"
4141
]
4242
```
43+
]],
44+
special = [[
45+
```json
46+
"Lua.runtime.special" : {
47+
"include" : "require"
48+
}
49+
```
4350
]]
4451
}

package/nls-zh-cn.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ return {
44
['config.awakened.cat'] = 'PLAY WITH ME >_<\n\n(这会启用还处于开发中的beta版,欢迎测试反馈!改变此选项需要重载窗口!)',
55
["config.runtime.version"] = "Lua运行版本。",
66
["config.runtime.path"] = "`package.path`",
7+
["config.runtime.special"] = [[将自定义全局变量视为一些特殊的内置变量,语言服务将提供特殊的支持。
8+
下面这个例子表示将 `include` 视为 `require` 。
9+
]] .. example.special,
710
["config.diagnostics.enable"] = "启用诊断。",
811
["config.diagnostics.disable"] = "禁用的诊断(使用浮框括号内的代码)。\n" .. example.disable,
912
["config.diagnostics.globals"] = "已定义的全局变量。\n" .. example.globals,

package/nls.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ return {
44
['config.awakened.cat'] = 'PLAY WITH ME >_<\n\n(This will enable the beta version which is still in development. Feedback is welcome! Reload the window after changing this option!)',
55
["config.runtime.version"] = "Lua runtime version.",
66
["config.runtime.path"] = "`package.path`",
7+
["config.runtime.special"] = "The custom global variables are regarded as some special built-in variables, and the language server will provide special support",
78
["config.diagnostics.enable"] = "Enable diagnostics.",
89
["config.diagnostics.disable"] = "Disabled diagnostic (Use code in hover brackets).\n" .. example.disable,
910
["config.diagnostics.globals"] = "Defined global variables.\n" .. example.globals,

setting/schema-zh-cn.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,29 @@
382382
"scope": "resource",
383383
"type": "array"
384384
},
385+
"Lua.runtime.special": {
386+
"markdownDescription": "将自定义全局变量视为一些特殊的内置变量,语言服务将提供特殊的支持。\n下面这个例子表示将 `include` 视为 `require` 。\n```json\n\"Lua.runtime.special\" : {\n \"include\" : \"require\"\n}\n```\n",
387+
"patternProperties": {
388+
"": {
389+
"default": "require",
390+
"enum": [
391+
"_G",
392+
"rawset",
393+
"rawget",
394+
"setmetatable",
395+
"require",
396+
"dofile",
397+
"loadfile",
398+
"pcall",
399+
"xpcall"
400+
],
401+
"scope": "resource",
402+
"type": "string"
403+
}
404+
},
405+
"scope": "resource",
406+
"type": "object"
407+
},
385408
"Lua.runtime.version": {
386409
"default": "Lua 5.4",
387410
"enum": [

setting/schema.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,29 @@
382382
"scope": "resource",
383383
"type": "array"
384384
},
385+
"Lua.runtime.special": {
386+
"markdownDescription": "The custom global variables are regarded as some special built-in variables, and the language server will provide special support",
387+
"patternProperties": {
388+
"": {
389+
"default": "require",
390+
"enum": [
391+
"_G",
392+
"rawset",
393+
"rawget",
394+
"setmetatable",
395+
"require",
396+
"dofile",
397+
"loadfile",
398+
"pcall",
399+
"xpcall"
400+
],
401+
"scope": "resource",
402+
"type": "string"
403+
}
404+
},
405+
"scope": "resource",
406+
"type": "object"
407+
},
385408
"Lua.runtime.version": {
386409
"default": "Lua 5.4",
387410
"enum": [

0 commit comments

Comments
 (0)