LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.25k stars 305 forks source link

[FEATURE-REQUEST] Configuration option to disable didRenameFiles prompt #2789

Open stefanwatt opened 1 month ago

stefanwatt commented 1 month ago

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?

tomlau10 commented 1 month ago

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