mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 20:12:33 +00:00
Fix vscode complaining about overlapping text edits for rename
This commit is contained in:
parent
1fcefb5262
commit
bdd433abd4
@ -678,7 +678,11 @@ lsWorkspaceEdit BuildWorkspaceEdit(QueryDatabase* db, WorkingFiles* working_file
|
|||||||
lsTextEdit edit;
|
lsTextEdit edit;
|
||||||
edit.range = ls_location->range;
|
edit.range = ls_location->range;
|
||||||
edit.newText = new_text;
|
edit.newText = new_text;
|
||||||
path_to_edit[location.path].edits.push_back(edit);
|
|
||||||
|
// vscode complains if we submit overlapping text edits.
|
||||||
|
auto& edits = path_to_edit[location.path].edits;
|
||||||
|
if (std::find(edits.begin(), edits.end(), edit) == edits.end())
|
||||||
|
edits.push_back(edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,8 +205,6 @@ struct IndexedTypeDef {
|
|||||||
std::vector<IndexTypeId> derived;
|
std::vector<IndexTypeId> derived;
|
||||||
|
|
||||||
// Declared variables of this type.
|
// Declared variables of this type.
|
||||||
// TODO: this needs a lot more work and lots of tests.
|
|
||||||
// TODO: add instantiation on ctor / dtor, do not add instantiation if type is ptr
|
|
||||||
std::vector<IndexVarId> instantiations;
|
std::vector<IndexVarId> instantiations;
|
||||||
|
|
||||||
// Every usage, useful for things like renames.
|
// Every usage, useful for things like renames.
|
||||||
|
@ -197,6 +197,10 @@ bool lsLocation::operator==(const lsLocation& other) const {
|
|||||||
return uri == other.uri && range == other.range;
|
return uri == other.uri && range == other.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lsTextEdit::operator==(const lsTextEdit& that) {
|
||||||
|
return range == that.range && newText == that.newText;
|
||||||
|
}
|
||||||
|
|
||||||
void Reflect(Reader& reader, lsInitializeParams::lsTrace& value) {
|
void Reflect(Reader& reader, lsInitializeParams::lsTrace& value) {
|
||||||
std::string v = reader.GetString();
|
std::string v = reader.GetString();
|
||||||
if (v == "off")
|
if (v == "off")
|
||||||
|
@ -506,6 +506,8 @@ struct lsTextEdit {
|
|||||||
// The string to be inserted. For delete operations use an
|
// The string to be inserted. For delete operations use an
|
||||||
// empty string.
|
// empty string.
|
||||||
std::string newText;
|
std::string newText;
|
||||||
|
|
||||||
|
bool operator==(const lsTextEdit& that);
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(lsTextEdit, range, newText);
|
MAKE_REFLECT_STRUCT(lsTextEdit, range, newText);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user