Open loczek opened 3 months ago
I can reproduce the behavior you're observing.
So the request is that when a default value is applied to a variable (e.g. ${1:i}
) that any subsequent references to $1
without a default specified should implicitly inherit from the initial default. Doesn't seem too crazy.
As a workaround you can specify the default for all instances of $1:
{
"for statement": {
"prefix": "for",
"body": ["for ${1:i} := ${2:0}; ${1:i} < ${3:count}; ${1:i}${4:++} {", "\t$0", "}"]
}
}
Zed's snippets are powered by zed-industries/simple-completion-language-server a fork of estin/simple-completion-language-server, likely this would need to be implemented upstream.
Summary
Currently linked tabstops don't use the same placeholder, instead they need a placeholder for each linked tabstop.
Instead of providing each tabstop with a placeholder they probably should use the first one that is encountered. I don't think there is a case where we would want to have a linked tabstop that uses different values, also this change would bring the behavior closer to what VSCode does.
This also applies to choices like
${1|one,two,three|}
Steps to reproduce:
Expected Behavior:
Actual Behavior:
Zed Version and System Specs
Zed: v0.182.0 (Zed Dev b864a9b0ae633006a44c02b723fe6fad07e84b93) OS: Windows 10.0.26200 Memory: 63.9 GiB Architecture: x86_64 GPU: NVIDIA GeForce GTX 1070 || NVIDIA || 566.36