Guide on migrating a VSCode extension to CoC? #4894
-
Sorry, Google is useless these days and I couldn't find anything in this discussion section as well. Are there docs that teach how to migrate a full fledged VSCode extension to CoC? I've read https://medium.com/@chemzqm/create-coc-nvim-extension-to-improve-vim-experience-4461df269173 and https://samroeca.com/coc-plugin.html, but it's pretty essential and not going into the depths of actively converting a massive VSCode extension. How to approach this for someone who hasn't built any VSCode extensions as well? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think this might depend on the type of extension. For LSP services, I believe that in most cases, simply replacing the API calls from VSCode with the ones from coc.nvim can make the LSP extension work. This is because at the LSP level, many of coc.nvim's APIs are implemented similarly to those of VSCode. For example, the implementation of However, for other types of extensions, you might need to understand more about coc.nvim's support for certain editor features. This may require you to read the source code of coc.nvim or other coc extensions. For example, I have previously implemented https://github.com/hexh250786313/coc-todo-tree, which is an extension that processes TODO tag categorization. The code for this came from VSCode's https://github.com/Gruntfuggly/todo-tree. However, to correctly display it in Vim/Neovim, it's necessary to understand how coc.nvim's treeview feature is implemented. I was able to complete it by reading the source code of coc.nvim's outline feature. I haven't come across any documentation on migrating VSCode extensions to coc.nvim. Everything I know started from https://github.com/fannheyward/create-coc-extension. I hope it can help you :) |
Beta Was this translation helpful? Give feedback.
I think this might depend on the type of extension.
For LSP services, I believe that in most cases, simply replacing the API calls from VSCode with the ones from coc.nvim can make the LSP extension work. This is because at the LSP level, many of coc.nvim's APIs are implemented similarly to those of VSCode. For example, the implementation of
commands
in coc-angular: https://github.com/iamcco/coc-angular/blob/2c39ac6c5c2474cf68b7ae13aa9b5e8fbe04f0e0/src/commands.ts#L9. It simply usedimport * as vscode from 'coc.nvim';
to make the feature effective. As a comparison, you can look at the original Angular implementation: https://github.com/angular/vscode-ng-language-service/blob/main/client/sr…