summaryrefslogtreecommitdiff
path: root/lsp.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-03-03 18:01:34 -0500
committerpommicket <pommicket@gmail.com>2023-03-03 18:01:34 -0500
commitfb342182983ffdb0aae0497f5cbcb71b0b291023 (patch)
tree31fdc46c095fb7fe2d8f8f0d21f1d3a310fc1afc /lsp.c
parentfb342637d3b2553daf4659967f35e8e26bd26eb1 (diff)
different read/write colors for ide-highlights
Diffstat (limited to 'lsp.c')
-rw-r--r--lsp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lsp.c b/lsp.c
index 9761049..c50ecc1 100644
--- a/lsp.c
+++ b/lsp.c
@@ -654,10 +654,30 @@ void lsp_document_changed(LSP *lsp, const char *document, LSPDocumentChangeEvent
lsp_send_request(lsp, &request);
}
+int lsp_position_cmp(LSPPosition a, LSPPosition b) {
+ if (a.line < b.line)
+ return -1;
+ if (a.line > b.line)
+ return 1;
+ if (a.character < b.character)
+ return -1;
+ if (a.character > b.character)
+ return 1;
+ return 0;
+}
+
bool lsp_position_eq(LSPPosition a, LSPPosition b) {
return a.line == b.line && a.character == b.character;
}
+bool lsp_ranges_overlap(LSPRange a, LSPRange b) {
+ if (lsp_position_cmp(a.end, b.start) <= 0)
+ return false;
+ if (lsp_position_cmp(b.end, a.start) <= 0)
+ return false;
+ return true;
+}
+
bool lsp_document_position_eq(LSPDocumentPosition a, LSPDocumentPosition b) {
return a.document == b.document && lsp_position_eq(a.pos, b.pos);
}