Changeset View
Changeset View
Standalone View
Standalone View
clangd/Protocol.h
Show First 20 Lines • Show All 590 Lines • ▼ Show 20 Line(s) | 586 | struct RenameParams { | |||
---|---|---|---|---|---|
591 | Position position; | 591 | Position position; | ||
592 | 592 | | |||
593 | /// The new name of the symbol. | 593 | /// The new name of the symbol. | ||
594 | std::string newName; | 594 | std::string newName; | ||
595 | 595 | | |||
596 | static llvm::Optional<RenameParams> parse(const json::Expr &Params); | 596 | static llvm::Optional<RenameParams> parse(const json::Expr &Params); | ||
597 | }; | 597 | }; | ||
598 | 598 | | |||
599 | enum class DocumentHighlightKind { Text = 1, Read = 2, Write = 3 }; | ||||
600 | | ||||
601 | /** | ||||
malaperle: Use /// like other structs | |||||
Done ReplyNIT: remove this empty comment line and all the others. ilya-biryukov: NIT: remove this empty comment line and all the others. | |||||
602 | * A document highlight is a range inside a text document which deserves | ||||
603 | * special attention. Usually a document highlight is visualized by changing | ||||
604 | * the background color of its range. | ||||
605 | * | ||||
606 | */ | ||||
607 | struct DocumentHighlight { | ||||
Not Done ReplyUse /// like other places malaperle: Use /// like other places | |||||
608 | /* | ||||
609 | * | ||||
610 | * The range this highlight applies to. | ||||
611 | */ | ||||
Done ReplyThere seems to be a missing brace before {. I generally run this simple script before submission to make sure my code is always formatted: find "$CLANG_TOOLS_EXTRA_PATH/clangd" -name "*.cpp" -or -name "*.h" -exec clang-format -i --style=LLVM {} \; find "$CLANG_TOOLS_EXTRA_PATH/unittests/clangd" -name "*.cpp" -or -name "*.h" -exec clang-format -i --style=LLVM {} \ ; ilya-biryukov: There seems to be a missing brace before `{`. I generally run this simple script before… | |||||
Not Done ReplyBTW, the script had an error. (missing some parens) find "$CLANG_TOOLS_EXTRA_PATH/clangd" \( -name "*.cpp" -or -name "*.h" \) -exec clang-format -i --style=LLVM {} \; find "$CLANG_TOOLS_EXTRA_PATH/unittests/clangd" \( -name "*.cpp" -or -name "*.h" \) -exec clang-format -i --style=LLVM {} \ ; ilya-biryukov: BTW, the script had an error. (missing some parens)
```
find "$CLANG_TOOLS_EXTRA_PATH/clangd" \… | |||||
612 | Range range; | ||||
613 | | ||||
614 | /** | ||||
Not Done ReplyUse /// like other places malaperle: Use /// like other places | |||||
615 | * The highlight kind, default is DocumentHighlightKind.Text. | ||||
616 | */ | ||||
617 | DocumentHighlightKind kind = DocumentHighlightKind::Text; | ||||
618 | | ||||
Done Replyremove malaperle: remove | |||||
619 | friend bool operator<(const DocumentHighlight &LHS, | ||||
620 | const DocumentHighlight &RHS) { | ||||
Done Replyneeded? malaperle: needed? | |||||
Done ReplyThis comparison does not provide a total order. ilya-biryukov: This comparison does not provide a total order.
Please use `std::tie(LHS.range, int(LHS.kind))… | |||||
621 | return std::tie(LHS.range) < std::tie(RHS.range) && std::tie(LHS.kind) < std::tie(RHS.kind); | ||||
Not Done ReplyPlease also compare kind here, to make this operator consistent with operator==. ilya-biryukov: Please also compare `kind` here, to make this operator consistent with `operator==`.
`std::tie… | |||||
622 | } | ||||
623 | | ||||
624 | friend bool operator==(const DocumentHighlight &LHS, | ||||
625 | const DocumentHighlight &RHS) { | ||||
626 | return LHS.kind == RHS.kind && LHS.range == RHS.range; | ||||
627 | } | ||||
628 | | ||||
629 | static json::Expr unparse(const DocumentHighlight &DH); | ||||
630 | }; | ||||
599 | } // namespace clangd | 631 | } // namespace clangd | ||
600 | } // namespace clang | 632 | } // namespace clang | ||
601 | 633 | | |||
602 | #endif | 634 | #endif |
Use /// like other structs