Replies: 1 comment 1 reply
-
@svaante Have you considered doing it the way |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Intro
I want some feedback on an
dape
issue that I have been think about for a while and something I want to get right, especially if the solution will break user defined configurations (calling itconfigs
was an mistake,templates
would have been better).Let me just preface this to get your mind in the right place.
dape
is to be as close to the emacs way of doing things.dape
configuration format is anplist
not an json object.dape
configuration from an "launch.json" (necessary evil I think).Problems
dape
to remove or ignore an property in an configuration.Improve usage ergonomics
If we use the following configuration as an example to illustrate the issue:
The user want to debug using the
gdb
config but does not want the environment variableDEBUG
to be set.There is two ways to work around this, both being painful:
dape-configs
where:env (:DEBUG 1)
is removeddape
command withlaunch :request "launch" :program "a.out" ...
with add all properties from thegdb
config without:env (:DEBUG 1)
Improve discoverability in batteries included configs
Let's reuse the same configuration.
If I where to add this configuration as an batteries included config it would look something like this.
Notice the missing
:env
property. Even though I know that:env
exist I can't document the fact in the config without using some strange default value for:env
to make it show up indape
completions and the hint section.The user has to lookup the gdb manual to figure out that's the way to set environment variables.
Suggested solutions
Here follows some possible solutions. Split into the categories:
dape
command read functionalityIntroduce an new special config value
One way would be to add an "null" or an "ignore" symbol.
dape
command overwrite the config value withgdb :env some-new-symbol
:env some-new-symbol
can be added (the user still has to know that the value is anplist
), which makes it show up in the hint buffer and as an completion.JSON "null"
Add an symbol/keyword whatever which allows the user to set a property to json "null" to send
null
as part of thelaunch
/attach
request.Ramblings on which symbol to use
In lisp `nil` is `false` and `t` is `true`. But when parsing json "null" and "false" is valid values but there is no obvious to translate into in lisp.In
json-parse-buffer
the default value is:null
, injsonrpc
it's'nil
and "false" is:json-false
.Not a big fan of any of them as it's not really line up with point (2.) under Solutions but that does not rule out the solution.
One benefit of having an null value is to allow for
dape
to actually send "null" if an adapter requires null for some reason.Ignore symbol
Introduce an symbol, let's call it
ignore
which just removes the property at before sending it off to adapter.And using as follows with the
dape
command:gdb :env ignore
Extremely unobtrusive option.
Add an special value construct with docs
This will only solve the problem under "Improve discoverability in batteries included configurations". But can be combined with the other options to solve both.
Something like the following:
The
:doc
information can then be displayed in the hint section of theminibuffer
.Rework
dape
read configTo allow for removal of properties, which basically means that that all properties needs to be presented in some way to be able to remove them.
Pop up buffer
dape
command complete from the available configs nothing moredape-edit
which lets you edit the configurationUsing
edit-macro
as inspiration and with combination of "Add an special value construct with docs" can show docs as well.Transient
Maybe transient could be used in some way am not that familiar with
transient
.Define an specialized parser for each config
See #44 (comment)
Beta Was this translation helpful? Give feedback.
All reactions