diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-07-03 00:13:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-03 00:13:03 +0200 |
| commit | 893a1e77339c6f7e2ff4bcc286e67c1bf00447fe (patch) | |
| tree | dec2ec0da6af0b91aa09f675b482e5b2800c51f5 /src/server | |
| parent | b0b90650da58cc20c560778634cf5af02fd2cd56 (diff) | |
| parent | 7833e12e93837d0422960a7b0e445ad9b7c0be7a (diff) | |
Merge pull request #708 from BradLewis/fix/completion-label-details
String split n returns up to n elements
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/completion.odin | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index 0bf9b25..6a172ef 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -2035,19 +2035,19 @@ format_to_label_details :: proc(list: ^CompletionList) { comment := "" proc_info := "" detail_split := strings.split_n(item.detail, "\n", 2) - if detail_split[1] == "" { + if len(detail_split) == 1 { // We have no comment proc_info = detail_split[0] - } else { + } else if len(detail_split) == 2 { comment = detail_split[0] proc_info = detail_split[1] } // Split the leading name of the proc proc_info_split := strings.split_n(proc_info, " ", 2) - if proc_info_split[1] == "" { + if len(proc_info_split) == 1 { // We have no leading package.Name for the proc proc_info = proc_info_split[0] - } else { + } else if len(proc_info_split) == 2 { proc_info = proc_info_split[1] } |