mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +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 {
|
std::string lsPosition::ToString() const {
|
||||||
return std::to_string(line) + ":" + std::to_string(character);
|
return std::to_string(line) + ":" + std::to_string(character);
|
||||||
}
|
}
|
||||||
|
const lsPosition lsPosition::kZeroPosition = lsPosition();
|
||||||
|
|
||||||
lsRange::lsRange() {}
|
lsRange::lsRange() {}
|
||||||
lsRange::lsRange(lsPosition start, lsPosition end) : start(start), end(end) {}
|
lsRange::lsRange(lsPosition start, lsPosition end) : start(start), end(end) {}
|
||||||
|
@ -148,6 +148,7 @@ struct lsPosition {
|
|||||||
// Note: these are 0-based.
|
// Note: these are 0-based.
|
||||||
int line = 0;
|
int line = 0;
|
||||||
int character = 0;
|
int character = 0;
|
||||||
|
static const lsPosition kZeroPosition;
|
||||||
};
|
};
|
||||||
MAKE_HASHABLE(lsPosition, t.line, t.character);
|
MAKE_HASHABLE(lsPosition, t.line, t.character);
|
||||||
MAKE_REFLECT_STRUCT(lsPosition, line, 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;
|
// std::cerr << "|" << file->buffer_content << "|" << std::endl;
|
||||||
// Per the spec replace everything if the rangeLength and range are not set.
|
// Per the spec replace everything if the rangeLength and range are not set.
|
||||||
// See https://github.com/Microsoft/language-server-protocol/issues/9.
|
// See https://github.com/Microsoft/language-server-protocol/issues/9.
|
||||||
auto zeroPosition = lsPosition(0, 0);
|
if (diff.rangeLength == -1 && diff.range.start == lsPosition::kZeroPosition
|
||||||
if (diff.rangeLength == -1 && diff.range.start == zeroPosition
|
&& diff.range.end == lsPosition::kZeroPosition) {
|
||||||
&& diff.range.end == zeroPosition) {
|
|
||||||
file->buffer_content = diff.text;
|
file->buffer_content = diff.text;
|
||||||
file->OnBufferContentUpdated();
|
file->OnBufferContentUpdated();
|
||||||
// std::cerr << "-> Replacing entire content";
|
// std::cerr << "-> Replacing entire content";
|
||||||
|
Loading…
Reference in New Issue
Block a user