From 206db25163035bed34ec1e0030566488415e2009 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= <sumneko@hotmail.com>
Date: Wed, 5 Aug 2020 14:43:04 +0800
Subject: [PATCH] Lua.completion.displayContext

---
 package.json              |  6 ++++++
 package.nls.json          |  1 +
 package.nls.zh-cn.json    |  1 +
 package/configuration.lua |  6 ++++++
 package/nls-zh-cn.lua     |  1 +
 package/nls.lua           |  1 +
 publish.lua               |  1 +
 server                    |  2 +-
 setting/schema-zh-cn.json | 26 +++++++++++++++++++-------
 setting/schema.json       | 26 +++++++++++++++++++-------
 10 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/package.json b/package.json
index fb88572..65e6ef3 100644
--- a/package.json
+++ b/package.json
@@ -48,6 +48,12 @@
                     "scope": "resource",
                     "type": "string"
                 },
+                "Lua.completion.displayContext": {
+                    "default": 6,
+                    "markdownDescription": "%config.completion.displayContext%",
+                    "scope": "resource",
+                    "type": "integer"
+                },
                 "Lua.completion.enable": {
                     "default": true,
                     "markdownDescription": "%config.completion.enable%",
diff --git a/package.nls.json b/package.nls.json
index 289c07f..ca18cd2 100644
--- a/package.nls.json
+++ b/package.nls.json
@@ -6,6 +6,7 @@
     "config.completion.callSnippet.Both": "Shows `function name` and `call snippet`.",
     "config.completion.callSnippet.Disable": "Only shows `function name`.",
     "config.completion.callSnippet.Replace": "Only shows `call snippet.`",
+    "config.completion.displayContext": "Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled.",
     "config.completion.enable": "Enable completion.",
     "config.completion.keywordSnippet": "Shows keyword syntax snippets.",
     "config.completion.keywordSnippet.Both": "Shows `keyword` and `syntax snippet`.",
diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json
index 4164d9c..25bcd80 100644
--- a/package.nls.zh-cn.json
+++ b/package.nls.zh-cn.json
@@ -6,6 +6,7 @@
     "config.completion.callSnippet.Both": "显示 `函数名` 与 `调用片段`。",
     "config.completion.callSnippet.Disable": "只显示 `函数名`。",
     "config.completion.callSnippet.Replace": "只显示 `调用片段`。",
+    "config.completion.displayContext": "预览建议的相关代码片段,可能可以帮助你了解这项建议的用法。设置的数字表示代码片段的截取行数,设置为`0`可以禁用此功能。",
     "config.completion.enable": "启用自动完成。",
     "config.completion.keywordSnippet": "显示关键字语法片段",
     "config.completion.keywordSnippet.Both": "显示 `关键字` 与 `语法片段`。",
diff --git a/package/configuration.lua b/package/configuration.lua
index dc9c553..d9b313f 100644
--- a/package/configuration.lua
+++ b/package/configuration.lua
@@ -134,6 +134,12 @@ local config = {
         },
         markdownDescription = "%config.completion.keywordSnippet%"
     },
