ycm-core / ycmd

A code-completion & code-comprehension server
https://ycm-core.github.io/ycmd/
GNU General Public License v3.0
1.7k stars 766 forks source link

Typescript completer error #731

Closed CandySunPlus closed 7 years ago

CandySunPlus commented 7 years ago

after YouCompleteMe update to https://github.com/Valloric/YouCompleteMe/commit/95a44c22cf3d2d9a151f5a9e77824d1ea28ec829 for auto merge #https://github.com/Valloric/YouCompleteMe/pull/2589 can not trigger TypeScript completer's OnBufferVisit when BuffEnter, that will break the completer with No Project error.

YCM error log

2017-03-30 19:18:16,115 - INFO - Received filetype completion available request 2017-03-30 19:18:16,124 - INFO - Using node binary from /Users/niksun/.nvm/versions/node/v6.9.2/bin/node 2017-03-30 19:18:16,124 - INFO - Using TSServer from /Users/niksun/.nvm/versions/node/v6.9.2/bin/tsserver 2017-03-30 19:18:16,126 - INFO - TSServer log file: /var/folders/sc/qn7hxxh17wvg5nbh_l64yydc0000gn/T/tsserver_ys7tlu4s.log 2017-03-30 19:18:16,128 - INFO - Enabling typescript completion 2017-03-30 19:18:16,134 - INFO - Received event notification 2017-03-30 19:18:16,135 - INFO - Adding buffer identifiers for file: /Users/niksun/Development/pay-iwallet/src/ts/view/realname/verify.ts Traceback (most recent call last): File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(args) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(*a, *ka) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper return callback( args, kwargs ) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper body = callback( *args, **kwargs ) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification event_handler )( request_data ) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 462, in OnFileReadyToParse diagnostics = self.GetDiagnosticsForCurrentFile( request_data ) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 484, in GetDiagnosticsForCurrentFile request_data ) File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 472, in GetTsDiagnosticsForCurrentFile self._GetSemanticDiagnostics( filename ), File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 532, in _GetSemanticDiagnostics 'includeLinePosition': True File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 364, in _SendRequest return deferred.result() File "/Users/niksun/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/typescript/typescript_completer.py", line 78, in result raise RuntimeError( message[ 'message' ] ) RuntimeError: Error processing request. No Project. Error: No Project. at Object.ThrowNoProject (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:68775:23) at IOSession.Session.getFileAndProjectWorker (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:72785:42) at IOSession.Session.getFileAndProject (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:72775:29) at IOSession.Session.getDiagnosticsWorker (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:72459:31) at IOSession.Session.getSemanticDiagnosticsSync (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:72555:29) at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:72159:61) at /Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:73306:88 at IOSession.Session.executeWithRequestId (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:73297:28) at IOSession.Session.executeCommand (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:73306:33) at IOSession.Session.onMessage (/Users/niksun/.config/yarn/global/node_modules/typescript/lib/tsserver.js:73326:35) 2017-03-30 19:24:38,065 - INFO - Received event notification

CandySunPlus commented 7 years ago

@homu

vheon commented 7 years ago

@homu

That is a build bot, so it will not answer.

I'm not sure I understand the issue here, can you write a minimal series of step that was working before but that are now broken for you?

icholy commented 7 years ago

This just started happening to me too.

Err 0     Exception on executing command {"command": "semanticDiagnosticsSync", "type": "request", "arguments": {"includeLinePosition": true, "file": "my_file.ts"}, "seq": 1}:
No Project.
Error: No Project.
    at Object.ThrowNoProject (/usr/lib/node_modules/typescript/lib/tsserver.js:6143:23)
    at IOSession.Session.getFileAndProjectWorker (/usr/lib/node_modules/typescript/lib/tsserver.js:67622:42)
    at IOSession.Session.getFileAndProject (/usr/lib/node_modules/typescript/lib/tsserver.js:67612:29)
    at IOSession.Session.getDiagnosticsWorker (/usr/lib/node_modules/typescript/lib/tsserver.js:67299:31)
    at IOSession.Session.getSemanticDiagnosticsSync (/usr/lib/node_modules/typescript/lib/tsserver.js:67392:29)
    at Session.handlers.ts.createMap._a.(anonymous function) (/usr/lib/node_modules/typescript/lib/tsserver.js:67006:61)
    at IOSession.Session.executeCommand (/usr/lib/node_modules/typescript/lib/tsserver.js:68120:28)
    at IOSession.Session.onMessage (/usr/lib/node_modules/typescript/lib/tsserver.js:68140:35)
    at Interface.<anonymous> (/usr/lib/node_modules/typescript/lib/tsserver.js:69284:27)
    at emitOne (events.js:96:13)

718 @mikeperri

The diagnostics were working for me until I updated ycmd today.

edit: it starts working fine after running :YcmRestartServer

micbou commented 7 years ago

@CandySunPlus @icholy Could you try PR https://github.com/Valloric/YouCompleteMe/pull/2595? It should fix the issue.

icholy commented 7 years ago

@micbou that fixed it :+1:

CandySunPlus commented 7 years ago

@micbou thx