SUMMARY Kate seems to issue `textDocument/documentSymbol` requests without checking if the LSP server (asm-lsp in this case) supports this part of the protocol. STEPS TO REPRODUCE 1. Use code: ```nasm section .bss input_char resb 1 ; Reserve 1 byte for the input character ; registers ; r12 num a section .data total dq 0 ; the total sum num dq 0 ; entry integer print_char db 0 section .text global _start is_digit: ; check if value of input_char is a digit cmp byte [input_char], '0' jl not_digit cmp byte [input_char], '9' jg not_digit mov rax, 1 ret not_digit: xor rax, rax; set 0 ret error: mov rax, 60 mov rdi, 1 syscall read_char: ; Read a single character mov rax, 0 ; sys_read mov rdi, 0 ; fd 0 (standard input) mov rsi, input_char ; ptr to input mov rdx, 1 ; number of bytes to read syscall ret sum: add [total], r12 mov r12, 0 ret number_input: call read_char cmp byte [input_char], 10 ; \n je sum cmp byte [input_char], -1 ; EOF je error call is_digit cmp rax, 0 je error call is_digit je append_number append_number: imul r12, 10 sub byte [input_char], '0' ; char to num movzx r13, byte [input_char] ; zero-extend the byte to 64 bits add r12, r13 call number_input ret reverse_number: mov r13, rdi ; r13 = input number xor r14, r14 ; r14 = 0 call reverse_loop mov rax, r14 ret reverse_loop: imul r14, r14, 10 mov rax, r13 xor rdx, rdx mov rcx, 10 div rcx add r14, rdx mov r13, rax cmp r13, 0 jg reverse_loop ; continue loop if r13 > 0 ret print_number: call reverse_number mov r13, rax ; number to print/decrement call print_number_loop ret print_number_loop: ; divide r13 and puts it back with 1 less digit on right mov rax, r13 mov rcx, 10 mov rdx, 0 div rcx mov r13, rax ; print remainder mov [print_char], rdx; add byte [print_char], '0' mov rax, 1 ; sys_write system call number mov rdi, 1 ; file descriptor 1 (stdout) mov rsi, print_char ; pointer to the character mov rdx, 1 ; number of bytes to write syscall cmp r13, 0 jg print_number_loop ; continue loop if r13 > 0 ret _start: call number_input call number_input call sum mov rdi, [total] call print_number mov [print_char], byte 10 ; newline mov rax, 1 mov rdi, 1 mov rsi, print_char mov rdx, 1 syscall mov rax, 60 ; System call number for sys_exit mov rdi, 0 ; Exit code 0 syscall ``` 2. Use asm-lsp (https://github.com/bergercookie/asm-lsp) 3. Open "Output" view using the button in the bottom-left corner OBSERVED RESULT ``` [09:42:51  LSP Client Log] Started server asm-lsp@/home/user: /home/user/.cargo/bin/asm-lsp [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Starting LSP server... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating register set -> x86... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating register set -> x86_64... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating instruction set -> x86... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp::x86_parser] Fetching html page containing further documentation, from the cache -> /home/user/.cache/asm-lsp/x86_instr_docs.html... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating instruction set -> x86_64... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp::x86_parser] Fetching html page containing further documentation, from the cache -> /home/user/.cache/asm-lsp/x86_instr_docs.html... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating register set -> x86... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Populating register set -> x86_64... [09:42:51  LSP Server Log] asm-lsp@/home/user INFO [asm_lsp] Starting LSP loop... [09:42:51  LSP Server Log] asm-lsp@/home/user ERROR [asm_lsp] Invalid request fromat -> Request { id: RequestId( I32( 2, ), ), method: "textDocument/documentSymbol", params: Object { "textDocument": Object { "uri": String("file:///home/user/Programming/ASM/Sum/sum.asm"), }, }, } [09:42:52  LSP Server Log] asm-lsp@/home/user ERROR [asm_lsp] Invalid request fromat -> Request { id: RequestId( I32( 3, ), ), method: "textDocument/documentSymbol", params: Object { "textDocument": Object { "uri": String("file:///home/user/Programming/ASM/Sum/sum.asm"), }, }, } ``` EXPECTED RESULT No unsupported requests SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20231228 KDE Plasma Version: 5.27.10 KDE Frameworks Version: 5.113.0 Qt Version: 5.15.11 Kernel Version: 6.6.7-1-default (64-bit) Graphics Platform: X11 ADDITIONAL INFORMATION Issue on LSP server gitforge: https://github.com/bergercookie/asm-lsp/issues/58
Hi, could you dump the json that the server sends at the start that lists the capabilities? Perhaps we have there some error in checking that.
Hmm, on the other side, we check that, but I fail to see where we then later use documentSymbolProvider.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1581
Git commit d357882415c18df1eecc489c8efadf9f3971a15d by Mark Nauwelaerts. Committed on 15/09/2024 at 09:45. Pushed by cullmann into branch 'master'. lspclient: check for capability before using documentSymbol M +7 -0 addons/lspclient/lspclientsymbolview.cpp https://invent.kde.org/utilities/kate/-/commit/d357882415c18df1eecc489c8efadf9f3971a15d