diff options
author | pommicket <pommicket@gmail.com> | 2023-01-03 18:03:00 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-03 18:03:00 -0500 |
commit | a648291509aa3b0f91a4b3032b780f1f688379d2 (patch) | |
tree | 9274e1fbb00d5c3b7e13965c9a77ce6a03e492b9 | |
parent | c0397f1f4c80e73a2e4ccd1946703fe6a5bb405e (diff) |
sort go-to-definition entries by detail after name
-rw-r--r-- | ide-definitions.c | 8 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ide-definitions.c b/ide-definitions.c index 7175e08..185a270 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -113,7 +113,13 @@ static int definition_entry_qsort_cmp(const void *av, const void *bv) { if (a_len < b_len) return -1; if (a_len > b_len) return 1; // then sort alphabetically - return strcmp(a->name, b->name); + int cmp = strcmp(a->name, b->name); + if (cmp) return cmp; + // then sort by detail + if (!a->detail && b->detail) return -1; + if (a->detail && !b->detail) return 1; + if (!a->detail && !b->detail) return 0; + return strcmp(a->detail, b->detail); } // put the entries matching the search term into the selector. @@ -2,6 +2,7 @@ @TODO: - fix problem where LSP_REQUEST_DEFINITION tag isn't being found - ted.h documentation +- don't start up separate clangd servers for C and C++ - handle multiple symbols with same name in go-to-definition menu - better non-error window/showMessage(Request) - document lsp.h and lsp.c. |