Qusic / atom-youcompleteme

YouCompleteMe for Atom Editor
MIT License
82 stars 34 forks source link

Typescript doesn't seem to be working on OSX 10.12.6, Atom 1.21.0 #86

Open andybp85 opened 7 years ago

andybp85 commented 7 years ago

I've been using YouCompleteMe on vim for years. This is probably an easy fix but I had zero luck finding anything relevant on Google and I'm asking on here as a last resort, so thanks in advance for any help!

I'm using the same ycmd install I use for vim and testing on the same file in atom and vim, called menuview.ts. Relevant part:

export class MenuView {

  items: Array<any>;
  editorView: EditorView;
  dom: Element;

  constructor(items:Array<any>, editorView:EditorView) {
    this.items = items
...

In vim, if I run :YcmdCompleter GetType on this.items, I get back (property) MenuItems.items: any[]. Awesome.

I have my you-complete-me packages settings pointing at the same python and folder that vim uses. In Enabled Filetypes I have c, cpp, objc, objcpp, js, py, ts (I've also tried typescript here). I see YouCompleteMe working, but when I try to GetType on the same line I get this error:

No semantic completer exists for filetypes: ['ts']
Traceback (most recent call last):
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 81, in RunCompleterCommand
    completer = _GetCompleterForRequestData( request_data )
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 285, in _GetCompleterForRequestData
    return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] )
  File "/Users/username/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/server_state.py", line 89, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['ts']

At the moment I'm befuddled. Thanks again for any help!

Qusic commented 7 years ago

The name of file types can be different between ycmd and atom. So there is a function used for converting, for example, js and jsx to javascript. It is likely that ts has a different name in ycmd. You can try modifying that function and see if it works. Also sending a PR is welcome.