+    ['Lua.completion.displayContext'] = {
+        scope = "resource",
+        type  = "integer",
+        default = 6,
+        markdownDescription = "%config.completion.displayContext%",
+    },
     ["Lua.color.mode"] = {
         scope = "resource",
         type = "string",
diff --git a/package/nls-zh-cn.lua b/package/nls-zh-cn.lua
index 7acf167..6a31799 100644
--- a/package/nls-zh-cn.lua
+++ b/package/nls-zh-cn.lua
@@ -26,6 +26,7 @@ return {
     ['config.completion.keywordSnippet.Disable'] = "只显示 `关键字`。",
     ['config.completion.keywordSnippet.Both']    = "显示 `关键字` 与 `语法片段`。",
     ['config.completion.keywordSnippet.Replace'] = "只显示 `语法片段`。",
+    ['config.completion.displayContext']         = "预览建议的相关代码片段,可能可以帮助你了解这项建议的用法。设置的数字表示代码片段的截取行数,设置为`0`可以禁用此功能。",
     ['config.color.mode']                        = "着色模式。",
     ['config.color.mode.Semantic']               = "语义着色(测试中。你的颜色主题必须要支持语义着色才有效。)。",
     ['config.color.mode.Grammar']                = "语法着色。",
diff --git a/package/nls.lua b/package/nls.lua
index 2968f37..7c5e835 100644
--- a/package/nls.lua
+++ b/package/nls.lua
@@ -26,6 +26,7 @@ The following example shows loaded files in `C:/lua` and `../lib` ,exclude `../l
     ['config.completion.keywordSnippet.Disable'] = "Only shows `keyword`.",
     ['config.completion.keywordSnippet.Both']    = "Shows `keyword` and `syntax snippet`.",
     ['config.completion.keywordSnippet.Replace'] = "Only shows `syntax snippet`.",
+    ['config.completion.displayContext']         = "Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled.",
     ['config.color.mode']                        = "Color mode.",
     ['config.color.mode.Semantic']               = "Semantic color (Testing. Your color theme must support semantic coloring to be effective.).",
     ['config.color.mode.Grammar']                = "Grammar color.",
diff --git a/publish.lua b/publish.lua
index a305e18..ab26c00 100644
--- a/publish.lua
+++ b/publish.lua
@@ -17,6 +17,7 @@ package.path = package.path
     .. ';' .. rootPath .. '/?.lua'
 ROOT = fs.path(rootPath)
 require 'package.build'
+dofile(rootPath .. 'setting/build.lua')
 local json = require 'json'
 
 local function loadPackage()
diff --git a/server b/server
index 3d5bd5f..977efc2 160000
--- a/server
+++ b/server
@@ -1 +1 @@
-Subproject commit 3d5bd5fc77ce07aeaddf768cbbafd710b783f5de
+Subproject commit 977efc2804c840456edeac2af95ccf68f815d88e
diff --git a/setting/schema-zh-cn.json b/setting/schema-zh-cn.json
index db6419d..8f606cb 100644
--- a/setting/schema-zh-cn.json
+++ b/setting/schema-zh-cn.json
@@ -32,6 +32,12 @@
             "scope": "resource",
             "type": "string"
         },
+        "Lua.completion.displayContext": {
+            "default": 6,
+            "markdownDescription": "预览建议的相关代码片段,可能可以帮助你了解这项建议的用法。设置的数字表示代码片段的截取行数,设置为`0`可以禁用此功能。",
+            "scope": "resource",
+            "type": "integer"
+        },
         "Lua.completion.enable": {
             "default": true,
             "markdownDescription": "启用自动完成。",
@@ -76,7 +82,7 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "禁用的诊断(使用浮框括号内的代码)。\u000a```json\u000a\"Lua.diagnostics.disable\" : [\u000a    \"unused-local\",\u000a    \"lowercase-global\"\u000a]\u000a```\u000a",
+            "markdownDescription": "禁用的诊断(使用浮框括号内的代码)。\n```json\n\"Lua.diagnostics.disable\" : [\n    \"unused-local\",\n    \"lowercase-global\"\n]\n```\n",
             "scope": "resource",
             "type": "array"
         },
@@ -90,12 +96,12 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "已定义的全局变量。\u000a```json\u000a\"Lua.diagnostics.globals\" : [\u000a    \"GLOBAL1\",\u000a    \"GLOBAL2\"\u000a]\u000a```\u000a",
+            "markdownDescription": "已定义的全局变量。\n```json\n\"Lua.diagnostics.globals\" : [\n    \"GLOBAL1\",\n    \"GLOBAL2\"\n]\n```\n",
             "scope": "resource",
             "type": "array"
         },
         "Lua.diagnostics.severity": {
-            "markdownDescription": "修改诊断等级。\u000a```json\u000a\"Lua.diagnostics.severity\" : {\u000a    \"redefined-local\" : \"Warning\",\u000a    \"emmy-lua\" : \"Hint\"\u000a}\u000a```\u000a",
+            "markdownDescription": "修改诊断等级。\n```json\n\"Lua.diagnostics.severity\" : {\n    \"redefined-local\" : \"Warning\",\n    \"emmy-lua\" : \"Hint\"\n}\n```\n",
             "properties": {
                 "ambiguity-1": {
                     "default": "Warning",
@@ -360,8 +366,8 @@
         "Lua.runtime.path": {
             "default": [
                 "?.lua",
-                "?\/init.lua",
-                "?\/?.lua"
+                "?/init.lua",
+                "?/?.lua"
             ],
             "items": {
                 "type": "string"
@@ -396,7 +402,7 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "忽略的目录(使用 `.gitignore` 语法)。\u000a```json\u000a\"Lua.workspace.ignoreDir\" : [\u000a    \"temp\/*.*\",\u000a    \"!temp\/*.lua\"\u000a]\u000a```\u000a",
+            "markdownDescription": "忽略的目录(使用 `.gitignore` 语法)。\n```json\n\"Lua.workspace.ignoreDir\" : [\n    \"temp/*.*\",\n    \"!temp/*.lua\"\n]\n```\n",
             "scope": "resource",
             "type": "array"
         },
@@ -407,7 +413,7 @@
             "type": "boolean"
         },
         "Lua.workspace.library": {
-            "markdownDescription": "加载外部函数库。\u000a该功能可以加载外部的Lua文件,用于函数定义、自动完成等功能。注意,语言服务不会监视外部文件的变化,如果修改了外部文件需要重启。\u000a下面这个例子表示加载`C:\/lua`与`..\/lib`中的所有文件,但不加载`..\/lib\/temp`中的文件。\u000a```json\u000a\"Lua.workspace.library\": {\u000a    \"C:\/lua\": true,\u000a    \"..\/lib\": [\u000a        \"temp\/*\"\u000a    ]\u000a}\u000a```\u000a",
+            "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"
         },
@@ -428,6 +434,12 @@
             "markdownDescription": "忽略 `.gitignore` 中列举的文件。",
             "scope": "resource",
             "type": "boolean"
+        },
+        "Lua.zzzzzz.cat": {
+            "default": false,
+            "markdownDescription": "DONT TOUCH ME, LET ME SLEEP >_<",
+            "scope": "resource",
+            "type": "boolean"
         }
     },
     "title": "setting",
diff --git a/setting/schema.json b/setting/schema.json
index 47c2b44..249b993 100644
--- a/setting/schema.json
+++ b/setting/schema.json
@@ -32,6 +32,12 @@
             "scope": "resource",
             "type": "string"
         },
+        "Lua.completion.displayContext": {
+            "default": 6,
+            "markdownDescription": "Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled.",
+            "scope": "resource",
+            "type": "integer"
+        },
         "Lua.completion.enable": {
             "default": true,
             "markdownDescription": "Enable completion.",
@@ -76,7 +82,7 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "Disabled diagnostic (Use code in hover brackets).\u000a```json\u000a\"Lua.diagnostics.disable\" : [\u000a    \"unused-local\",\u000a    \"lowercase-global\"\u000a]\u000a```\u000a",
+            "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",
             "type": "array"
         },
@@ -90,12 +96,12 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "Defined global variables.\u000a```json\u000a\"Lua.diagnostics.globals\" : [\u000a    \"GLOBAL1\",\u000a    \"GLOBAL2\"\u000a]\u000a```\u000a",
+            "markdownDescription": "Defined global variables.\n```json\n\"Lua.diagnostics.globals\" : [\n    \"GLOBAL1\",\n    \"GLOBAL2\"\n]\n```\n",
             "scope": "resource",
             "type": "array"
         },
         "Lua.diagnostics.severity": {
-            "markdownDescription": "Modified diagnostic severity.\u000a```json\u000a\"Lua.diagnostics.severity\" : {\u000a    \"redefined-local\" : \"Warning\",\u000a    \"emmy-lua\" : \"Hint\"\u000a}\u000a```\u000a",
+            "markdownDescription": "Modified diagnostic severity.\n```json\n\"Lua.diagnostics.severity\" : {\n    \"redefined-local\" : \"Warning\",\n    \"emmy-lua\" : \"Hint\"\n}\n```\n",
             "properties": {
                 "ambiguity-1": {
                     "default": "Warning",
@@ -360,8 +366,8 @@
         "Lua.runtime.path": {
             "default": [
                 "?.lua",
-                "?\/init.lua",
-                "?\/?.lua"
+                "?/init.lua",
+                "?/?.lua"
             ],
             "items": {
                 "type": "string"
@@ -396,7 +402,7 @@
             "items": {
                 "type": "string"
             },
-            "markdownDescription": "Ignored directories (Use `.gitignore` grammar).\u000a```json\u000a\"Lua.workspace.ignoreDir\" : [\u000a    \"temp\/*.*\",\u000a    \"!temp\/*.lua\"\u000a]\u000a```\u000a",
+            "markdownDescription": "Ignored directories (Use `.gitignore` grammar).\n```json\n\"Lua.workspace.ignoreDir\" : [\n    \"temp/*.*\",\n    \"!temp/*.lua\"\n]\n```\n",
             "scope": "resource",
             "type": "array"
         },
@@ -407,7 +413,7 @@
             "type": "boolean"
         },
         "Lua.workspace.library": {
-            "markdownDescription": "Load external library.\u000aThis 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.\u000aThe following example shows loaded files in `C:\/lua` and `..\/lib` ,exclude `..\/lib\/temp`.\u000a```json\u000a\"Lua.workspace.library\": {\u000a    \"C:\/lua\": true,\u000a    \"..\/lib\": [\u000a        \"temp\/*\"\u000a    ]\u000a}\u000a```\u000a",
+            "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",
             "type": "object"
         },
@@ -428,6 +434,12 @@
             "markdownDescription": "Ignore files list in `.gitignore` .",
             "scope": "resource",
             "type": "boolean"
+        },
+        "Lua.zzzzzz.cat": {
+            "default": false,
+            "markdownDescription": "DONT TOUCH ME, LET ME SLEEP >_<",
+            "scope": "resource",
+            "type": "boolean"
         }
     },
     "title": "setting",
-- 
GitLab