Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript completer is not working after upgrade to TypeScript 2.6.1 #2818

Closed
liyinsg opened this issue Nov 1, 2017 · 7 comments
Closed

Comments

@liyinsg
Copy link

liyinsg commented Nov 1, 2017

TypeScript version: 2.6.1
VIM version: 8.0

The completer working again after revert back to 2.5.3

npm install -g [email protected]

YcmDebugInfo:

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_0iihdevm.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.6.3
-- Server has Clang support compiled in: True
-- Clang version: clang version 4.0.1-6 (tags/RELEASE_401/final)
-- Extra configuration file found and loaded
-- Extra configuration path: /usr/local/etc/vim/ycm_extra_conf.py
-- TypeScript completer debug information:
--   TSServer running
--   TSServer process ID: 22270
--   TSServer executable: /usr/local/bin/tsserver
--   TSServer logfiles:
--     /tmp/tsserver_po1o5quu.log
-- Server running at: http://127.0.0.1:60835
-- Server process ID: 22200
-- Server logfiles:
--   /tmp/ycmd_60835_stdout_xd3k57sx.log
--   /tmp/ycmd_60835_stderr_kk0eepz0.log

Error log:

2017-11-01 19:35:38,187 - INFO - Received ready request
2017-11-01 19:35:38,308 - INFO - Received event notification
2017-11-01 19:35:38,313 - INFO - Using node binary from /usr/bin/nodejs
2017-11-01 19:35:38,314 - INFO - Using TSServer from /usr/local/bin/tsserver
2017-11-01 19:35:38,316 - INFO - Received event notification
2017-11-01 19:35:38,317 - INFO - Adding buffer identifiers for file: /home/ly/1.ts
2017-11-01 19:35:38,319 - INFO - TSServer log file: /tmp/tsserver_po1o5quu.log
2017-11-01 19:35:38,325 - INFO - Enabling typescript completion
2017-11-01 19:35:39,430 - INFO - Received filetype completion available request
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 260, in _ReaderLoop
    message = self._ReadMessage()
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 293, in _ReadMessage
    key, value = utils.ToUnicode( headerline ).split( ':', 1 )
ValueError: not enough values to unpack (expected 2, got 1)

2017-11-01 19:35:49,849 - INFO - Received event notification
2017-11-01 19:35:49,850 - INFO - Adding ONE buffer identifier for file: /home/ly/1.ts
2017-11-01 19:35:50,025 - INFO - Received completion request
2017-11-01 19:35:50,181 - INFO - Received event notification
2017-11-01 19:35:50,181 - INFO - Adding ONE buffer identifier for file: /home/ly/1.ts
2017-11-01 19:35:50,185 - INFO - Received completion request
2017-11-01 19:35:51,028 - INFO - Received completion request
2017-11-01 19:35:51,707 - INFO - Received event notification
2017-11-01 19:35:51,707 - INFO - Adding buffer identifiers for file: /home/ly/1.ts
2017-11-01 19:35:51,710 - INFO - Received event notification
2017-11-01 19:35:51,711 - INFO - Adding ONE buffer identifier for file: /home/ly/1.ts
2017-11-01 19:36:00,189 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last):
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 103, in GetCompletions
    .ComputeCandidates( request_data ) )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 218, in ComputeCandidates
    candidates = self._GetCandidatesFromSubclass( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 231, in _GetCandidatesFromSubclass
    raw_completions = self.ComputeCandidatesInner( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 399, in ComputeCandidatesInner
    self._Reload( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 380, in _Reload
    'tmpfile': tmpfile.name
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 364, in _SendRequest
    return deferred.result()
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 75, in result
    raise RuntimeError( 'Response Timeout' )
RuntimeError: Response Timeout

2017-11-01 19:36:01,030 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last):
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 103, in GetCompletions
    .ComputeCandidates( request_data ) )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 218, in ComputeCandidates
    candidates = self._GetCandidatesFromSubclass( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 231, in _GetCandidatesFromSubclass
    raw_completions = self.ComputeCandidatesInner( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 399, in ComputeCandidatesInner
    self._Reload( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 380, in _Reload
    'tmpfile': tmpfile.name
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 364, in _SendRequest
    return deferred.result()
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 75, in result
    raise RuntimeError( 'Response Timeout' )
RuntimeError: Response Timeout

Traceback (most recent call last):
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
    event_handler )( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 460, in OnFileReadyToParse
    self._Reload( request_data )
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 380, in _Reload
    'tmpfile': tmpfile.name
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 364, in _SendRequest
    return deferred.result()
  File "/usr/local/etc/vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 75, in result
    raise RuntimeError( 'Response Timeout' )
RuntimeError: Response Timeout
@liyinsg
Copy link
Author

liyinsg commented Nov 1, 2017

Some services methods (getCompletionEntryDetails and getCompletionEntrySymbols) have additional parameters. Plugins that wrap the language service must pass these parameters along to the original implementation. See #19507

@bryanforbes
Copy link

This is due to tsserver outputting some warnings from npm on stdout (for instance, npm WARN 2.6 No description) when it runs the automatic type acquisition. Invalid output from tsserver should be skipped.

@puremourning
Copy link
Member

I feel like invalid output from npm is the tsserver stdout is a straight up tsserver bug?

@bryanforbes
Copy link

bryanforbes commented Nov 1, 2017

I agree (and so do they), but they released 2.6.1 (as the major TS2.6 release) with this behavior and it's out in the wild. Until they release a new version, ycmd won't work.

zzbot added a commit to ycm-core/ycmd that referenced this issue Nov 3, 2017
[READY] Support TypeScript 2.6.1

TypeScript 2.6.1 introduced a bug in TSServer where NPM warnings are printed on stdout at startup:
```
npm WARN 2.6 No description
npm WARN 2.6 No repository field.
npm WARN 2.6 No license field.
```
See issue microsoft/TypeScript#19660. The TypeScript completer chokes on this output as it always expects a HTTP-like response from TSServer and assumes that the server died if not. Though it's a TSServer bug, we can handle it by catching the `ValueError` exception raised when parsing invalid headers and by interrupting the reader loop only if the server is not running.

Also, this new version of TypeScript returns an empty list when no definition is found. Update the `_GoToDefinition` and `_GoToType` functions accordingly.

Fixes ycm-core/YouCompleteMe#2818.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/869)
<!-- Reviewable:end -->
@TommyX12
Copy link

TommyX12 commented Nov 8, 2017

Right now the referenced ycmd repo hasn't been updated yet, so even though this is solved in ycmd, it still isn't working in YCM.

@bstaletic
Copy link
Collaborator

@TommyX12 If you're in a hurry to get this solved in YCM, at least for yourself, you can go into your ycmd directory and pull the fixed ycmd revision.

@ktaherig
Copy link

You fellows are absolute lifesavers! I love you guys <3

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants