Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This will only work if you open the file you want to rename in tsserver #15

Open
gengdz opened this issue Jul 28, 2023 · 3 comments
Open

Comments

@gengdz
Copy link

gengdz commented Jul 28, 2023

my config:

  {
    "antosha417/nvim-lsp-file-operations",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-neo-tree/neo-tree.nvim",
    },
    config = function()
      require("lsp-file-operations").setup({ debug = false })
    end,
  },

If I change the file name directly on the file tree, it won't work.

If I open this file and then modify it it works fine.

@gengdz gengdz changed the title In ts this will only work if you open the file you want to rename This will only work if you open the file you want to rename in tsserver Jul 28, 2023
@Green0wl
Copy link

Green0wl commented Aug 2, 2023

@gengdz same problem. i am using tsserver + angulars. maybe you found a way to solve it? by the way, i just checked specifically and the plugin works fine even when i open tabs through nvim-tree using tab (without even doing anything there). then when i rename the file in nvim-tree, everything works. But I can tell you that lsp doesn't work fine for me either. For the lsp server to notice anything wrong with a file, I have to open it, even if I started the server manually beforehand. maybe this is related, and you should make lsp somehow look through all files when starting nvim.

@Lamarcke
Copy link

my config:

  {
    "antosha417/nvim-lsp-file-operations",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-neo-tree/neo-tree.nvim",
    },
    config = function()
      require("lsp-file-operations").setup({ debug = false })
    end,
  },

If I change the file name directly on the file tree, it won't work.

If I open this file and then modify it it works fine.

Technically speaking, LSP clients only attached when you have one of the supported filetypes open. This means that they only call the lsp start function there.

@sahinakkaya
Copy link

This will do renaming only in open buffers. Open a project and open some buffers. When you rename one of the files, imports are adjusted only on open buffers. I am doing the following as a workaround:

# open all js files in current project
:args **/**.js

# rename file from neo-tree

# write all changes
:wa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants