lsp-sourcekit icon indicating copy to clipboard operation
lsp-sourcekit copied to clipboard

completion stops working after error

Open wibed opened this issue 4 years ago • 3 comments

i have made the experience that after opening a .swift file and setting the project's root dir i get successful completion

but after one interrupts the completion by keep typing an error occurs, and no more completion after that. ~~I suspect it is because sourcekit-lsp crashed~~

swift version: 5.4.2

lsp error message:

# Table of Contents
2021-07-19 08:11:59.454 sourcekit-lsp[62:ef66e700] triggerFromIncompleteCompletions with incompatible completion session; expected DocumentURI(storage: <file:///work/cards/service/api/Sources/api/User/ControllerUser.swift>)@1215, but got DocumentURI(storage: <file:///work/cards/service/api/Sources/api/User/ControllerUser.swift>)@1224

company error message:

Company: An error occurred in auto-begin
Company: backend (company-capf :with company-yasnippet) error &ldquo;request cancelled&rdquo; with args (candidates fun)

second lsp error message:

2021-07-19 11:00:04.025 sourcekit-lsp[82:8ffff700] error response (Request Failed): codecomplete.open: code completion session for &rsquo;/work/cards/service/api/Sources/api/User/Controller+User.swift&rsquo;, 1166 already exists

backtrace:

stacktrace:

  • 1
  • the second got too long to post

after installing a missing dependency libpython2.7 the error still persists. namely that the lsp server becomes unresponsive.and completion stops working

additionally i tried:

  • successfully build the project before provoking the error
  • built sourcekit-lsp from source
  • downgraded swift to 5.4
  • used no included framework vanilla swift from swift package init

it seems the trace shows nothing but the empty response from the sourcekit-lsp server. the error messages differ only from the DocumentURI (which is the same for expected and for received) and the char number @1151 (which differs between expected and received).

wibed avatar Jul 19 '21 08:07 wibed

i started over and created a clean reproduction of the error:

i am typing func for function check the popup and select the "func" option.

after the selection from the menu starts a snippet out of the full stacktrace

https://termbin.com/kwyw

in the snippet i type in the function name "hello", followed by the parentheses. as first argument i intent to write out "name", but at the second char ("na") the error pops off.

in the end it looks like this:

func hello(na)
            ^ -->> Error pops off after typing "a"

i included a follow up request for code completion, including context, in the stacktrace and the empty response thereafter.

it seems after the return message "request cancelled" with the code "-32800" the process sourcekit-lsp only provides empty responses.

this is accredited with the following error message out of stderr

2021-07-21 02:46:22.001 sourcekit-lsp[47:a15a5700] triggerFromIncompleteCompletions with incompatible completion session; expected DocumentURI(storage: \url{file:///work/cards/service/test/Sources/test/main.swift})@29, but got DocumentURI(storage: \url{file:///work/cards/service/test/Sources/test/main.swift})@35

the full stacktrace is to be found here: https://termbin.com/0x2n

wibed avatar Jul 21 '21 03:07 wibed

my assumption grows the responsibility relies on the client side for this behavior. here is a backtrace: https://termbin.com/5dkr

wibed avatar Aug 02 '21 06:08 wibed

opened an issue on lsp-mode https://github.com/emacs-lsp/lsp-mode/issues/3028

wibed avatar Aug 04 '21 03:08 wibed