atom/ide-typescript

Document should be opened for completion

ryanvade opened this issue · 1 comments

Prerequisites

Description

Steps to Reproduce

  1. Install IDE UI Packages (see HERE )
  2. Install ide-typescript
  3. Install language-vue
  4. Install ide-vue
  5. Type anything in a .vue file with typescript

Expected behavior:
I would expect to be able to use the IDE features.

Actual behavior:

I get the following errors:
TypeScript (Theia) rpc.sendRequest textDocument/completion threw ResponseError: Request textDocument/completion failed with message: The document should be opened for completion at handleResponse (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:436:48) at processMessageQueue (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:263:17) at Immediate.setImmediate (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:247:13) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5)

and
Uncaught (in promise) ResponseError: Request textDocument/completion failed with message: The document should be opened for completion at handleResponse (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:436:48) at processMessageQueue (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:263:17) at Immediate.setImmediate (/home/ryan/.atom/packages/ide-typescript/node_modules/vscode-jsonrpc/lib/main.js:247:13) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5)

Reproduces how often:

100% of time.

Versions

apm 2.1.7
npm 6.2.0
node 8.9.3 x64
atom 1.37.0
python 2.7.16
git 2.20.1

Ubuntu 19.04

Additional Information

This could very well be the interaction with ide-vue. But the error is thrown in ide-typescript sources.

I came here for same error, and I have found out that the error is from typescript-language-server/src/lsp-server.ts.

It is because the typescript language server opens the file on textDocument/didOpen, but atom-languageclient doesn't sends the method when the editor is turned on with files already opened.

TL;DR)
Close the opened tab and reopening might solve your issue.