@@ -112,94 +112,96 @@ contains |
| 112 | 112 | tooltip%active_parameter = param_index |
| 113 | 113 | end subroutine set_active_parameter |
| 114 | 114 | |
| 115 | | - subroutine render_signature_tooltip(tooltip) |
| 116 | | - type(signature_tooltip_t), intent(in) :: tooltip |
| 117 | | - integer :: display_row, sig_idx |
| 118 | | - character(len=512) :: line |
| 119 | | - character(len=256) :: label |
| 120 | | - integer :: param_start, param_end, i |
| 121 | | - |
| 122 | | - if (.not. tooltip%visible .or. tooltip%num_signatures == 0) return |
| 123 | | - |
| 124 | | - sig_idx = tooltip%active_signature |
| 125 | | - if (sig_idx < 1 .or. sig_idx > tooltip%num_signatures) return |
| 126 | | - |
| 127 | | - display_row = tooltip%row |
| 128 | | - |
| 129 | | - ! Draw background |
| 130 | | - call terminal_move_cursor(display_row, tooltip%col) |
| 131 | | - call terminal_write(char(27) // '[48;5;238m') ! Dark background |
| 132 | | - |
| 133 | | - ! Build signature line with parameter highlighting |
| 134 | | - if (allocated(tooltip%signatures(sig_idx)%label)) then |
| 135 | | - label = tooltip%signatures(sig_idx)%label |
| 136 | | - |
| 137 | | - ! If we have parameters, try to highlight the active one |
| 138 | | - if (tooltip%signatures(sig_idx)%num_parameters > 0 .and. & |
| 139 | | - tooltip%active_parameter > 0 .and. & |
| 140 | | - tooltip%active_parameter <= tooltip%signatures(sig_idx)%num_parameters) then |
| 141 | | - |
| 142 | | - ! Get the parameter label to highlight |
| 143 | | - if (allocated(tooltip%signatures(sig_idx)%parameters(tooltip%active_parameter)%label)) then |
| 144 | | - block |
| 145 | | - character(len=:), allocatable :: param_label |
| 146 | | - param_label = tooltip%signatures(sig_idx)%parameters(tooltip%active_parameter)%label |
| 147 | | - |
| 148 | | - ! Find parameter in signature |
| 149 | | - param_start = index(label, trim(param_label)) |
| 150 | | - if (param_start > 0) then |
| 151 | | - param_end = param_start + len_trim(param_label) - 1 |
| 152 | | - |
| 153 | | - ! Build highlighted line |
| 154 | | - line = " " |
| 155 | | - if (param_start > 1) then |
| 156 | | - line = trim(line) // label(1:param_start-1) |
| 157 | | - end if |
| 158 | | - |
| 159 | | - ! Highlight the active parameter |
| 160 | | - line = trim(line) // char(27) // '[1;33m' ! Bold yellow |
| 161 | | - line = trim(line) // label(param_start:param_end) |
| 162 | | - line = trim(line) // char(27) // '[0;48;5;238m' ! Reset to dark bg |
| 163 | | - |
| 164 | | - if (param_end < len_trim(label)) then |
| 165 | | - line = trim(line) // label(param_end+1:len_trim(label)) |
| 166 | | - end if |
| 167 | | - line = trim(line) // " " |
| 168 | | - else |
| 169 | | - ! Couldn't find parameter, show plain |
| 170 | | - line = " " // trim(label) // " " |
| 171 | | - end if |
| 172 | | - end block |
| 173 | | - else |
| 174 | | - line = " " // trim(label) // " " |
| 175 | | - end if |
| 176 | | - else |
| 177 | | - line = " " // trim(label) // " " |
| 178 | | - end if |
| 179 | | - else |
| 180 | | - line = " (no signature) " |
| 181 | | - end if |
| 182 | | - |
| 183 | | - ! Truncate if too long |
| 184 | | - if (len_trim(line) > tooltip%max_width) then |
| 185 | | - line = line(1:tooltip%max_width-3) // "..." |
| 186 | | - end if |
| 187 | | - |
| 188 | | - call terminal_write(trim(line)) |
| 189 | | - |
| 190 | | - ! Show which signature if multiple |
| 191 | | - if (tooltip%num_signatures > 1) then |
| 192 | | - block |
| 193 | | - character(len=20) :: sig_indicator |
| 194 | | - write(sig_indicator, '(A,I0,A,I0,A)') " (", sig_idx, "/", tooltip%num_signatures, ")" |
| 195 | | - call terminal_write(char(27) // '[90m') ! Gray |
| 196 | | - call terminal_write(trim(sig_indicator)) |
| 197 | | - end block |
| 198 | | - end if |
| 199 | | - |
| 200 | | - ! Reset colors |
| 201 | | - call terminal_write(char(27) // '[0m') |
| 202 | | - end subroutine render_signature_tooltip |
| 115 | + ! UNUSED: Render signature tooltip with parameter highlighting |
| 116 | + ! Kept for potential future use |
| 117 | + ! subroutine render_signature_tooltip(tooltip) |
| 118 | + ! type(signature_tooltip_t), intent(in) :: tooltip |
| 119 | + ! integer :: display_row, sig_idx |
| 120 | + ! character(len=512) :: line |
| 121 | + ! character(len=256) :: label |
| 122 | + ! integer :: param_start, param_end, i |
| 123 | + ! |
| 124 | + ! if (.not. tooltip%visible .or. tooltip%num_signatures == 0) return |
| 125 | + ! |
| 126 | + ! sig_idx = tooltip%active_signature |
| 127 | + ! if (sig_idx < 1 .or. sig_idx > tooltip%num_signatures) return |
| 128 | + ! |
| 129 | + ! display_row = tooltip%row |
| 130 | + ! |
| 131 | + ! ! Draw background |
| 132 | + ! call terminal_move_cursor(display_row, tooltip%col) |
| 133 | + ! call terminal_write(char(27) // '[48;5;238m') ! Dark background |
| 134 | + ! |
| 135 | + ! ! Build signature line with parameter highlighting |
| 136 | + ! if (allocated(tooltip%signatures(sig_idx)%label)) then |
| 137 | + ! label = tooltip%signatures(sig_idx)%label |
| 138 | + ! |
| 139 | + ! ! If we have parameters, try to highlight the active one |
| 140 | + ! if (tooltip%signatures(sig_idx)%num_parameters > 0 .and. & |
| 141 | + ! tooltip%active_parameter > 0 .and. & |
| 142 | + ! tooltip%active_parameter <= tooltip%signatures(sig_idx)%num_parameters) then |
| 143 | + ! |
| 144 | + ! ! Get the parameter label to highlight |
| 145 | + ! if (allocated(tooltip%signatures(sig_idx)%parameters(tooltip%active_parameter)%label)) then |
| 146 | + ! block |
| 147 | + ! character(len=:), allocatable :: param_label |
| 148 | + ! param_label = tooltip%signatures(sig_idx)%parameters(tooltip%active_parameter)%label |
| 149 | + ! |
| 150 | + ! ! Find parameter in signature |
| 151 | + ! param_start = index(label, trim(param_label)) |
| 152 | + ! if (param_start > 0) then |
| 153 | + ! param_end = param_start + len_trim(param_label) - 1 |
| 154 | + ! |
| 155 | + ! ! Build highlighted line |
| 156 | + ! line = " " |
| 157 | + ! if (param_start > 1) then |
| 158 | + ! line = trim(line) // label(1:param_start-1) |
| 159 | + ! end if |
| 160 | + ! |
| 161 | + ! ! Highlight the active parameter |
| 162 | + ! line = trim(line) // char(27) // '[1;33m' ! Bold yellow |
| 163 | + ! line = trim(line) // label(param_start:param_end) |
| 164 | + ! line = trim(line) // char(27) // '[0;48;5;238m' ! Reset to dark bg |
| 165 | + ! |
| 166 | + ! if (param_end < len_trim(label)) then |
| 167 | + ! line = trim(line) // label(param_end+1:len_trim(label)) |
| 168 | + ! end if |
| 169 | + ! line = trim(line) // " " |
| 170 | + ! else |
| 171 | + ! ! Couldn't find parameter, show plain |
| 172 | + ! line = " " // trim(label) // " " |
| 173 | + ! end if |
| 174 | + ! end block |
| 175 | + ! else |
| 176 | + ! line = " " // trim(label) // " " |
| 177 | + ! end if |
| 178 | + ! else |
| 179 | + ! line = " " // trim(label) // " " |
| 180 | + ! end if |
| 181 | + ! else |
| 182 | + ! line = " (no signature) " |
| 183 | + ! end if |
| 184 | + ! |
| 185 | + ! ! Truncate if too long |
| 186 | + ! if (len_trim(line) > tooltip%max_width) then |
| 187 | + ! line = line(1:tooltip%max_width-3) // "..." |
| 188 | + ! end if |
| 189 | + ! |
| 190 | + ! call terminal_write(trim(line)) |
| 191 | + ! |
| 192 | + ! ! Show which signature if multiple |
| 193 | + ! if (tooltip%num_signatures > 1) then |
| 194 | + ! block |
| 195 | + ! character(len=20) :: sig_indicator |
| 196 | + ! write(sig_indicator, '(A,I0,A,I0,A)') " (", sig_idx, "/", tooltip%num_signatures, ")" |
| 197 | + ! call terminal_write(char(27) // '[90m') ! Gray |
| 198 | + ! call terminal_write(trim(sig_indicator)) |
| 199 | + ! end block |
| 200 | + ! end if |
| 201 | + ! |
| 202 | + ! ! Reset colors |
| 203 | + ! call terminal_write(char(27) // '[0m') |
| 204 | + ! end subroutine render_signature_tooltip |
| 203 | 205 | |
| 204 | 206 | subroutine handle_signature_response(tooltip, response) |
| 205 | 207 | use lsp_protocol_module, only: lsp_message_t |