summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-24 14:45:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-24 14:45:29 +0800
commit68e04f690d1accf41f8a59b497bb8fb2222ecc02 (patch)
tree3fab69b1fee8b4b180bc54999f824683ba8086b2
parent221b378fa69132808a5d396b777866338cbe65a0 (diff)
downloadlua-language-server-68e04f690d1accf41f8a59b497bb8fb2222ecc02.zip
配置加点例子
-rw-r--r--package.json14
-rw-r--r--package.nls.json8
-rw-r--r--package.nls.zh-cn.json8
-rw-r--r--server/test/build_package.lua70
4 files changed, 67 insertions, 33 deletions
diff --git a/package.json b/package.json
index 9bb711ab..bd9ac8aa 100644
--- a/package.json
+++ b/package.json
@@ -17,19 +17,19 @@
"configuration": {
"properties": {
"Lua.diagnostics.disable": {
- "description": "%config.diagnostics.disable%",
"items": "string",
+ "markdownDescription": "%config.diagnostics.disable%",
"scope": "resource",
"type": "array"
},
"Lua.diagnostics.globals": {
- "description": "%config.diagnostics.globals%",
"items": "string",
+ "markdownDescription": "%config.diagnostics.globals%",
"scope": "resource",
"type": "array"
},
"Lua.diagnostics.severity": {
- "description": "%config.diagnostics.severity%",
+ "markdownDescription": "%config.diagnostics.severity%",
"properties": {
"ambiguity-1": {
"default": "Warning",
@@ -225,7 +225,6 @@
},
"Lua.runtime.version": {
"default": "Lua 5.3",
- "description": "%config.runtime.version%",
"enum": [
"Lua 5.1",
"Lua 5.2",
@@ -233,6 +232,7 @@
"Lua 5.4",
"LuaJIT"
],
+ "markdownDescription": "%config.runtime.version%",
"scope": "resource",
"type": "string"
},
@@ -244,19 +244,19 @@
},
"Lua.workspace.ignoreSubmodules": {
"default": true,
- "description": "%config.workspace.ignoreSubmodules%",
+ "markdownDescription": "%config.workspace.ignoreSubmodules%",
"scope": "resource",
"type": "boolean"
},
"Lua.workspace.maxPreload": {
"default": 300,
- "description": "%config.workspace.maxPreload%",
+ "markdownDescription": "%config.workspace.maxPreload%",
"scope": "resource",
"type": "integer"
},
"Lua.workspace.preloadFileSize": {
"default": 100,
- "description": "%config.workspace.preloadFileSize%",
+ "markdownDescription": "%config.workspace.preloadFileSize%",
"scope": "resource",
"type": "integer"
},
diff --git a/package.nls.json b/package.nls.json
index 0ff7f335..2fc65bcf 100644
--- a/package.nls.json
+++ b/package.nls.json
@@ -1,10 +1,10 @@
{
- "config.diagnostics.disable": "Disabled diagnostic (Use code in hover brackets).",
- "config.diagnostics.globals": "Defined global variables.",
- "config.diagnostics.severity": "Modified diagnostic severity.",
+ "config.diagnostics.disable": "Disabled diagnostic (Use code in hover brackets).\n```json\n\"Lua.diagnostics.disable\" : [\n \"unused-local\",\n \"lowercase-global\"\n]\n```\n",
+ "config.diagnostics.globals": "Defined global variables.\n```json\n\"Lua.diagnostics.globals\" : [\n \"GLOBAL1\",\n \"GLOBAL2\"\n]\n```\n",
+ "config.diagnostics.severity": "Modified diagnostic severity.\n```json\n\"Lua.diagnostics.severity\" : {\n \"redefined-local\" : \"Warning\",\n \"emmy-lua\" : \"Hint\"\n}\n```\n",
"config.runtime.path": "`package.path`",
"config.runtime.version": "Lua runtime version.",
- "config.workspace.ignoreDir": "Ignored directories (Use `.gitignore` grammar).",
+ "config.workspace.ignoreDir": "Ignored directories (Use `.gitignore` grammar).\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",
"config.workspace.ignoreSubmodules": "Ignore submodules.",
"config.workspace.library": "加载的外部函数库。\n下面这个例子表示加载`C:/lua`中的所有文件,以及加载`../lib`中的`.txt`与`.lua`文件,但不加载`../lib/temp`中的`.txt`文件。加载的文件最终会受文件关联的影响,因此需要设置`.txt`文件关联`lua`后`*.txt`才有意义。\n```json\n\"Lua.workspace.library\": {\n \"C:/lua\": true,\n \"../lib\": [\n \"*.txt\",\n \"*.lua\",\n \"!/temp/**/*.txt\"\n ]\n}\n```\n",
"config.workspace.maxPreload": "Max preloaded files.",
diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json
index ed23867b..9d45d90e 100644
--- a/package.nls.zh-cn.json
+++ b/package.nls.zh-cn.json
@@ -1,10 +1,10 @@
{
- "config.diagnostics.disable": "禁用的诊断(使用浮框括号内的代码)。",
- "config.diagnostics.globals": "已定义的全局变量。",
- "config.diagnostics.severity": "修改诊断等级。",
+ "config.diagnostics.disable": "禁用的诊断(使用浮框括号内的代码)。\n```json\n\"Lua.diagnostics.disable\" : [\n \"unused-local\",\n \"lowercase-global\"\n]\n```\n",
+ "config.diagnostics.globals": "已定义的全局变量。\n```json\n\"Lua.diagnostics.globals\" : [\n \"GLOBAL1\",\n \"GLOBAL2\"\n]\n```\n",
+ "config.diagnostics.severity": "修改诊断等级。\n```json\n\"Lua.diagnostics.severity\" : {\n \"redefined-local\" : \"Warning\",\n \"emmy-lua\" : \"Hint\"\n}\n```\n",
"config.runtime.path": "`package.path`",
"config.runtime.version": "Lua运行版本。",
- "config.workspace.ignoreDir": "忽略的目录(使用 `.gitignore` 语法)。",
+ "config.workspace.ignoreDir": "忽略的目录(使用 `.gitignore` 语法)。\n```json\n\"Lua.workspace.ignoreDir\" : [\n \"temp/*.*\",\n \"!temp/*.lua\"\n]\n```\n",
"config.workspace.ignoreSubmodules": "忽略子模块。",
"config.workspace.library": "加载的外部函数库。\n下面这个例子表示加载`C:/lua`中的所有文件,以及加载`../lib`中的`.txt`与`.lua`文件,但不加载`../lib/temp`中的`.txt`文件。加载的文件最终会受文件关联的影响,因此需要设置`.txt`文件关联`lua`后`*.txt`才有意义。\n```json\n\"Lua.workspace.library\": {\n \"C:/lua\": true,\n \"../lib\": [\n \"*.txt\",\n \"*.lua\",\n \"!/temp/**/*.txt\"\n ]\n}\n```\n",
"config.workspace.maxPreload": "最大预加载文件数。",
diff --git a/server/test/build_package.lua b/server/test/build_package.lua
index 2bffc77f..a91d702f 100644
--- a/server/test/build_package.lua
+++ b/server/test/build_package.lua
@@ -49,7 +49,7 @@ local package = {
"Lua 5.4",
"LuaJIT"
},
- description = "%config.runtime.version%"
+ markdownDescription = "%config.runtime.version%"
},
["Lua.runtime.path"] = {
scope = "resource",
@@ -66,18 +66,18 @@ local package = {
scope = "resource",
type = "array",
items = "string",
- description = "%config.diagnostics.disable%"
+ markdownDescription = "%config.diagnostics.disable%"
},
["Lua.diagnostics.globals"] = {
scope = "resource",
type = "array",
items = "string",
- description = "%config.diagnostics.globals%"
+ markdownDescription = "%config.diagnostics.globals%"
},
["Lua.diagnostics.severity"] = {
scope = "resource",
type = 'object',
- description = "%config.diagnostics.severity%",
+ markdownDescription = "%config.diagnostics.severity%",
title = "severity",
properties = {}
},
@@ -91,7 +91,7 @@ local package = {
scope = "resource",
type = "boolean",
default = true,
- description = "%config.workspace.ignoreSubmodules%"
+ markdownDescription = "%config.workspace.ignoreSubmodules%"
},
["Lua.workspace.useGitIgnore"] = {
scope = "resource",
@@ -103,13 +103,13 @@ local package = {
scope = "resource",
type = "integer",
default = 300,
- description = "%config.workspace.maxPreload%"
+ markdownDescription = "%config.workspace.maxPreload%"
},
["Lua.workspace.preloadFileSize"] = {
scope = "resource",
type = "integer",
default = 100,
- description = "%config.workspace.preloadFileSize%"
+ markdownDescription = "%config.workspace.preloadFileSize%"
},
--["Lua.workspace.library"] = {
-- scope = 'resource',
@@ -155,7 +155,8 @@ package.version = VERSION
io.save(ROOT:parent_path() / 'package.json', json.encode(package))
-local libraryExample = [[
+local example = {
+ library = [[
```json
"Lua.workspace.library": {
"C:/lua": true,
@@ -166,15 +167,48 @@ local libraryExample = [[
]
}
```
+]],
+ disable = [[
+```json
+"Lua.diagnostics.disable" : [
+ "unused-local",
+ "lowercase-global"
+]
+```
+]],
+ globals = [[
+```json
+"Lua.diagnostics.globals" : [
+ "GLOBAL1",
+ "GLOBAL2"
+]
+```
+]],
+ severity = [[
+```json
+"Lua.diagnostics.severity" : {
+ "redefined-local" : "Warning",
+ "emmy-lua" : "Hint"
+}
+```
+]],
+ ignoreDir = [[
+```json
+"Lua.workspace.ignoreDir" : [
+ "temp/*.*",
+ "!temp/*.lua"
+]
+```
]]
+}
io.save(ROOT:parent_path() / 'package.nls.json', json.encode {
["config.runtime.version"] = "Lua runtime version.",
["config.runtime.path"] = "`package.path`",
- ["config.diagnostics.disable"] = "Disabled diagnostic (Use code in hover brackets).",
- ["config.diagnostics.globals"] = "Defined global variables.",
- ["config.diagnostics.severity"] = "Modified diagnostic severity.",
- ["config.workspace.ignoreDir"] = "Ignored directories (Use `.gitignore` grammar).",
+ ["config.diagnostics.disable"] = "Disabled diagnostic (Use code in hover brackets).\n" .. example.disable,
+ ["config.diagnostics.globals"] = "Defined global variables.\n" .. example.globals,
+ ["config.diagnostics.severity"] = "Modified diagnostic severity.\n" .. example.severity,
+ ["config.workspace.ignoreDir"] = "Ignored directories (Use `.gitignore` grammar).\n" .. example.ignoreDir,
["config.workspace.ignoreSubmodules"] = "Ignore submodules.",
["config.workspace.useGitIgnore"] = "Ignore files list in `.gitignore` .",
["config.workspace.maxPreload"] = "Max preloaded files.",
@@ -182,16 +216,16 @@ io.save(ROOT:parent_path() / 'package.nls.json', json.encode {
["config.workspace.library"] = [[
加载的外部函数库。
下面这个例子表示加载`C:/lua`中的所有文件,以及加载`../lib`中的`.txt`与`.lua`文件,但不加载`../lib/temp`中的`.txt`文件。加载的文件最终会受文件关联的影响,因此需要设置`.txt`文件关联`lua`后`*.txt`才有意义。
-]] .. libraryExample,
+]] .. example.library,
})
io.save(ROOT:parent_path() / 'package.nls.zh-cn.json', json.encode {
["config.runtime.version"] = "Lua运行版本。",
["config.runtime.path"] = "`package.path`",
- ["config.diagnostics.disable"] = "禁用的诊断(使用浮框括号内的代码)。",
- ["config.diagnostics.globals"] = "已定义的全局变量。",
- ["config.diagnostics.severity"] = "修改诊断等级。",
- ["config.workspace.ignoreDir"] = "忽略的目录(使用 `.gitignore` 语法)。",
+ ["config.diagnostics.disable"] = "禁用的诊断(使用浮框括号内的代码)。\n" .. example.disable,
+ ["config.diagnostics.globals"] = "已定义的全局变量。\n" .. example.globals,
+ ["config.diagnostics.severity"] = "修改诊断等级。\n" .. example.severity,
+ ["config.workspace.ignoreDir"] = "忽略的目录(使用 `.gitignore` 语法)。\n" .. example.ignoreDir,
["config.workspace.ignoreSubmodules"] = "忽略子模块。",
["config.workspace.useGitIgnore"] = "忽略 `.gitignore` 中列举的文件。",
["config.workspace.maxPreload"] = "最大预加载文件数。",
@@ -199,5 +233,5 @@ io.save(ROOT:parent_path() / 'package.nls.zh-cn.json', json.encode {
["config.workspace.library"] = [[
加载的外部函数库。
下面这个例子表示加载`C:/lua`中的所有文件,以及加载`../lib`中的`.txt`与`.lua`文件,但不加载`../lib/temp`中的`.txt`文件。加载的文件最终会受文件关联的影响,因此需要设置`.txt`文件关联`lua`后`*.txt`才有意义。
-]] .. libraryExample,
+]] .. example.library,
})