diff options
Diffstat (limited to 'script-beta/provider')
-rw-r--r-- | script-beta/provider/client.lua | 16 | ||||
-rw-r--r-- | script-beta/provider/markdown.lua | 2 | ||||
-rw-r--r-- | script-beta/provider/provider.lua | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/script-beta/provider/client.lua b/script-beta/provider/client.lua new file mode 100644 index 00000000..a2671597 --- /dev/null +++ b/script-beta/provider/client.lua @@ -0,0 +1,16 @@ +local nonil = require 'without-check-nil' + +local m = {} + +function m.client() + nonil.enable() + local name = m.info.clientInfo.name + nonil.disable() + return name +end + +function m.init(t) + m.info = t +end + +return m diff --git a/script-beta/provider/markdown.lua b/script-beta/provider/markdown.lua index 874b3abd..7bd34444 100644 --- a/script-beta/provider/markdown.lua +++ b/script-beta/provider/markdown.lua @@ -9,7 +9,7 @@ function mt:add(language, text) if language == 'lua' then self[#self+1] = ('```lua\n%s\n```'):format(text) else - self[#self+1] = text + self[#self+1] = text .. '\n' end end diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua index 1f49f641..fc8b8001 100644 --- a/script-beta/provider/provider.lua +++ b/script-beta/provider/provider.lua @@ -9,6 +9,7 @@ local workspace = require 'workspace' local config = require 'config' local library = require 'library' local markdown = require 'provider.markdown' +local client = require 'provider.client' local function updateConfig() local configs = proto.awaitRequest('workspace/configuration', { @@ -77,6 +78,7 @@ end) proto.on('initialized', function (params) updateConfig() + client.init(params) proto.awaitRequest('client/registerCapability', { registrations = { -- 监视文件变化 |