Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
fix possible bug with special snippets
Browse files Browse the repository at this point in the history
when having a snippet text with a snippet location at 12 and one at 120 then
the replacement was broken before
  • Loading branch information
WebFreak001 committed Dec 12, 2019
1 parent 15ca706 commit 4197e76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/workspaced/com/snippets/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class SnippetsComponent : ComponentWrapper
}
else
{
string key = "__WspD_Snp_" ~ dollar.to!string;
string key = "__WspD_Snp_" ~ dollar.to!string ~ "_";
const(char)[] str;

bool startOfBlock = snippet[0 .. dollar].stripRight.endsWith("{");
Expand Down Expand Up @@ -553,4 +553,7 @@ unittest

res = snippets.formatSync("foo(delegate() {\n${1:// foo}\n});", args, SnippetLevel.method);
shouldEqual(res, "foo(delegate() {\n\t${1:// foo}\n});");

res = snippets.formatSync(`auto ${1:window} = new SimpleWindow(Size(${2:800, 600}), "$3");`, args, SnippetLevel.method);
shouldEqual(res, `auto ${1:window} = new SimpleWindow(Size(${2:800, 600}), "$3");`);
}

0 comments on commit 4197e76

Please sign in to comment.