Skip to content

Change SPC f R to use file-browser's rename #290

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

stevenguh
Copy link
Member

Fixed #134.

As file-browser added separate command for rename in bodil/vscode-file-browser#27 and released v0.2.11, we can use that command instead of the built-in one.

@stevenguh stevenguh assigned stevenguh and unassigned stevenguh Nov 19, 2022
@marcoieni
Copy link
Member

marcoieni commented Nov 20, 2022

Disadvantages

I noticed a few disadvantages with this approach.

Smart renames

Some LSP performs actions when renaming a file with the current SPC f R.
For example, in Rust, when I rename a file, the LSP also updates the imports in the other files.
Instead, if I use this action, the LSP rename is not invoked.
The same is true when renaming a file inside a Foam workspace.
If I rename a markdown file by using the vscode explorer, the name of the file is renamed in other files, too. By using the new SPC f R it's not.

Focus lost

After performing the action on mac, the cursor is not focused anymore on any window of vscode, so to go back to editing the file, I have to use the mouse.
Instead, with the current SPC f R, the focus stays on the explorer window of vscode.

Alternatives

Current solution

The current SPC f R doesn't work 100% of the time. Sometimes it just select the file in the file browser, without renaming it.
However, I found a fix that works better. See this PR.

Why you don't like this solution and you prefer using an extension for renaming tasks?

FileUtils extension

I tried FileUtils. "Smart renames" work. But I sill lose focus.
Anyway, I don't think it's a good idea to add yet another extension. I mentioned this to show that it's possible to have "smart renames" with extensions.

@stevenguh
Copy link
Member Author

The current SPC f R doesn't work 100% of the time. Sometimes it just select the file in the file browser, without renaming it.
However, I found a fix that works better. See #293 PR.

Let's merge that PR to fix the current rename action.

Why you don't like this solution and you prefer using an extension for renaming tasks?

The built-in rename doesn't really allow you to move the file to a different path which is more align with spacemacs. However, currently there's quite a bit of issue with using vscode.workspace.fs.rename. (thanks for testing it)

Let put this on hold until we figured some of the those issues out.

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

Successfully merging this pull request may close these issues.

file management commands: <spc> f R, <spc> f c
2 participants