diff options
Diffstat (limited to 'server-beta/src/provider/init.lua')
-rw-r--r-- | server-beta/src/provider/init.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/server-beta/src/provider/init.lua b/server-beta/src/provider/init.lua index 1dc092c7..41a1aed5 100644 --- a/server-beta/src/provider/init.lua +++ b/server-beta/src/provider/init.lua @@ -239,7 +239,7 @@ proto.on('textDocument/rename', function (params) local lines = files.getLines(uri) local text = files.getText(uri) local offset = define.offset(lines, text, params.position) - local result = core(uri, offset, params.newName) + local result = core.rename(uri, offset, params.newName) if not result then return nil end @@ -259,6 +259,25 @@ proto.on('textDocument/rename', function (params) return workspaceEdit end) +proto.on('textDocument/prepareRename', function (params) + local core = require 'core.rename' + local uri = params.textDocument.uri + if not files.exists(uri) then + return nil + end + local lines = files.getLines(uri) + local text = files.getText(uri) + local offset = define.offset(lines, text, params.position) + local result = core.prepareRename(uri, offset) + if not result then + return nil + end + return { + range = define.range(lines, text, result.start, result.finish), + placeholder = result.text, + } +end) + proto.on('textDocument/completion', function (params) --log.info(util.dump(params)) return nil |