The autocomplete in the editor often gives nonsensical suggestions for example
This paired with the fact that Enter selects the suggestion (I’d typically remap this action to Tab if possible) means that when you are at the end of the line you need to escape the suggestion to be able to write.
Even if the keybinding is more of a question of habit/opinion, I think these generic lua suggestions might need a bit of toning down.
That’s LuaLS doing its job here. Same should happen in e.g. vscode as well.
The tool editor’s LuaLS can be configure via the file .luarc in the “User Scripts” root directory. You’ll see a template file when opening the Renoise inbuilt scripting editor.
For phrase scripts there’s no user config path for a .luarc yet. Probably should add one.
It seems that in Renoise the autocomplete works a little differently, for the above example the prompt “lags behind” whereas in my editor (helix with lua-ls), I get the same suggestion but once I finish typing the float, the suggestion window disappears, it won’t try to replace the 5 with a do block like in Renoise.
I think there are more instances like this, where the autocomplete prompt would be expected to disappear at a point (and it does in other editors) but in Renoise it doesn’t, which is why I think maybe there is some difference here with “polling the lsp”, not familiar with how that works though. So in the above example the . triggers the hint but the 5 should make it disappear. I can gather more cases demonstrating this later if needed.
Having the select action remappable to Tab would solve the main annoyance for me but the prompt lagging behind the context could still be confusing for users new to coding.
Personally, I wouldn’t disable autocomplete completely as it is otherwise very handy, but having that as an option can’t hurt.
I have no preference over where the settings should be.
Just put this together with aid of Copilot to add a menu to the scripting ed, maybe needs to be checked for file writing safety?
Seems to work ok to toggle AC on and off though. It just toggles the true/false in .luarc.json
-- Menu
renoise.tool():add_menu_entry {
name = "Scripting Menu:View:Enable Autocomplete",
invoke = function()
main()
end
}
---------------
function main()
---------------
local file_path = renoise.tool().bundle_path
local result = file_path:match("^(.-Scripts\\)")
file_path = result..".luarc.json"
-- Read file
local file = io.open(file_path, "r")
local content = file:read("*a")
file:close()
local toggle_flag = false
-- Toggle "hover.enable"
if content:find('"hover.enable"%s*:%s*true') then
content = content:gsub('"hover.enable"%s*:%s*true', '"hover.enable": false')
elseif content:find('"hover.enable"%s*:%s*false') then
content = content:gsub('"hover.enable"%s*:%s*false', '"hover.enable": true')
toggle_flag = true
end
-- Write it back
file = io.open(file_path, "w")
file:write(content)
file:close()
renoise.app():show_status("Toggled hover.enable in settings.json: "..tostring(toggle_flag))
end
--[[
--debug
-------------------------------
local function print_contents()
-------------------------------
local file = io.open(file_path, "r")
if not file then
print("Failed to open file")
return
end
local content = file:read("*a")
file:close()
print("File contents:\n" .. content)
local file = io.open(file_path, "w")
file:write(content)
file:flush() -- ensure the buffer is flushed
file:close()
print("Wrote updated content to file.")
end
---
print_contents()
--]]
I’m trying to disable the annoying autocomplete in the scripting editor, but adding a .luarc.json file in the ~/Preferences/Renoise/V3.5.3/Scripts directory is having no effect. I can see from the log file in ~/Library/Logs/LuaLS that LuaLS is picking it up, but is then reloading the default ‘fallback’ config afterwards.
The autocomplete rarely gets it right and is really distracting. I really just want it off entirely, especially since I can see that it has an option “telemetry.enable” in it, which is an absolute no-no from my point of view. Please can we have a global option to stop it from running at all. It’s not a helpful addition and adds a lot of faff and overhead, such as having its own log folder completely separate from the Renoise logs.
Disabling hover tips via "hover.enable": false, should work. Just have tested that here.
"completion.enable": false indeed isn’t picked up by Renoise. Maybe we should add our own preferences for that in Renoise, avoiding the use of .luarc.json completely here.
Telemetry always gets disabled by Renoise when starting up the language server, so there there’s no need to disable it there.
Thanks for confirming it’s not just my error. I can see that I am getting no hover pop-ups with those settings, but my main aim was turning completion off entirely. I added the hover/hint options as a way to cover all areas, but was really expecting that completion.enable: false would do the job for everything.
If there could be an option to totally disable LuaLS, ie. stop it from being run at all, that would be ideal, even if it was a deeper options file setting rather than a menu item/GUI entry.