-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature: ssr across files #13
Comments
There's a discussion on reddit. I'm not confident in project wide refactoring with treesitter rather than LSP servers, so ssr.nvim is focusing on single file UX now. |
From what I can tell, the
No need for the plugin to know about multiple files. EDIT: OK, there are a few problems with this method:
i'll see if there is a simple workaround... |
OK, different idea for the workflow: #26 Not as automated (this may actually be good) but should get the job done. |
Initially I thought it would be too slow to search entire project, because we need to open every file in vim, parse the buffer with treesitter and run a query, all in one single thread. However if you already have a small list of files in quickfix, it seems doable. #26 is indeed a good improvement, I use However I think if you want to replace in multiple files, instead of reopening ssr window in next file, it would be better to just not close it! If we make ssr window global and not related to the buffer it was opened from, we can apply the same ssr rule in other buffers, as long as ssr window is kept open. This is like when ssr window is open, the matched regions are kept highlighted and This way, we can use |
Yeah this is what I initially tried, but I couldn't figure out how, without refactoring a lot of things to be more "pure" functional style, which handles concurrency naturally. So I made #26 as a shorter-term feature that could hopefully get implemented/reviewed faster. I think For These are rough ideas, so maybe there are cleaner methods. |
I don't think
and can be verified by
To make ssr window global, fields like origin_buf need to be removed from the Ui class, and call |
Ah OK, that makes sense. What I had mistaken as concurrent behavior was simply
Need to also re- |
I experimented in bind-win branch. I made replace_confirm blocking. Using Now I feel that using quickfix is not convenient. I need to populate the qf with a rough grep and type the long cfdo command. And if I run the cfdo command in the ssr float window, everything is messed up.
I did some naive benchmark and it's surprising that this process itself is not that slow. The key is to turn off autocmd. I have 400 .ts files in qf, and running a simple replace takes less than 1 second. noau cfdo lua vim.bo.ft='typescript' require'ssr'.replace_all() So in my ultimate plan ssr.nvim will support project wide searching. I'll use ripgrep to search a fixed string in the pattern to find possible files. |
Can use keybinding for this.
This is great too, very exciting. |
see also nvim-telescope/telescope.nvim#2611 |
I'm not sure how difficult it would be to implement, but it would be a useful feature when you need to make a similar change in several files.
The text was updated successfully, but these errors were encountered: