-
-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Description
I have the following snippet for Python logs:
local fmtad = ls.extend_decorator.apply(fmta, {
repeat_duplicates = true,
})
ls.snippet(
{
trig = 'lconf',
desc = 'Config logging',
},
fmtad('logging.basicConfig(<out>, level=<level>)', {
out = c(1, {
fmtad('stream=<fd>', {
fd = c(1, {
i(nil, 'sys.stdout'),
i(nil, 'sys.stderr'),
}),
}),
fmtad('filename=<fname>, filemode=<fmode>', {
fname = i(1, 'fname'),
fmode = i(2, 'a'),
}),
}),
level = c(2, {
i(nil, 'logging.DEBUG'),
i(nil, 'logging.INFO'),
i(nil, 'logging.WARNING'),
i(nil, 'logging.ERROR'),
i(nil, 'logging.CRITICAL'),
i(nil, 'logging.NOTSET'),
}),
})
),
I want to first set the <out>
placeholder, where I can choose whether to write log to the console or a log file; inside the "writing to console" choice, there's a second layer of choice between "stderr" and "stdout".
However, after I expand the snippet, I am only able to select between "sys.stdout" and "sys.stderr" (the inner choice) but not the outer choice between writing to a file or console (stream).
I think the correct behavior should be as follows:
- After expanding the snippet, luasnip should select the range of the out choice, aka
out
node, enabling users to select between "stream=..." and "filename=..., filemode=..." - Then, after pressing tab, the cursor should jump to the inner node (
fd
orfname
), if it'sfd
, then the user should be able to select the inner choice node. - Continue with other node...
What do you think?
Metadata
Metadata
Assignees
Labels
No labels