Skip to content

Commit d85fb9e

Browse files
committed
Change marker to double carets to avoid conflicts with the caret operator
1 parent dbb24c8 commit d85fb9e

22 files changed

+246
-246
lines changed

tests/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ var register = new vt.Registry();
88
var tsGrammar = register.loadGrammarFromPathSync("../TypeScript.tmLanguage");
99
var tsReactGrammar = register.loadGrammarFromPathSync("../TypeScriptReact.tmLanguage");
1010

11-
const marker = '^';
11+
const marker = '^^';
1212

1313
function deleteCharAt(index: number, str: string) {
14-
return str.slice(0, index) + str.slice(index + 1);
14+
return str.slice(0, index) + str.slice(index + marker.length);
1515
}
1616

1717
function getMarkerLocations(str: string): number[] {

tests/cases/Abstracts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
^abstract class Animal {
1+
^^abstract class Animal {
22
public age: number;
33
public yearsLeft() { return 20 - this.age; }
4-
^abstract makeSound(): string;
4+
^^abstract makeSound(): string;
55
}
66

77
class Cow extends Animal {

tests/cases/ArrowFunctionInsideTypeAssertion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Issue: https://github.com/Microsoft/TypeScript-Sublime-Plugin/issues/292
22

33
var object = {
4-
setTransform: ^<^(^domNode: ^HTMLElement, ^desiredValue: ^string) ^=> ^void>^null,
4+
setTransform: ^^<^^(^^domNode: ^^HTMLElement, ^^desiredValue: ^^string) ^^=> ^^void>^^null,
55
setDisplay: (domNode: HTMLElement, desiredValue: string) => {
66
if (domNode.style.display !== desiredValue) {
77
domNode.style.display = desiredValue;
@@ -14,7 +14,7 @@ function f(x: string | ((value: string) => number)) {
1414
return +x
1515
}
1616
else {
17-
let f = ^<^(^v: ^string) ^=> ^number^> ^x
17+
let f = ^^<^^(^^v: ^^string) ^^=> ^^number^^> ^^x
1818
return f("hello world")
1919
}
2020
}

tests/cases/Comments.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,65 @@ Pull requests:
66
- https://github.com/Microsoft/TypeScript-Sublime-Plugin/pull/308
77
*/
88

9-
var ^/* comment */ x: string = "yahoo";
10-
var x ^/* comment */: string = "yahoo";
11-
var x: ^/* comment */ string = "yahoo";
12-
var x: string ^/* comment */ = "yahoo";
13-
var x: string = ^/* comment */ "yahoo";
14-
var x: string = "yahoo" ^/* comment */;
15-
var x: string = "yahoo"; ^/* comment */
9+
var ^^/* comment */ x: string = "yahoo";
10+
var x ^^/* comment */: string = "yahoo";
11+
var x: ^^/* comment */ string = "yahoo";
12+
var x: string ^^/* comment */ = "yahoo";
13+
var x: string = ^^/* comment */ "yahoo";
14+
var x: string = "yahoo" ^^/* comment */;
15+
var x: string = "yahoo"; ^^/* comment */
1616

17-
var ^/* comment */ x: string = "yahoo"
18-
var x ^/* comment */: string = "yahoo"
19-
var x: ^/* comment */ string = "yahoo"
20-
var x: string ^/* comment */ = "yahoo"
21-
var x: string = ^/* comment */ "yahoo"
22-
var x: string = "yahoo" ^/* comment */
17+
var ^^/* comment */ x: string = "yahoo"
18+
var x ^^/* comment */: string = "yahoo"
19+
var x: ^^/* comment */ string = "yahoo"
20+
var x: string ^^/* comment */ = "yahoo"
21+
var x: string = ^^/* comment */ "yahoo"
22+
var x: string = "yahoo" ^^/* comment */
2323

24-
^/**/ interface i extends i1, i2, i3 {}
25-
interface ^/**/ i extends i1, i2, i3 {}
26-
interface i ^/**/ extends i1, i2, i3 {}
27-
interface i extends ^/**/ i1, i2, i3 {}
28-
interface i extends i1 ^/**/, i2, i3 {}
29-
interface i extends i1, ^/**/ i2, i3 {}
30-
interface i extends i1, i2 ^/**/, i3 {}
31-
interface i extends i1, i2, ^/**/ i3 {}
32-
interface i extends i1, i2, i3 ^/**/ {}
33-
^/**/ interface ^/**/ i ^/**/ extends ^/**/ i1, ^/**/ i2, ^/**/ i3 ^/**/ {}
34-
^/**/ interface ^/**/ i ^/**/ extends ^/**/ i1 ^/**/ , ^/**/ i2 ^/**/ , ^/**/ i3 ^/**/ {}
24+
^^/**/ interface i extends i1, i2, i3 {}
25+
interface ^^/**/ i extends i1, i2, i3 {}
26+
interface i ^^/**/ extends i1, i2, i3 {}
27+
interface i extends ^^/**/ i1, i2, i3 {}
28+
interface i extends i1 ^^/**/, i2, i3 {}
29+
interface i extends i1, ^^/**/ i2, i3 {}
30+
interface i extends i1, i2 ^^/**/, i3 {}
31+
interface i extends i1, i2, ^^/**/ i3 {}
32+
interface i extends i1, i2, i3 ^^/**/ {}
33+
^^/**/ interface ^^/**/ i ^^/**/ extends ^^/**/ i1, ^^/**/ i2, ^^/**/ i3 ^^/**/ {}
34+
^^/**/ interface ^^/**/ i ^^/**/ extends ^^/**/ i1 ^^/**/ , ^^/**/ i2 ^^/**/ , ^^/**/ i3 ^^/**/ {}
3535

36-
^/**/class i extends c1,c2,c3{}
37-
class^/**/i extends c1,c2,c3{}
38-
class i^/**/extends c1,c2,c3{}
39-
class i extends^/**/c1,c2,c3{}
40-
class i extends c1^/**/,c2,c3{}
41-
class i extends c1,^/**/c2,c3{}
42-
class i extends c1,c2^/**/,c3{}
43-
class i extends c1,c2,^/**/c3{}
44-
class i extends c1,c2,c3^/**/{}
45-
^/**/class^/**/i^/**/extends^/**/c1,^/**/c2,^/**/c3^/**/{}
46-
^/**/class^/**/i^/**/extends^/**/c1^/**/,^/**/c2^/**/,^/**/c3^/**/{}
36+
^^/**/class i extends c1,c2,c3{}
37+
class^^/**/i extends c1,c2,c3{}
38+
class i^^/**/extends c1,c2,c3{}
39+
class i extends^^/**/c1,c2,c3{}
40+
class i extends c1^^/**/,c2,c3{}
41+
class i extends c1,^^/**/c2,c3{}
42+
class i extends c1,c2^^/**/,c3{}
43+
class i extends c1,c2,^^/**/c3{}
44+
class i extends c1,c2,c3^^/**/{}
45+
^^/**/class^^/**/i^^/**/extends^^/**/c1,^^/**/c2,^^/**/c3^^/**/{}
46+
^^/**/class^^/**/i^^/**/extends^^/**/c1^^/**/,^^/**/c2^^/**/,^^/**/c3^^/**/{}
4747
48-
interface KeyValuePair^/**/<K, V> extends Array<K | V> { 0: K; 1: V; }
49-
interface KeyValuePair<K, V>^/**/extends Array<K | V> { 0: K; 1: V; }
50-
interface KeyValuePair<K, V> extends^/**/Array<K | V> { 0: K; 1: V; }
51-
interface KeyValuePair<K, V> extends Array^/**/<K | V> { 0: K; 1: V; }
52-
interface KeyValuePair<K, V> extends Array<K | V>^/**/{ 0: K; 1: V; }
48+
interface KeyValuePair^^/**/<K, V> extends Array<K | V> { 0: K; 1: V; }
49+
interface KeyValuePair<K, V>^^/**/extends Array<K | V> { 0: K; 1: V; }
50+
interface KeyValuePair<K, V> extends^^/**/Array<K | V> { 0: K; 1: V; }
51+
interface KeyValuePair<K, V> extends Array^^/**/<K | V> { 0: K; 1: V; }
52+
interface KeyValuePair<K, V> extends Array<K | V>^^/**/{ 0: K; 1: V; }
5353

54-
interface G^/**/<extends_, _extends extends Function> {
54+
interface G^^/**/<extends_, _extends extends Function> {
5555
f<V extends U>(x: V): V;
5656
}
57-
interface G<extends_, _extends^/**/extends Function> {
57+
interface G<extends_, _extends^^/**/extends Function> {
5858
f<V extends U>(x: V): V;
5959
}
60-
interface G<extends_, _extends extends^/**/Function> {
60+
interface G<extends_, _extends extends^^/**/Function> {
6161
f<V extends U>(x: V): V;
6262
}
6363

64-
var x^/*comments*/=new String();
65-
var x=^/*comments*/new String();
66-
var x= new^/*comments*/String();
64+
var x^^/*comments*/=new String();
65+
var x=^^/*comments*/new String();
66+
var x= new^^/*comments*/String();
6767

68-
var x ^/* comments */ = new String();
69-
var x = ^/* comments */ new String();
70-
var x = new ^/* comments */ String();
68+
var x ^^/* comments */ = new String();
69+
var x = ^^/* comments */ new String();
70+
var x = new ^^/* comments */ String();
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
/* Function overload tests */
2-
^export function ^testFunctionOverload(p: number): new() => any
3-
^export function ^testFunctionOverload(p: string)
4-
^export function ^testFunctionOverload(p: string [])
5-
^export function ^testFunctionOverload(p: {})
6-
^export function ^testFunctionOverload(p: {a: A, b:B} | string [])
7-
^export function ^testFunctionOverload(p: any): new() => any {
8-
^throw new Error("")
2+
^^export function ^^testFunctionOverload(p: number): new() => any
3+
^^export function ^^testFunctionOverload(p: string)
4+
^^export function ^^testFunctionOverload(p: string [])
5+
^^export function ^^testFunctionOverload(p: {})
6+
^^export function ^^testFunctionOverload(p: {a: A, b:B} | string [])
7+
^^export function ^^testFunctionOverload(p: any): new() => any {
8+
^^throw new Error("")
99
}
1010

11-
^export function ^testFunctionOverloadWithSemicolon(p: number): new () => any;
12-
^export function ^testFunctionOverloadWithSemicolon(p: string);
13-
^export function ^testFunctionOverloadWithSemicolon(p: string[]);
14-
^export function ^testFunctionOverloadWithSemicolon(p: {});
15-
^export function ^testFunctionOverloadWithSemicolon(p: { a: A, b: B } | string[]);
16-
^export function ^testFunctionOverloadWithSemicolon(p: any): new () => any {
17-
^throw new Error("")
11+
^^export function ^^testFunctionOverloadWithSemicolon(p: number): new () => any;
12+
^^export function ^^testFunctionOverloadWithSemicolon(p: string);
13+
^^export function ^^testFunctionOverloadWithSemicolon(p: string[]);
14+
^^export function ^^testFunctionOverloadWithSemicolon(p: {});
15+
^^export function ^^testFunctionOverloadWithSemicolon(p: { a: A, b: B } | string[]);
16+
^^export function ^^testFunctionOverloadWithSemicolon(p: any): new () => any {
17+
^^throw new Error("")
1818
}
1919

2020

2121
class testClass {
2222
/* Function overload tests */
23-
^public ^testMethodOverload(p: number): new() => any
24-
^public ^testMethodOverload(p: string)
25-
^public ^testMethodOverload(p: string [])
26-
^public ^testMethodOverload(p: {})
27-
^public ^testMethodOverload(p: {a: A, b:B} | string [])
28-
^public ^testMethodOverload(p: any): new() => any {
29-
^throw new Error("")
23+
^^public ^^testMethodOverload(p: number): new() => any
24+
^^public ^^testMethodOverload(p: string)
25+
^^public ^^testMethodOverload(p: string [])
26+
^^public ^^testMethodOverload(p: {})
27+
^^public ^^testMethodOverload(p: {a: A, b:B} | string [])
28+
^^public ^^testMethodOverload(p: any): new() => any {
29+
^^throw new Error("")
3030
}
3131

32-
^public ^testMethodOverloadWithSemicolon(p: number): new () => any;
33-
^public ^testMethodOverloadWithSemicolon(p: string);
34-
^public ^testMethodOverloadWithSemicolon(p: string[]);
35-
^public ^testMethodOverloadWithSemicolon(p: {});
36-
^public ^testMethodOverloadWithSemicolon(p: { a: A, b: B } | string[]);
37-
^public ^testMethodOverloadWithSemicolon(p: any): new () => any {
38-
^throw new Error("")
32+
^^public ^^testMethodOverloadWithSemicolon(p: number): new () => any;
33+
^^public ^^testMethodOverloadWithSemicolon(p: string);
34+
^^public ^^testMethodOverloadWithSemicolon(p: string[]);
35+
^^public ^^testMethodOverloadWithSemicolon(p: {});
36+
^^public ^^testMethodOverloadWithSemicolon(p: { a: A, b: B } | string[]);
37+
^^public ^^testMethodOverloadWithSemicolon(p: any): new () => any {
38+
^^throw new Error("")
3939
}
4040
}
4141

4242
interface I {
43-
^foo(): number
44-
^bar(): string;
43+
^^foo(): number
44+
^^bar(): string;
4545
}
4646

4747
abstract class C {
48-
^abstract ^foo()
49-
^abstract ^bar()
48+
^^abstract ^^foo()
49+
^^abstract ^^bar()
5050
}
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
/* Function parameter tests */
22
function testFunctionParamType(
3-
^m1: string,
4-
^m2: {},
5-
^m3: any [],
6-
^m4: {a: A, b: B},
7-
^m5: () => void,
8-
^m6: (x:(string), y:[number, string]) => number,
9-
^m7: Array<number>,
10-
^m8: [number, number],
11-
^m9: {a: A, b: B} | [number, number],
12-
^m10: (() => void) | string[]): number {
13-
^return m6.length;
3+
^^m1: string,
4+
^^m2: {},
5+
^^m3: any [],
6+
^^m4: {a: A, b: B},
7+
^^m5: () => void,
8+
^^m6: (x:(string), y:[number, string]) => number,
9+
^^m7: Array<number>,
10+
^^m8: [number, number],
11+
^^m9: {a: A, b: B} | [number, number],
12+
^^m10: (() => void) | string[]): number {
13+
^^return m6.length;
1414
}
1515

1616
class testClass {
1717
/* method param type tests */
1818
public testMethodParamType(
19-
^m1: string,
20-
^m2: {},
21-
^m3: any [],
22-
^m4: {a: A, b: B},
23-
^m5: () => void,
24-
^m6: (x:(string), y:[number, string]) => number,
25-
^m7: Array<number>,
26-
^m8: [number, number],
27-
^m9: {a: A, b: B} | [number, number],
28-
^m10: (() => void) | string[]): number {
29-
^return m6.length;
19+
^^m1: string,
20+
^^m2: {},
21+
^^m3: any [],
22+
^^m4: {a: A, b: B},
23+
^^m5: () => void,
24+
^^m6: (x:(string), y:[number, string]) => number,
25+
^^m7: Array<number>,
26+
^^m8: [number, number],
27+
^^m9: {a: A, b: B} | [number, number],
28+
^^m10: (() => void) | string[]): number {
29+
^^return m6.length;
3030
}
3131
}
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
/* Function return type tests */
2-
^export function ^testFunctionReturnType1(): string [] { ^return [""] }
3-
^export function ^testFunctionReturnType2(): {} { ^return {} }
4-
^export function ^testFunctionReturnType3(): {a: A, b: B} { ^return {a: {m: "" }, b: {m1: "" }} }
5-
^export function ^testFunctionReturnType4(): [number, number] { ^return [1, 1] }
6-
^export function ^testFunctionReturnType5(): Array<A> { ^return [{ m: "" }] }
7-
^export function ^testFunctionReturnType6(): new () => number { ^throw new Error(""); }
8-
^export function ^testFunctionReturnType7(): (() => number) { ^throw new Error(""); }
9-
^export function ^testFunctionReturnType8(): (() => number) [] { ^throw new Error(""); }
10-
^export function ^testFunctionReturnType9(): (() => number) | (() => string) { ^throw new Error(""); }
11-
^export function ^testFunctionReturnType10(): {a: A, b: B} [] { ^return [{a: {m: "" }, b: {m1: "" }}] }
12-
^export function ^testFunctionReturnType11(): number | string { ^return 1 }
13-
^export function ^testFunctionReturnType12(): number | string [] { ^return }
14-
^export function ^testFunctionReturnType13(): [number, number] | string [] { ^return [""] }
2+
^^export function ^^testFunctionReturnType1(): string [] { ^^return [""] }
3+
^^export function ^^testFunctionReturnType2(): {} { ^^return {} }
4+
^^export function ^^testFunctionReturnType3(): {a: A, b: B} { ^^return {a: {m: "" }, b: {m1: "" }} }
5+
^^export function ^^testFunctionReturnType4(): [number, number] { ^^return [1, 1] }
6+
^^export function ^^testFunctionReturnType5(): Array<A> { ^^return [{ m: "" }] }
7+
^^export function ^^testFunctionReturnType6(): new () => number { ^^throw new Error(""); }
8+
^^export function ^^testFunctionReturnType7(): (() => number) { ^^throw new Error(""); }
9+
^^export function ^^testFunctionReturnType8(): (() => number) [] { ^^throw new Error(""); }
10+
^^export function ^^testFunctionReturnType9(): (() => number) | (() => string) { ^^throw new Error(""); }
11+
^^export function ^^testFunctionReturnType10(): {a: A, b: B} [] { ^^return [{a: {m: "" }, b: {m1: "" }}] }
12+
^^export function ^^testFunctionReturnType11(): number | string { ^^return 1 }
13+
^^export function ^^testFunctionReturnType12(): number | string [] { ^^return }
14+
^^export function ^^testFunctionReturnType13(): [number, number] | string [] { ^^return [""] }
1515

1616
class TestClass {
1717
/* method return type tests */
18-
^public ^testMethodReturnType1(): string [] { ^return [""] }
19-
^public ^testMethodReturnType2(): {} { ^return {} }
20-
^public ^testMethodReturnType3(): {a: A, b: B} { ^return {a: {m: "" }, b: {m1: "" }} }
21-
^public ^testMethodReturnType4(): [number, number] { ^return [1, 1] }
22-
^public ^testMethodReturnType5(): Array<A> { ^return [{ m: "" }] }
23-
^public ^testMethodReturnType6(): new () => number { ^throw new Error(""); }
24-
^public ^testMethodReturnType7(): (() => number) { ^throw new Error(""); }
25-
^public ^testMethodReturnType8(): (() => number) [] { ^throw new Error(""); }
26-
^public ^testMethodReturnType9(): (() => number) | (() => string) { ^throw new Error(""); }
27-
^public ^testMethodReturnType10(): {a: A, b: B} [] { ^return [{a: {m: "" }, b: {m1: "" }}] }
28-
^public ^testMethodReturnType11(): number | string { ^return 1 }
29-
^public ^testMethodReturnType12(): number | string [] { ^return }
30-
^public ^testMethodReturnType13(): [number, number] | string [] { ^return [""] }
18+
^^public ^^testMethodReturnType1(): string [] { ^^return [""] }
19+
^^public ^^testMethodReturnType2(): {} { ^^return {} }
20+
^^public ^^testMethodReturnType3(): {a: A, b: B} { ^^return {a: {m: "" }, b: {m1: "" }} }
21+
^^public ^^testMethodReturnType4(): [number, number] { ^^return [1, 1] }
22+
^^public ^^testMethodReturnType5(): Array<A> { ^^return [{ m: "" }] }
23+
^^public ^^testMethodReturnType6(): new () => number { ^^throw new Error(""); }
24+
^^public ^^testMethodReturnType7(): (() => number) { ^^throw new Error(""); }
25+
^^public ^^testMethodReturnType8(): (() => number) [] { ^^throw new Error(""); }
26+
^^public ^^testMethodReturnType9(): (() => number) | (() => string) { ^^throw new Error(""); }
27+
^^public ^^testMethodReturnType10(): {a: A, b: B} [] { ^^return [{a: {m: "" }, b: {m1: "" }}] }
28+
^^public ^^testMethodReturnType11(): number | string { ^^return 1 }
29+
^^public ^^testMethodReturnType12(): number | string [] { ^^return }
30+
^^public ^^testMethodReturnType13(): [number, number] | string [] { ^^return [""] }
3131
}

tests/cases/Issue149.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
^export function ^fn(s: ^string): ^new() => ^View
2-
^export function ^fn(s: string)
3-
^export function ^fn(n: number)
4-
^export function ^fn(s: any) {
5-
^return "";
1+
^^export function ^^fn(s: ^^string): ^^new() => ^^View
2+
^^export function ^^fn(s: string)
3+
^^export function ^^fn(n: number)
4+
^^export function ^^fn(s: any) {
5+
^^return "";
66
}
77

8-
^export function ^fn(s: string): ^new () => ^View;
9-
^export function ^fn(s: string);
10-
^export function ^fn(n: number);
11-
^export function ^fn(s: any) {
12-
^return "";
8+
^^export function ^^fn(s: string): ^^new () => ^^View;
9+
^^export function ^^fn(s: string);
10+
^^export function ^^fn(n: number);
11+
^^export function ^^fn(s: any) {
12+
^^return "";
1313
}

tests/cases/Issue156.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Test {
2-
^mmm(^p1: ^string | ^{}, ^p2: ^string)
2+
^^mmm(^^p1: ^^string | ^^{}, ^^p2: ^^string)
33
{
4-
^
4+
^^
55
}
66
}

0 commit comments

Comments
 (0)