Commit 5681cfa
[analysis_server] Provide better values for active parameters in signature help
We were previously using a -1 because we don't support this, but it turns out the LSP spec changed from "number" to "uinteger" in v3.16, meaning -1 would violate some assumptions clients made.
For the case where we don't have a value, we now just use the `length` of the `parameters` list (eg. the first invalid value, which is valid according to the spec and can indicate to the client that there is no active parameter*), however I thought we could also do better by providing values for some cases (named params that we can match up, and positional params by counting only the positional params+args and matching them up).
\* The spec says clients can treat out-of-range values as 0, however VS Code doesn't highlight any parameters in that case, which is better IMO.
Fixes #58577
Change-Id: I1de7b0eaacf06aac7e302ae9095342f4e4d7a466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396840
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>1 parent f331924 commit 5681cfa
File tree
7 files changed
+520
-178
lines changed- pkg/analysis_server
- lib/src
- cider
- computer
- handler/legacy
- lsp
- handlers
- test/lsp
7 files changed
+520
-178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
Lines changed: 100 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 29 | + | |
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
40 | 37 | | |
41 | 38 | | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
81 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
82 | 105 | | |
83 | 106 | | |
84 | 107 | | |
85 | 108 | | |
86 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
87 | 174 | | |
88 | 175 | | |
89 | | - | |
| 176 | + | |
90 | 177 | | |
91 | 178 | | |
92 | 179 | | |
| |||
105 | 192 | | |
106 | 193 | | |
107 | 194 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 195 | | |
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
110 | 108 | | |
111 | 109 | | |
112 | | - | |
| 110 | + | |
113 | 111 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
525 | 526 | | |
526 | 527 | | |
527 | 528 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 529 | + | |
533 | 530 | | |
534 | 531 | | |
535 | 532 | | |
| |||
1519 | 1516 | | |
1520 | 1517 | | |
1521 | 1518 | | |
1522 | | - | |
| 1519 | + | |
1523 | 1520 | | |
1524 | 1521 | | |
1525 | 1522 | | |
1526 | 1523 | | |
1527 | 1524 | | |
1528 | 1525 | | |
1529 | 1526 | | |
1530 | | - | |
1531 | | - | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
1535 | 1532 | | |
1536 | 1533 | | |
1537 | 1534 | | |
1538 | 1535 | | |
1539 | | - | |
| 1536 | + | |
1540 | 1537 | | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
| 1538 | + | |
1544 | 1539 | | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
1552 | | - | |
1553 | | - | |
1554 | | - | |
1555 | | - | |
| 1540 | + | |
| 1541 | + | |
1556 | 1542 | | |
1557 | 1543 | | |
1558 | 1544 | | |
| |||
1566 | 1552 | | |
1567 | 1553 | | |
1568 | 1554 | | |
1569 | | - | |
| 1555 | + | |
1570 | 1556 | | |
1571 | 1557 | | |
1572 | 1558 | | |
| |||
1588 | 1574 | | |
1589 | 1575 | | |
1590 | 1576 | | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
1596 | | - | |
1597 | | - | |
1598 | | - | |
1599 | | - | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
1600 | 1586 | | |
1601 | 1587 | | |
1602 | 1588 | | |
| |||
0 commit comments