Commit 693d7fe
committed
gopls/internal/settings: simplify SetOptions
This change simplifies the SetOptions machinery by
eliminating the (public) OptionsResult and Options
types and their methods, and using simpler standalone
functions of these forms:
setT(dest *T, value any) error
asT(value any) (T, error)
The code is clearer and significantly shorter.
Details:
- rename SetOptions to Options.Set.
- return only the errors, not the OptionsResults;
server.handleOptionResult renamed handleOptionErrors.
- remove error result from server.handleOptionResult,
per preexisting TODO.
- add missing doc comments.
- use JSON terminology in error messages.
Note, minor behavior changes:
- the buildFlags and directoryFilters flags now use
asStringSlice (per the preexisting TODO), and also
templateExtensions, but this replaces Sprint(x)
with asString(x), which is strictly speaking an
incompatible change.
Change-Id: Ib2169ba8e1db1a34e9bc269e6e8cef3a6763e6e6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592536
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>1 parent 977f6f7 commit 693d7fe
File tree
5 files changed
+298
-339
lines changed- gopls/internal
- cache
- server
- settings
- test/integration/watch
5 files changed
+298
-339
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 339 | + | |
| 340 | + | |
344 | 341 | | |
345 | 342 | | |
346 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
| 72 | + | |
74 | 73 | | |
75 | 74 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 75 | + | |
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
| |||
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 85 | + | |
93 | 86 | | |
94 | 87 | | |
95 | 88 | | |
| |||
510 | 503 | | |
511 | 504 | | |
512 | 505 | | |
513 | | - | |
514 | | - | |
515 | | - | |
| 506 | + | |
516 | 507 | | |
517 | 508 | | |
518 | 509 | | |
519 | 510 | | |
520 | | - | |
| 511 | + | |
521 | 512 | | |
522 | 513 | | |
523 | 514 | | |
524 | | - | |
| 515 | + | |
525 | 516 | | |
526 | 517 | | |
527 | | - | |
528 | 518 | | |
529 | 519 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
540 | 530 | | |
541 | 531 | | |
542 | 532 | | |
| |||
548 | 538 | | |
549 | 539 | | |
550 | 540 | | |
551 | | - | |
| 541 | + | |
552 | 542 | | |
553 | | - | |
554 | | - | |
| 543 | + | |
| 544 | + | |
555 | 545 | | |
556 | 546 | | |
557 | 547 | | |
| |||
565 | 555 | | |
566 | 556 | | |
567 | 557 | | |
568 | | - | |
| 558 | + | |
569 | 559 | | |
570 | | - | |
571 | | - | |
572 | 560 | | |
573 | 561 | | |
574 | 562 | | |
| |||
0 commit comments