lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

[FEATURE-REQUEST] Configuration option to disable didRenameFiles prompt

Open stefanwatt opened this issue 1 year ago • 1 comments

When the language server is notified that a file rename has occured you are always prompted with "Do you want to modify the require path?"

I find that to be bothersome and would prefer if the refactoring would happen silently. As far as I can tell there's currently no configuration option for this.

The responsible code seems to be in lua-language-server/script/core/modifyRequirePath.lua:67:

    local _, index = client.awaitRequestMessage('Info', lang.script.WINDOW_MODIFY_REQUIRE_PATH, {
        lang.script.WINDOW_MODIFY_REQUIRE_OK
    })

Would it be possible to simply add a check for a config option here?

stefanwatt avatar Aug 11 '24 00:08 stefanwatt

Personally I think a double confirmation is much safer. 🤔

And in vscode there's actually a key binding for notification.acceptPrimaryAction. It's ctrl+shift+a on windows (may vary on other OS platforms). You can check all the keybinds using Preferences: Open Keyboard Shortcuts cmd.

Below is an non-official document of all keybinds on windows vscode for reference: https://github.com/codebling/vs-code-default-keybindings/blob/11e0bfe042f10a4b490c16760c5094bdf260bcf0/windows.keybindings.json#L994-L995


So assume you used vscode on windows, whenever this refactor notification pops up and you are sure that you want to execute it immediately, you can just press ctrl+shift+a to accept it.

The same applies to auto require a file, which you can use ctrl+shift+a to accept the action when it pops up. https://luals.github.io/wiki/settings/#completionautorequire

tomlau10 avatar Aug 11 '24 02:08 tomlau10