|
@@ -42,7 +42,22 @@ else
|
|
|
handlers = {
|
|
|
['$/typescriptVersion'] = function(err, result, ctx, config)
|
|
|
vim.notify(string.format('Typescript %s', result.version))
|
|
|
- end
|
|
|
+ end,
|
|
|
+
|
|
|
+ -- handler used with extract type to interface, etc which asks to rename
|
|
|
+ -- the newly created type
|
|
|
+ ['_typescript.rename'] = function(err, result, ctx)
|
|
|
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
|
|
|
+ vim.lsp.util.show_document({
|
|
|
+ uri = result.textDocument.uri,
|
|
|
+ range = {
|
|
|
+ start = result.position,
|
|
|
+ ['end'] = result.position,
|
|
|
+ }
|
|
|
+ }, client.offset_encoding)
|
|
|
+ vim.lsp.buf.rename()
|
|
|
+ return result
|
|
|
+ end,
|
|
|
},
|
|
|
flags = {
|
|
|
debounce_text_changes = 150,
|