As of helix 22.12 - if I understand the sources correctly - TOML configurations are merged in a way that after a certain depth values are replaced instead of combined (ref in helix-loader).
For debugger configurations this seems to always be the case, if present in a users languages.toml they will be merged as replacement for the built-in debugger configuration. While this feels like a good idea for most other settings scenarios in this case it causes a lot of extra work for the user.
An example - Let's say I want to add an extra c or c++ debugger configuration that opens the application in an external terminal.
Ideally I'd have to write something like this and the rest would be merged in from defaults:
[[language]]
name = "cpp"
[language.debugger]
name = "lldb-vscode"
[[language.debugger.templates]]
name = "binary (terminal)"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { runInTerminal = true, program = "{0}" }
Sadly, this isn't even a valid configuration because [language.debugger] already replaces the built-in in table values completely.
Writing it like this creates a valid configuration, but only leaves one available debugger configuration because the rest is discarded during merge as well:
[[language]]
name = "cpp"
[language.debugger]
name = "lldb-vscode"
transport = "stdio"
[[language.debugger.templates]]
name = "binary (terminal)"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { runInTerminal = true, program = "{0}" }
So to add a single extra template the user has to grab the original languages.toml from github or their sources, copy paste the full debugger section into their custom configuration and add the new template:
[[language]]
name = "cpp"
[language.debugger]
name = "lldb-vscode"
transport = "stdio"
command = "lldb-vscode"
# the new debugger profile we want to add
[[language.debugger.templates]]
name = "binary (terminal)"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { runInTerminal = true, program = "{0}" }
# everything else we need to copy from the original languages.toml since we don't want to lose these.
[[language.debugger.templates]]
name = "binary"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
completion = [ "pid" ]
args = { console = "internalConsole", pid = "{0}" }
[[language.debugger.templates]]
name = "gdbserver attach"
request = "attach"
completion = [ { name = "lldb connect url", default = "connect://localhost:3333" }, { name = "file", completion = "filename" }, "pid" ]
args = { console = "internalConsole", attachCommands = [ "platform select remote-gdb-server", "platform connect {0}", "file {1}", "attach {2}" ] }
Is there really no easier way this could be done?
As of helix 22.12 - if I understand the sources correctly - TOML configurations are merged in a way that after a certain depth values are replaced instead of combined (ref in helix-loader).
For debugger configurations this seems to always be the case, if present in a users
languages.tomlthey will be merged as replacement for the built-in debugger configuration. While this feels like a good idea for most other settings scenarios in this case it causes a lot of extra work for the user.An example - Let's say I want to add an extra c or c++ debugger configuration that opens the application in an external terminal.
Ideally I'd have to write something like this and the rest would be merged in from defaults:
Sadly, this isn't even a valid configuration because
[language.debugger]already replaces the built-in in table values completely.Writing it like this creates a valid configuration, but only leaves one available debugger configuration because the rest is discarded during merge as well:
So to add a single extra template the user has to grab the original
languages.tomlfrom github or their sources, copy paste the full debugger section into their custom configuration and add the new template:Is there really no easier way this could be done?