mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Respond to comment
This commit is contained in:
parent
3341b1f13d
commit
750cc4ea30
@ -273,6 +273,7 @@ bool lsPosition::operator==(const lsPosition& other) const {
|
||||
std::string lsPosition::ToString() const {
|
||||
return std::to_string(line) + ":" + std::to_string(character);
|
||||
}
|
||||
const lsPosition lsPosition::kZeroPosition = lsPosition();
|
||||
|
||||
lsRange::lsRange() {}
|
||||
lsRange::lsRange(lsPosition start, lsPosition end) : start(start), end(end) {}
|
||||
|
@ -148,6 +148,7 @@ struct lsPosition {
|
||||
// Note: these are 0-based.
|
||||
int line = 0;
|
||||
int character = 0;
|
||||
static const lsPosition kZeroPosition;
|
||||
};
|
||||
MAKE_HASHABLE(lsPosition, t.line, t.character);
|
||||
MAKE_REFLECT_STRUCT(lsPosition, line, character);
|
||||
|
@ -329,9 +329,8 @@ void WorkingFiles::OnChange(const Ipc_TextDocumentDidChange::Params& change) {
|
||||
// std::cerr << "|" << file->buffer_content << "|" << std::endl;
|
||||
// Per the spec replace everything if the rangeLength and range are not set.
|
||||
// See https://github.com/Microsoft/language-server-protocol/issues/9.
|
||||
auto zeroPosition = lsPosition(0, 0);
|
||||
if (diff.rangeLength == -1 && diff.range.start == zeroPosition
|
||||
&& diff.range.end == zeroPosition) {
|
||||
if (diff.rangeLength == -1 && diff.range.start == lsPosition::kZeroPosition
|
||||
&& diff.range.end == lsPosition::kZeroPosition) {
|
||||
file->buffer_content = diff.text;
|
||||
file->OnBufferContentUpdated();
|
||||
// std::cerr << "-> Replacing entire content";
|
||||
|
Loading…
Reference in New Issue
Block a user