https://bugs.kde.org/show_bug.cgi?id=447640

--- Comment #3 from Juris <juris788999...@outlook.com> ---
(In reply to Juris from comment #2)
> I can confirm this. Basically Organize Imports functionality does not seem
> to work in LSP Client. This is interesting since enabling trace log for
> gopls shows response from LSP server side:
> 
> --- 8< ---
> [Trace - 18:28:12.986 PM] Sending request 'textDocument/rename - (8)'.
> Params: {
>         "newName": "myFunctionNew",
>         "position": {
>             "character": 8,
>             "line": 3
>         },
>         "textDocument": {
>             "uri": "file:///tmp/goproj/main.go"
>         }
>     }
> 
> 
> [Trace - 18:28:12.987 PM] Received response 'textDocument/rename - (8)' in
> 0ms.
> Result:
> {"documentChanges":[{"textDocument":{"version":115,"uri":"file:///tmp/goproj/
> main.go"},"edits":[{"range":{"start":{"line":3,"character":4},"end":{"line":
> 3,"character":14}},"newText":"myFunctionNew"},{"range":{"start":{"line":6,
> "character":3},"end":{"line":6,"character":13}},"newText":"myFunctionNew"},
> {"range":{"start":{"line":7,"character":5},"end":{"line":7,"character":15}},
> "newText":"myFunctionNew"}]}]}
> --- 8< ---
> 
> Example main.go file, trying to rename myFunction:
> 
> --- 8< ---
> package main
> 
> func main() {
>     myFunction()
> }
> 
> // myFunction is just a dummy function
> func myFunction() {
>     return
> }
> --- 8< ---
> 
> 
> 
> 
> Kate Version 21.12.1
> gopls 0.7.4
> 
> Operating System: Arch Linux
> KDE Plasma Version: 5.23.5
> KDE Frameworks Version: 5.90.0
> Qt Version: 5.15.2
> Kernel Version: 5.16.2-arch1-1 (64-bit)
> Graphics Platform: Wayland
> Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
> Memory: 13,6 GiB of RAM
> Graphics Processor: AMD RENOIR

Sorry, got a mixup. Examples above were for LSP rename functionality (which
also does not work, probably a separate bug). Proper example for broken
Organize imports follows:

main.go:

package main

func main() {
        fmt.Println("xxxx")
}



Trace logs from gopls:

[Trace - 18:32:58.402 PM] Sending request 'textDocument/codeAction - (3)'.
Params: {
        "context": {
            "diagnostics": [
            ]
        },
        "range": {
            "end": {
                "character": 0,
                "line": 4
            },
            "start": {
                "character": 0,
                "line": 3
            }
        },
        "textDocument": {
            "uri": "file:///tmp/goproj/main.go"
        }
    }


[Trace - 18:32:58.405 PM] Received response 'textDocument/codeAction - (3)' in
2ms.
Result: [{"title":"Organize
Imports","kind":"source.organizeImports","edit":{"documentChanges":[{"textDocument":{"version":147,"uri":"file:///tmp/goproj/main.go"},"edits":[{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":0}},"newText":"\nimport
\"fmt\"\n"}]}]}}]

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to