Skip to content
Snippets Groups Projects
Commit b106a0e2 authored by 最萌小汐's avatar 最萌小汐
Browse files

更新 schema

parent 3cecaa0d
No related branches found
No related tags found
No related merge requests found
...@@ -4,12 +4,32 @@ require 'utility' ...@@ -4,12 +4,32 @@ require 'utility'
local json = require 'json' local json = require 'json'
local configuration = require 'package.configuration' local configuration = require 'package.configuration'
local function copyWithNLS(t, callback)
local nt = {}
for k, v in pairs(t) do
if type(v) == 'string' then
nt[k] = callback(v) or v
elseif type(v) == 'table' then
nt[k] = copyWithNLS(v, callback)
else
nt[k] = v
end
end
return nt
end
for _, lang in ipairs {'', '-zh-cn'} do
local nls = require('package.nls' .. lang)
local setting = { local setting = {
['$schema'] = '', ['$schema'] = '',
title = 'setting', title = 'setting',
description = 'Setting of sumneko.lua', description = 'Setting of sumneko.lua',
type = 'object', type = 'object',
properties = configuration, properties = copyWithNLS(configuration, function (str)
return str:gsub('^%%(.+)%%$', nls)
end),
} }
io.save(fs.path'setting/schema.json', json.encode(setting)) io.save(fs.path'setting/schema'..lang..'.json', json.encode(setting))
end
{
"$schema": "",
"description": "Setting of sumneko.lua",
"properties": {
"Lua.color.mode": {
"default": "Semantic",
"enum": [
"Grammar",
"Semantic"
],
"markdownDescription": "着色模式。",
"markdownEnumDescriptions": [
"语法着色。",
"语义着色(测试中。你的颜色主题必须要支持语义着色才有效。)。"
],
"scope": "resource",
"type": "string"
},
"Lua.completion.callSnippet": {
"default": "Disable",
"enum": [
"Disable",
"Both",
"Replace"
],
"markdownDescription": "显示函数调用片段。",
"markdownEnumDescriptions": [
"只显示 `函数名`。",
"显示 `函数名` 与 `调用片段`。",
"只显示 `调用片段`。"
],
"scope": "resource",
"type": "string"
},
"Lua.completion.enable": {
"default": true,
"markdownDescription": "启用自动完成。",
"scope": "resource",
"type": "boolean"
},
"Lua.completion.keywordSnippet": {
"default": "Replace",
"enum": [
"Disable",
"Both",
"Replace"
],
"markdownDescription": "显示关键字语法片段",
"markdownEnumDescriptions": [
"只显示 `关键字`。",
"显示 `关键字` 与 `语法片段`。",
"只显示 `语法片段`。"
],
"scope": "resource",
"type": "string"
},
"Lua.develop.debuggerPort": {
"default": 11412,
"markdownDescription": "调试器监听端口。",
"scope": "resource",
"type": "integer"
},
"Lua.develop.debuggerWait": {
"default": false,
"markdownDescription": "调试器连接之前挂起。",
"scope": "resource",
"type": "boolean"
},
"Lua.develop.enable": {
"default": false,
"markdownDescription": "开发者模式。请勿开启,会影响性能。",
"scope": "resource",
"type": "boolean"
},
"Lua.diagnostics.disable": {
"items": {
"type": "string"
},
"markdownDescription": "禁用的诊断(使用浮框括号内的代码)。\n```json\n\"Lua.diagnostics.disable\" : [\n \"unused-local\",\n \"lowercase-global\"\n]\n```\n",
"scope": "resource",
"type": "array"
},
"Lua.diagnostics.enable": {
"default": true,
"markdownDescription": "启用诊断。",
"scope": "resource",
"type": "boolean"
},
"Lua.diagnostics.globals": {
"items": {
"type": "string"
},
"markdownDescription": "已定义的全局变量。\n```json\n\"Lua.diagnostics.globals\" : [\n \"GLOBAL1\",\n \"GLOBAL2\"\n]\n```\n",
"scope": "resource",
"type": "array"
},
"Lua.diagnostics.severity": {
"markdownDescription": "修改诊断等级。\n```json\n\"Lua.diagnostics.severity\" : {\n \"redefined-local\" : \"Warning\",\n \"emmy-lua\" : \"Hint\"\n}\n```\n",
"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": "`package.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": "Lua运行版本。",
"scope": "resource",
"type": "string"
},
"Lua.workspace.ignoreDir": {
"default": [
".vscode"
],
"items": {
"type": "string"
},
"markdownDescription": "忽略的目录(使用 `.gitignore` 语法)。\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",
"scope": "resource",
"type": "array"
},
"Lua.workspace.ignoreSubmodules": {
"default": true,
"markdownDescription": "忽略子模块。",
"scope": "resource",
"type": "boolean"
},
"Lua.workspace.library": {
"markdownDescription": "加载外部函数库。\n该功能可以加载外部的Lua文件,用于函数定义、自动完成等功能。注意,语言服务不会监视外部文件的变化,如果修改了外部文件需要重启。\n下面这个例子表示加载`C:/lua`与`../lib`中的所有文件,但不加载`../lib/temp`中的文件。\n```json\n\"Lua.workspace.library\": {\n \"C:/lua\": true,\n \"../lib\": [\n \"temp/*\"\n ]\n}\n```\n",
"scope": "resource",
"type": "object"
},
"Lua.workspace.maxPreload": {
"default": 300,
"markdownDescription": "最大预加载文件数。",
"scope": "resource",
"type": "integer"
},
"Lua.workspace.preloadFileSize": {
"default": 100,
"markdownDescription": "预加载时跳过大小大于该值(KB)的文件。",
"scope": "resource",
"type": "integer"
},
"Lua.workspace.useGitIgnore": {
"default": true,
"markdownDescription": "忽略 `.gitignore` 中列举的文件。",
"scope": "resource",
"type": "boolean"
}
},
"title": "setting",
"type": "object"
}
\ No newline at end of file
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
"Grammar", "Grammar",
"Semantic" "Semantic"
], ],
"markdownDescription": "%config.color.mode%", "markdownDescription": "Color mode.",
"markdownEnumDescriptions": [ "markdownEnumDescriptions": [
"%config.color.mode.Grammar%", "Grammar color.",
"%config.color.mode.Semantic%" "Semantic color (Testing. Your color theme must support semantic coloring to be effective.)."
], ],
"scope": "resource", "scope": "resource",
"type": "string" "type": "string"
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
"Both", "Both",
"Replace" "Replace"
], ],
"markdownDescription": "%config.completion.callSnippet%", "markdownDescription": "Shows function call snippets.",
"markdownEnumDescriptions": [ "markdownEnumDescriptions": [
"%config.completion.callSnippet.Disable%", "Only shows `function name`.",
"%config.completion.callSnippet.Both%", "Shows `function name` and `call snippet`.",
"%config.completion.callSnippet.Replace%" "Only shows `call snippet.`"
], ],
"scope": "resource", "scope": "resource",
"type": "string" "type": "string"
}, },
"Lua.completion.enable": { "Lua.completion.enable": {
"default": true, "default": true,
"markdownDescription": "%config.completion.enable%", "markdownDescription": "Enable completion.",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
}, },
...@@ -45,30 +45,30 @@ ...@@ -45,30 +45,30 @@
"Both", "Both",
"Replace" "Replace"
], ],
"markdownDescription": "%config.completion.keywordSnippet%", "markdownDescription": "Shows keyword syntax snippets.",
"markdownEnumDescriptions": [ "markdownEnumDescriptions": [
"%config.completion.keywordSnippet.Disable%", "Only shows `keyword`.",
"%config.completion.keywordSnippet.Both%", "Shows `keyword` and `syntax snippet`.",
"%config.completion.keywordSnippet.Replace%" "Only shows `syntax snippet`."
], ],
"scope": "resource", "scope": "resource",
"type": "string" "type": "string"
}, },
"Lua.develop.debuggerPort": { "Lua.develop.debuggerPort": {
"default": 11412, "default": 11412,
"markdownDescription": "%config.develop.debuggerPort%", "markdownDescription": "Listen port of debugger.",
"scope": "resource", "scope": "resource",
"type": "integer" "type": "integer"
}, },
"Lua.develop.debuggerWait": { "Lua.develop.debuggerWait": {
"default": false, "default": false,
"markdownDescription": "%config.develop.debuggerWait%", "markdownDescription": "Suspend before debugger connects.",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
}, },
"Lua.develop.enable": { "Lua.develop.enable": {
"default": false, "default": false,
"markdownDescription": "%config.develop.enable%", "markdownDescription": "Developer mode. Do not enable, performance will be affected.",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
}, },
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"markdownDescription": "%config.diagnostics.disable%", "markdownDescription": "Disabled diagnostic (Use code in hover brackets).\n```json\n\"Lua.diagnostics.disable\" : [\n \"unused-local\",\n \"lowercase-global\"\n]\n```\n",
"scope": "resource", "scope": "resource",
"type": "array" "type": "array"
}, },
"Lua.diagnostics.enable": { "Lua.diagnostics.enable": {
"default": true, "default": true,
"markdownDescription": "%config.diagnostics.enable%", "markdownDescription": "Enable diagnostics.",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
}, },
...@@ -90,12 +90,12 @@ ...@@ -90,12 +90,12 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"markdownDescription": "%config.diagnostics.globals%", "markdownDescription": "Defined global variables.\n```json\n\"Lua.diagnostics.globals\" : [\n \"GLOBAL1\",\n \"GLOBAL2\"\n]\n```\n",
"scope": "resource", "scope": "resource",
"type": "array" "type": "array"
}, },
"Lua.diagnostics.severity": { "Lua.diagnostics.severity": {
"markdownDescription": "%config.diagnostics.severity%", "markdownDescription": "Modified diagnostic severity.\n```json\n\"Lua.diagnostics.severity\" : {\n \"redefined-local\" : \"Warning\",\n \"emmy-lua\" : \"Hint\"\n}\n```\n",
"properties": { "properties": {
"ambiguity-1": { "ambiguity-1": {
"default": "Warning", "default": "Warning",
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"markdownDescription": "%config.runtime.path%", "markdownDescription": "`package.path`",
"scope": "resource", "scope": "resource",
"type": "array" "type": "array"
}, },
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
"Lua 5.4", "Lua 5.4",
"LuaJIT" "LuaJIT"
], ],
"markdownDescription": "%config.runtime.version%", "markdownDescription": "Lua runtime version.",
"scope": "resource", "scope": "resource",
"type": "string" "type": "string"
}, },
...@@ -355,36 +355,36 @@ ...@@ -355,36 +355,36 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"markdownDescription": "%config.workspace.ignoreDir%", "markdownDescription": "Ignored directories (Use `.gitignore` grammar).\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",
"scope": "resource", "scope": "resource",
"type": "array" "type": "array"
}, },
"Lua.workspace.ignoreSubmodules": { "Lua.workspace.ignoreSubmodules": {
"default": true, "default": true,
"markdownDescription": "%config.workspace.ignoreSubmodules%", "markdownDescription": "Ignore submodules.",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
}, },
"Lua.workspace.library": { "Lua.workspace.library": {
"markdownDescription": "%config.workspace.library%", "markdownDescription": "Load external library.\nThis feature can load external Lua files, which can be used for definition, automatic completion and other functions. Note that the language server does not monitor changes in external files and needs to restart if the external files are modified.\nThe following example shows loaded files in `C:/lua` and `../lib` ,exclude `../lib/temp`.\n```json\n\"Lua.workspace.library\": {\n \"C:/lua\": true,\n \"../lib\": [\n \"temp/*\"\n ]\n}\n```\n",
"scope": "resource", "scope": "resource",
"type": "object" "type": "object"
}, },
"Lua.workspace.maxPreload": { "Lua.workspace.maxPreload": {
"default": 300, "default": 300,
"markdownDescription": "%config.workspace.maxPreload%", "markdownDescription": "Max preloaded files.",
"scope": "resource", "scope": "resource",
"type": "integer" "type": "integer"
}, },
"Lua.workspace.preloadFileSize": { "Lua.workspace.preloadFileSize": {
"default": 100, "default": 100,
"markdownDescription": "%config.workspace.preloadFileSize%", "markdownDescription": "Skip files larger than this value (KB) when preloading.",
"scope": "resource", "scope": "resource",
"type": "integer" "type": "integer"
}, },
"Lua.workspace.useGitIgnore": { "Lua.workspace.useGitIgnore": {
"default": true, "default": true,
"markdownDescription": "%config.workspace.useGitIgnore%", "markdownDescription": "Ignore files list in `.gitignore` .",
"scope": "resource", "scope": "resource",
"type": "boolean" "type": "boolean"
} }
......
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment