Skip to content

Commit e28b9b2

Browse files
committed
Copy smartSelect tests to fourslash
1 parent 6fc2e4a commit e28b9b2

29 files changed

+852
-1
lines changed

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ Actual: ${stringify(fullActual)}`);
15291529
baselineContent.push(masked);
15301530
selectionRange = selectionRange.parent;
15311531
}
1532-
return baselineContent.join(n);
1532+
return baselineContent.join(fileContent.includes("\n") ? n + n : n);
15331533
}).join(n.repeat(2) + "=".repeat(80) + n.repeat(2));
15341534

15351535
Harness.Baseline.runBaseline(baselineFile, text);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Not a JSDoc comment
2+
/**
3+
* @param {number} x The number to square
4+
*/
5+
function /**/square(x) {
6+
return x * x;
7+
}
8+
9+
10+
square
11+
12+
13+
function square(x) {
14+
return x * x;
15+
}
16+
17+
/**
18+
* @param {number} x The number to square
19+
*/
20+
function square(x) {
21+
return x * x;
22+
}
23+
24+
// Not a JSDoc comment
25+
/**
26+
* @param {number} x The number to square
27+
*/
28+
function square(x) {
29+
return x * x;
30+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let/**/ x: string
2+
3+
let
4+
let x: string
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const { /**/x, y: a, ...zs = {} } = {};
2+
3+
x
4+
x, y: a, ...zs = {}
5+
{ x, y: a, ...zs = {} }
6+
const { x, y: a, ...zs = {} } = {};
7+
8+
================================================================================
9+
10+
const { x, y: /**/a, ...zs = {} } = {};
11+
12+
a
13+
y: a
14+
x, y: a, ...zs = {}
15+
{ x, y: a, ...zs = {} }
16+
const { x, y: a, ...zs = {} } = {};
17+
18+
================================================================================
19+
20+
const { x, y: a, .../**/zs = {} } = {};
21+
22+
zs
23+
...zs
24+
...zs = {}
25+
x, y: a, ...zs = {}
26+
{ x, y: a, ...zs = {} }
27+
const { x, y: a, ...zs = {} } = {};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type X<T, P> = IsExactlyAny<P> extends true ? T : ({ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[/**/K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>)
2+
3+
K
4+
P[K]
5+
K extends keyof T ? T[K] : P[K]
6+
IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]
7+
[K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K];
8+
{ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]; }
9+
{ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>
10+
({ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>)
11+
IsExactlyAny<P> extends true ? T : ({ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>)
12+
type X<T, P> = IsExactlyAny<P> extends true ? T : ({ [K in keyof P]: IsExactlyAny<P[K]> extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick<T, Exclude<keyof T, keyof P>>)
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
class HomePage {
2+
componentDidMount(/**/) {
3+
if (this.props.username) {
4+
return '';
5+
}
6+
}
7+
}
8+
9+
10+
)
11+
12+
13+
componentDidMount() {
14+
if (this.props.username) {
15+
return '';
16+
}
17+
}
18+
19+
20+
21+
••componentDidMount() {
22+
if (this.props.username) {
23+
return '';
24+
}
25+
}↲
26+
27+
28+
class HomePage {
29+
componentDidMount() {
30+
if (this.props.username) {
31+
return '';
32+
}
33+
}
34+
}
35+
36+
================================================================================
37+
38+
class HomePage {
39+
componentDidMount() {
40+
if (this.props.username/**/) {
41+
return '';
42+
}
43+
}
44+
}
45+
46+
47+
)
48+
49+
50+
if (this.props.username) {
51+
return '';
52+
}
53+
54+
55+
56+
••••if (this.props.username) {
57+
return '';
58+
}↲
59+
••
60+
61+
62+
componentDidMount() {
63+
if (this.props.username) {
64+
return '';
65+
}
66+
}
67+
68+
69+
70+
••componentDidMount() {
71+
if (this.props.username) {
72+
return '';
73+
}
74+
}↲
75+
76+
77+
class HomePage {
78+
componentDidMount() {
79+
if (this.props.username) {
80+
return '';
81+
}
82+
}
83+
}
84+
85+
================================================================================
86+
87+
class HomePage {
88+
componentDidMount() {
89+
if (this.props.username) {
90+
return '/**/';
91+
}
92+
}
93+
}
94+
95+
96+
''
97+
98+
99+
return '';
100+
101+
102+
103+
••••••return '';↲
104+
••••
105+
106+
107+
if (this.props.username) {
108+
return '';
109+
}
110+
111+
112+
113+
••••if (this.props.username) {
114+
return '';
115+
}↲
116+
••
117+
118+
119+
componentDidMount() {
120+
if (this.props.username) {
121+
return '';
122+
}
123+
}
124+
125+
126+
127+
••componentDidMount() {
128+
if (this.props.username) {
129+
return '';
130+
}
131+
}↲
132+
133+
134+
class HomePage {
135+
componentDidMount() {
136+
if (this.props.username) {
137+
return '';
138+
}
139+
}
140+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function f(/**/p, q?, ...r: any[] = []) {}
2+
3+
p
4+
p, q?, ...r: any[] = []
5+
function f(p, q?, ...r: any[] = []) {}
6+
7+
================================================================================
8+
9+
function f(p, /**/q?, ...r: any[] = []) {}
10+
11+
q
12+
q?
13+
p, q?, ...r: any[] = []
14+
function f(p, q?, ...r: any[] = []) {}
15+
16+
================================================================================
17+
18+
function f(p, q?, /**/...r: any[] = []) {}
19+
20+
...
21+
...r
22+
...r: any[]
23+
...r: any[] = []
24+
p, q?, ...r: any[] = []
25+
function f(p, q?, ...r: any[] = []) {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function f(
2+
a,
3+
/**/b
4+
) {}
5+
6+
7+
b
8+
9+
10+
11+
••a,
12+
b↲
13+
14+
15+
function f(
16+
a,
17+
b
18+
) {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { /**/x as y, z } from './z';
2+
import { b } from './';
3+
4+
console.log(1);
5+
6+
7+
x
8+
9+
10+
x as y
11+
12+
13+
x as y, z
14+
15+
16+
{ x as y, z }
17+
18+
19+
import { x as y, z } from './z';
20+
21+
22+
import { x as y, z } from './z';
23+
import { b } from './';
24+
25+
26+
import { x as y, z } from './z';
27+
import { b } from './';
28+
29+
console.log(1);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const /**/x = 3;
2+
3+
x
4+
const x = 3;

0 commit comments

Comments
 (0)