diff options
-rw-r--r-- | server-beta/src/proto/capability.lua | 40 | ||||
-rw-r--r-- | server-beta/src/proto/init.lua | 27 |
2 files changed, 67 insertions, 0 deletions
diff --git a/server-beta/src/proto/capability.lua b/server-beta/src/proto/capability.lua new file mode 100644 index 00000000..cc8489bd --- /dev/null +++ b/server-beta/src/proto/capability.lua @@ -0,0 +1,40 @@ +local m = {} + +m.initer = { + -- 文本同步方式 + textDocumentSync = { + -- 打开关闭文本时通知 + openClose = true, + -- 文本改变时完全通知 TODO 支持差量更新(2) + change = 1, + }, + + hoverProvider = true, + --definitionProvider = true, + --referencesProvider = true, + --renameProvider = true, + --documentSymbolProvider = true, + --documentHighlightProvider = true, + --codeActionProvider = true, + --signatureHelpProvider = { + -- triggerCharacters = { '(', ',' }, + --}, + --workspace = { + -- workspaceFolders = { + -- supported = true, + -- changeNotifications = true, + -- } + --}, + --documentOnTypeFormattingProvider = { + -- firstTriggerCharacter = '}', + --}, + --executeCommandProvider = { + -- commands = { + -- 'config', + -- 'removeSpace', + -- 'solve', + -- }, + --}, +} + +return m diff --git a/server-beta/src/proto/init.lua b/server-beta/src/proto/init.lua index 5c73dd7e..5474b1d8 100644 --- a/server-beta/src/proto/init.lua +++ b/server-beta/src/proto/init.lua @@ -1,8 +1,35 @@ local proto = require 'proto.proto' local util = require 'utility' +local cap = require 'proto.capability' proto.on('initialize', function (params) log.debug(util.dump(params)) + return { + capabilities = cap.initer, + } +end) + +proto.on('initialized', function (params) + return true +end) + +proto.on('exit', function () + log.info('Server exited.') + os.exit(true) +end) + +proto.on('shutdown', function () + log.info('Server shutdown.') + return true +end) + +proto.on('textDocument/hover', function () + return { + contents = { + value = 'Hello loli!', + kind = 'markdown', + } + } end) return proto |