diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-02 16:20:49 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-02 16:21:14 -0400 |
| commit | 7833e12e93837d0422960a7b0e445ad9b7c0be7a (patch) | |
| tree | dec2ec0da6af0b91aa09f675b482e5b2800c51f5 /src/server | |
| parent | bbdb5c78cc303638d525837088fca831e05e72a6 (diff) | |
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] } |