Autocompletion fails on 2019.03.04 toolchain

I'm trying to use sourcekit-lsp with Sublime and it's works wine, except one: On the subj toolchain it fails to provide any autocompletion with the error: server: error response (Request Cancelled): .

In the same time Jump to definition and Find References action works fine.

Does this issue go away sometimes if you reopen the project? If so, I think you may be seeing the following bug in the LSP plugin for Sublime: Completion followed by a quick space stops completions from working · Issue #510 · sublimelsp/LSP · GitHub

This issue has been fixed upstream, but no release of the plugin contains this fix yet. If you want to try the latest master version of that plugin, there are instructions at GitHub - sublimelsp/LSP: Client implementation of the Language Server Protocol for Sublime Text, but I'm not sure how stable it is.

1 Like

Unfortunately no.

The issue starts right today with the both changing toolchain from 12.02.19 to 04.03.19 and changing default sublime swift syntax theme. I’d tried to restart Sublime, but this doesn’t fix the issue now (previously were).

Also I’d open some python project to check is it broken everywhere and in python project completion works well, but not in the swift one.

In your LSP preferences in Sublime, could you enable:

"log_debug": true,
"log_stderr": true,

And reproduce the issue, then open the Sublime console (CTRL+`) and send the log output?

Tomorrow I’ll post full log output for sure. I’ve already set this options to true and the only error I’ve seen were the error above. Everything else seems fine in lsp logs. But once again tomorrow I’ll post full logs output.

1 Like

I found some details with the issue.

Right after Sublime load completely completion by keyboard shortcut works, as hover popup are, hope this seen in the log. But after i start typing anything, e.g. var x = URL it fails and i get the error message.

plugins loaded
LSP: global configs ['clangd=False', 'typescript-language-server=False', 'cquery=False', 'polymer-ide=False', 'haskell-ide-engine=False', 'lsp-tsserver=False', 'jdtls=False', 'rls=False', 'phpls=False', 'javascript-typescript-langserver=False', 'reason=False', 'lua=False', 'golsp=False', 'pyls=True', 'ocaml=False', 'SourceKit-LSP=False', 'eslint=False']
LSP: window 4 has override for SourceKit-LSP {'enabled': True}
LSP: window 4 starting 1 initial views
LSP: window 4 requests SourceKit-LSP for /Volumes/devel/Programming/swift/backend/CryptoBotPerfect/Sources/CryptoBotPerfect/OrderDataModel.swift
LSP: starting in /Volumes/devel/Programming/swift/backend/CryptoBotPerfect
LSP: starting ['/Volumes/devel/Programming/git/sourcekit-lsp/.build/x86_64-apple-macosx10.10/debug/sourcekit-lsp']
LSP:  --> initialize
LSP: window 4 added session SourceKit-LSP
Package Control: Skipping automatic upgrade, last run at 2019-03-14 09:03:39, next run at 2019-03-14 10:03:39 or after
LSP: <--  window/logMessage
server: dependency 'Yaml' is not used by any target
LSP:  --> initialized
LSP:  --> textDocument/didOpen
LSP: <--  textDocument/publishDiagnostics
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/hover
LSP:  --> textDocument/completion
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/didChange
LSP:  --> textDocument/completion
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP: severity check 1 <= 3
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/documentHighlight
LSP: <--  window/logMessage
server: error response (Request Cancelled): 
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP: severity check 1 <= 3
LSP:  --> textDocument/didChange
LSP:  --> textDocument/completion
LSP: <--  textDocument/publishDiagnostics
LSP: severity check 1 <= 3
LSP: Got unexpected response while in state 0
LSP: <--  textDocument/publishDiagnostics
LSP: severity check 1 <= 3
LSP:  --> textDocument/didChange
LSP:  --> textDocument/completion
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/didChange
LSP: <--  textDocument/publishDiagnostics
LSP:  --> textDocument/completion
LSP: Got unexpected response while in state 0
LSP: <--  window/logMessage
server: error response (Request Cancelled): 
LSP: <--  window/logMessage
server: error response (Request Cancelled): 
LSP: <--  textDocument/publishDiagnostics
LSP: severity check 1 <= 3
LSP:  --> textDocument/completion
LSP:  --> textDocument/documentHighlight
LSP:  --> textDocument/completion
LSP: Got unexpected response while in state 0
LSP:  --> textDocument/didSave

I'd check it more carefully and you're right — the problem is occures the same as the link above, after the space typed. Like, if i continue to type code line var x = U after the Sublime restart to var x = UR the completion is working. If i starts the new line with the white space — it fails immediately.

But again. I'm checking the repeatability of the issue on the Python project and there LSP client completion works well even in lines like x = some_func() in exact same session.

Also i have the completion calls in logs, but each time this action occurs there's error message no available completion showing in the Sublime status line.

UPD: Wow. I just found out. The completion still works in some existed code lines. Like _rate = orderProperties.rate, if i continue this line with dot — it shows the completion popup. But when i'm starting the new line with var declaration with instance of some syslib type (i'd tried String either URL) — it fails. So i guess it could be related to whitespaces, new lines or some syslib calls.

It depends on the timing of the response from the server and what you're typing.

So you mean that this is the same issue as in ticket that you provide?

Yes, I believe so. I saw that issue in the past and have been using the master branch of the LSP plugin to avoid it.

1 Like

Got it. Thank you for your support!