Commit 8256bda
Intern comments in JSX identifiers
Summary:
Interns leading and trailing comments around JSX identifiers, just like leading and trailing comments are interned in non-jsx identifiers.
This gets us comment attachment in JSX element names:
```
</* L id */ div /* T id */>
test
</ /*L id */ div /* T id */>
```
And around the names of JSX attributes:
```
<div
/* L id */ name /* T id */ ="value"
/* L id */ name2 /* T id */
/>
```
However note that it is ambiguous whether a comment between the tag name and the first attribute name should be attached as a trailing comment of the name or a leading comment of the first attribute name. (The same is true of adjacent attributes without values). This will be fixed in the future once we have an API for eating portions of comments, as this same problem appears for the trailing comments on statements.
Reviewed By: pieterv
Differential Revision: D20315238
fbshipit-source-id: 728a629398686123e5f998a154fff81077d655211 parent 96fac34 commit 8256bda
File tree
23 files changed
+564
-75
lines changed- src
- common
- parser_utils
- __tests__
- output
- parser
- test/flow/comment_interning
- services
- autocomplete
- get_def
- typing
23 files changed
+564
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1176 | 1176 | | |
1177 | 1177 | | |
1178 | 1178 | | |
1179 | | - | |
| 1179 | + | |
1180 | 1180 | | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | | - | |
1184 | | - | |
| 1183 | + | |
| 1184 | + | |
1185 | 1185 | | |
1186 | 1186 | | |
1187 | 1187 | | |
1188 | 1188 | | |
1189 | 1189 | | |
1190 | 1190 | | |
1191 | | - | |
1192 | | - | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
1193 | 1194 | | |
1194 | 1195 | | |
1195 | 1196 | | |
1196 | 1197 | | |
1197 | 1198 | | |
1198 | | - | |
| 1199 | + | |
1199 | 1200 | | |
1200 | 1201 | | |
1201 | 1202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1568 | 1568 | | |
1569 | 1569 | | |
1570 | 1570 | | |
1571 | | - | |
1572 | | - | |
| 1571 | + | |
| 1572 | + | |
1573 | 1573 | | |
1574 | 1574 | | |
1575 | 1575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
1222 | | - | |
| 1222 | + | |
1223 | 1223 | | |
1224 | | - | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1225 | 1229 | | |
1226 | 1230 | | |
1227 | 1231 | | |
1228 | | - | |
| 1232 | + | |
1229 | 1233 | | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1233 | 1237 | | |
1234 | 1238 | | |
1235 | 1239 | | |
| |||
1255 | 1259 | | |
1256 | 1260 | | |
1257 | 1261 | | |
1258 | | - | |
| 1262 | + | |
1259 | 1263 | | |
1260 | 1264 | | |
1261 | 1265 | | |
| |||
1279 | 1283 | | |
1280 | 1284 | | |
1281 | 1285 | | |
1282 | | - | |
| 1286 | + | |
1283 | 1287 | | |
1284 | 1288 | | |
1285 | 1289 | | |
1286 | 1290 | | |
1287 | | - | |
| 1291 | + | |
1288 | 1292 | | |
1289 | 1293 | | |
1290 | 1294 | | |
1291 | 1295 | | |
1292 | 1296 | | |
1293 | | - | |
| 1297 | + | |
1294 | 1298 | | |
1295 | 1299 | | |
1296 | 1300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
309 | | - | |
| 311 | + | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments