Skip to content

Commit

Permalink
Add padding
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Nov 30, 2023
1 parent 4c39f55 commit 963675e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ aaa

[#1 Insertion delimiter] = ""


[#2 Content] =
[#2 Removal] =
[#2 Domain] = 0:1-0:2
Expand All @@ -17,6 +18,7 @@ aaa

[#2 Insertion delimiter] = ""


[#3 Content] =
[#3 Removal] =
[#3 Domain] = 0:2-0:3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ aaa

[#1 Insertion delimiter] = "\n"


[#2 Content] =
[#2 Domain] = 1:0-1:3
0|
Expand Down Expand Up @@ -65,6 +66,7 @@ aaa

[#2 Insertion delimiter] = "\n"


[#3 Content] =
[#3 Domain] = 2:0-2:0
0|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ aaa_bbb

[#1 Insertion delimiter] = "_"


[#2 Content] =
[#2 Domain] = 0:4-0:7
0| aaa_bbb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ aaaBbb

[#1 Insertion delimiter] = ""


[#2 Content] =
[#2 Removal] =
[#2 Domain] = 0:3-0:6
Expand Down
16 changes: 8 additions & 8 deletions packages/cursorless-vscode-e2e/src/suite/serializeScopes.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Range, ScopeRanges, TargetRanges } from "@cursorless/common";

export function serializeScopes(code: string, scopes: ScopeRanges[]): string {
const codeLines = code.split("\n");
return [
...codeLines,
"---",
...scopes.map((scope, index) =>
const codeLines = code.split(/\r?\n/g);

const serializedScopes = scopes
.map((scope, index) =>
serializeScope(
codeLines,
scope,
scopes.length > 1 ? index + 1 : undefined,
),
),
"",
].join("\n");
)
.join("\n\n");

return [...codeLines, "---", serializedScopes, ""].join("\n");
}

function serializeScope(
Expand Down

0 comments on commit 963675e

Please sign in to comment.