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

[#140] add simple completion function #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Quramy
Copy link
Owner

@Quramy Quramy commented May 11, 2017

provide tsuquyomi#getCompletion function for #140.

@Quramy
Copy link
Owner Author

Quramy commented May 11, 2017

@prabirshrestha

You can create asyncomplete#sources#tsuquyomi#completor with tsuquyomi#getCompletion function.

I've checked the operation via the following code:

function s:ts_comp(opt, ctx)
  call tsuquyomi#getCompletions({candidates, startcol ->
         \ asyncomplete#complete('typesctipt', a:ctx, startcol, candidates)
         \ })

endfunction

call asyncomplete#register_source({
    \ 'name': 'tsuquyomi',
    \ 'whitelist': ['typescript'],
    \ 'priority': 5,
    \ 'completor': function('s:ts_comp'),
    \ })

How about it ?

@@ -393,6 +397,19 @@ function! tsuquyomi#complete(findstart, base)

endif
endfunction

function tsuquyomi#getCompletions(callback)
if tsuquyomi#statusServer() == 'dead'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the server has not started is it still considered dead?

@prabirshrestha
Copy link

looks good but some comments here.

  • asyncomplete#complete('typesctipt', should beasyncomplete#complete('tsuquyomi', since that is the name you used.
  • rather than checking if tsuquyomi#statusServer() == 'dead' is it possible to know if the tsserver has been initialized instead. Initializing tsserver for large code base is slow. so the first time I type vim in unresponsive for few seconds since tsuquyomi is not completly async and then once it has been initialized the completion is fast.

@prabirshrestha
Copy link

Seems like even saving a file for a big project has this issue. So I don't think anything can be done now to fix the initial unresponsiveness unless it is moved to full async implmentation.

PR looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants