summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-05 21:02:35 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-05 21:02:35 +0800
commitc153798f29319907a257cf1480ceb4e9dad84ffe (patch)
tree1c435173bacedc28feebf9614f9f42d94c66a509
parent8fefb8f3e100976235dc83d6ae3785952d11c710 (diff)
downloadlua-language-server-c153798f29319907a257cf1480ceb4e9dad84ffe.zip
#409 config file
-rw-r--r--meta/3rd/Jass/config.lua2
-rw-r--r--meta/3rd/example/config.lua25
-rw-r--r--meta/3rd/example/library/love.lua6
-rw-r--r--meta/3rd/example/plugin.lua16
4 files changed, 48 insertions, 1 deletions
diff --git a/meta/3rd/Jass/config.lua b/meta/3rd/Jass/config.lua
index 22b71f85..741757b1 100644
--- a/meta/3rd/Jass/config.lua
+++ b/meta/3rd/Jass/config.lua
@@ -1,5 +1,5 @@
-- matched words
-match = {'jass.common'}
+words = {'jass.common'}
config = {
{
name = 'Lua.runtime.version'
diff --git a/meta/3rd/example/config.lua b/meta/3rd/example/config.lua
new file mode 100644
index 00000000..618ead1a
--- /dev/null
+++ b/meta/3rd/example/config.lua
@@ -0,0 +1,25 @@
+local keyword = require "core.keyword"
+-- list of matched words
+words = {'thisIsAnExampleWord.ifItExistsInFile.thenTryLoadThisLibrary'}
+-- list or matched file names
+files = {'thisIsAnExampleFile.ifItExistsInWorkSpace.thenTryLoadThisLibrary'}
+-- changed setting
+config = {
+ {
+ name = 'Lua.runtime.version',
+ type = 'set',
+ value = 'LuaJIT',
+ },
+ {
+ name = 'Lua.diagnostics.globals',
+ type = 'add',
+ value = 'global1',
+ }
+}
+for _, name in ipairs {'global2', 'global3', 'global4'} do
+ config[#config+1] = {
+ name = 'Lua.diagnostics.globals',
+ type = 'add',
+ value = name,
+ }
+end
diff --git a/meta/3rd/example/library/love.lua b/meta/3rd/example/library/love.lua
new file mode 100644
index 00000000..b76633a3
--- /dev/null
+++ b/meta/3rd/example/library/love.lua
@@ -0,0 +1,6 @@
+local m = {}
+
+function m.thisIsAnExampleLibrary()
+end
+
+return m
diff --git a/meta/3rd/example/plugin.lua b/meta/3rd/example/plugin.lua
new file mode 100644
index 00000000..e25d487a
--- /dev/null
+++ b/meta/3rd/example/plugin.lua
@@ -0,0 +1,16 @@
+-- if this file exists, then change setting `Lua.runtime.plugin`
+-- see https://github.com/sumneko/lua-language-server/wiki/Plugin
+
+function OnSetText(uri, text)
+ local diffs = {}
+
+ for start, finish in text:gmatch '()pairs()' do
+ diffs[#diffs+1] = {
+ start = start,
+ finish = finish - 1,
+ text = 'safepairs'
+ }
+ end
+
+ return diffs
+end