diff options
-rw-r--r-- | server/src/method/init.lua | 1 | ||||
-rw-r--r-- | server/src/method/initialize.lua | 3 | ||||
-rw-r--r-- | server/src/method/textDocument/onTypeFormatting.lua | 14 |
3 files changed, 18 insertions, 0 deletions
diff --git a/server/src/method/init.lua b/server/src/method/init.lua index 565fdb64..7e81eb00 100644 --- a/server/src/method/init.lua +++ b/server/src/method/init.lua @@ -18,6 +18,7 @@ init 'textDocument/documentHighlight' init 'textDocument/documentSymbol' init 'textDocument/hover' init 'textDocument/implementation' +init 'textDocument/onTypeFormatting' init 'textDocument/publishDiagnostics' init 'textDocument/rename' init 'textDocument/references' diff --git a/server/src/method/initialize.lua b/server/src/method/initialize.lua index e7c48545..930ff75e 100644 --- a/server/src/method/initialize.lua +++ b/server/src/method/initialize.lua @@ -39,6 +39,9 @@ return function (lsp) changeNotifications = true, } }, + documentOnTypeFormattingProvider = { + firstTriggerCharacter = '}', + }, executeCommandProvider = { commands = { 'config', diff --git a/server/src/method/textDocument/onTypeFormatting.lua b/server/src/method/textDocument/onTypeFormatting.lua new file mode 100644 index 00000000..4943c609 --- /dev/null +++ b/server/src/method/textDocument/onTypeFormatting.lua @@ -0,0 +1,14 @@ +return function (lsp, params) + local uri = params.textDocument.uri + local vm, lines = lsp:loadVM(uri) + log.debug(table.dump(params)) + if not vm then + return nil + end + local position = lines:position(params.position.line + 1, params.position.character) + local ch = params.ch + local options = params.options + local tabSize = options.tabSize + local insertSpaces = options.insertSpaces + return nil +end |