vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.56k stars 373 forks source link

Volar Support Vue File workspace/DidRename or workspace/WillRename in Neovim #4500

Open chaozwn opened 1 week ago

chaozwn commented 1 week ago

What problem does this feature solve?

Now I can rename files in vscode and reference files in other vue files to synchronize the name change. However, with the same configuration, my neovim did not work at all.

image

What does the proposed solution look like?

neovim support workspace/DidRename or workspace/WillRename

RayGuo-ergou commented 6 days ago

This repo does not have any neovim plugin, to achieve this you should config yourself. See how folke did it in lazyvim/lazyvim repo

chaozwn commented 6 days ago

This repo does not have any neovim plugin, to achieve this you should config yourself. See how folke did it in lazyvim/lazyvim repo

From my point of view, this is the function that volar should support as an lsp. For example, tsserver can automatically modify other references when rename files are given, and volar should also support when modifying vue files.

chaozwn commented 6 days ago

this is vtsls server_capabilities.workspace.fileOperations.didRename image

chaozwn commented 6 days ago

this is volar server_capabilities.workspace.fileOperations.didRename

image

chaozwn commented 5 days ago

This repo does not have any neovim plugin, to achieve this you should config yourself. See how folke did it in lazyvim/lazyvim repo I have found the perfect solution to use vtsls to synchronize vue files when renaming.

        vtsls = {
          on_attach = function(client, _)
            client.server_capabilities = utils.extend_tbl(client.server_capabilities, {
              workspace = {
                didChangeWatchedFiles = { dynamicRegistration = true },
                fileOperations = {
                  didRename = {
                    filters = {
                      {
                        pattern = {
                          glob = "**/*.{ts,cts,mts,tsx,js,cjs,mjs,jsx,vue}",
                        },
                      },
                    },
                  },
                },
              },
            })
     end
}
chaozwn commented 5 days ago

This repo does not have any neovim plugin, to achieve this you should config yourself. See how folke did it in lazyvim/lazyvim repo

The renaming problem is solved perfectly.