Skip to content

Conversation

@martskins
Copy link
Collaborator

@martskins martskins commented Oct 29, 2020

This PR stops LCN from trying to communicate with a server for languages or from handling the events we track (such as CursorMoved for languages that don't have a configured server command.

I was a little dubious about setting autocmds inside a function like that, but it seems to work.

Fixes #984

@martskins martskins force-pushed the handle-filetypes-without-commands branch 2 times, most recently from 9b2b9d7 to 1ed2b82 Compare October 29, 2020 20:58
@martskins martskins force-pushed the handle-filetypes-without-commands branch 4 times, most recently from df6f039 to 3dda12f Compare November 4, 2020 20:36
@martskins martskins force-pushed the handle-filetypes-without-commands branch from 3dda12f to b2b7c97 Compare November 4, 2020 20:38
@YaLTeR
Copy link
Contributor

YaLTeR commented Nov 6, 2020

On min-vimrc this seems to fix the freezes indeed. On my particular setup there are still some freezes on network files, seems like they are coming from the airline languageclient extension, not sure who is to blame here:

FUNCTIONS SORTED ON TOTAL TIME count total (s) self (s) function 974 4.328220 0.029451 airline#extensions#languageclient#get() 974 4.298768 <SNR>137_diagnostics_for_buffer() 487 4.266051 0.005816 airline#extensions#languageclient#get_warning() 5 0.674117 0.428210 <SNR>163_AutoUpdate() 5 0.238006 0.237939 <SNR>163_IsValidFile() 564 0.148016 <SNR>103_Highlight_Matching_Pair() 487 0.120216 0.088048 airline#check_mode() 487 0.110855 0.105453 WebDevIconsGetFileTypeSymbol() 487 0.082357 0.066268 airline#extensions#whitespace#check() 487 0.074958 0.014874 airline#extensions#tagbar#currenttag() 487 0.073400 0.005415 airline#extensions#languageclient#get_error() 26 0.064010 0.055281 <SNR>163_GetNearbyTag() 21 0.060084 0.001583 tagbar#currenttag() 3409 0.048464 airline#util#append() 487 0.039499 0.013320 airline#parts#readonly() 974 0.036714 0.023580 airline#util#shorten() 487 0.033999 0.023655 WebDevIconsGetFileFormatSymbol() 564 0.029697 0.021910 <SNR>58_on_cursor_moved() 4 0.029623 0.004828 airline#highlighter#highlight() 487 0.027735 0.007109 airline#parts#mode() FUNCTIONS SORTED ON SELF TIME count total (s) self (s) function 974 4.298768 <SNR>137_diagnostics_for_buffer() 5 0.674117 0.428210 <SNR>163_AutoUpdate() 5 0.238006 0.237939 <SNR>163_IsValidFile() 564 0.148016 <SNR>103_Highlight_Matching_Pair() 487 0.110855 0.105453 WebDevIconsGetFileTypeSymbol() 487 0.120216 0.088048 airline#check_mode() 487 0.082357 0.066268 airline#extensions#whitespace#check() 26 0.064010 0.055281 <SNR>163_GetNearbyTag() 3409 0.048464 airline#util#append() 974 4.328220 0.029451 airline#extensions#languageclient#get() 2922 0.027603 airline#util#prepend() 487 0.026179 airline#util#ignore_buf() 487 0.024027 airline#extensions#keymap#status() 487 0.033999 0.023655 WebDevIconsGetFileFormatSymbol() 974 0.036714 0.023580 airline#util#shorten() 564 0.029697 0.021910 <SNR>58_on_cursor_moved() 2922 0.021827 airline#util#wrap() 1461 0.019283 airline#util#winwidth() 487 0.017652 airline#parts#spell() 487 0.074958 0.014874 airline#extensions#tagbar#currenttag() 
@martskins
Copy link
Collaborator Author

Yeah I think we should be able to stop some of those calls as well. But that's definitely something we have to do in airline. I'll see about opening a PR there to try and fix that as well 👍

Thanks for testing it out

@martskins martskins merged commit 3b5b208 into autozimu:dev Nov 7, 2020
@martskins martskins deleted the handle-filetypes-without-commands branch November 7, 2020 13:20
@martskins
Copy link
Collaborator Author

@YaLTeR Just opened vim-airline/vim-airline#2282 to try to address that last bit. It won't fix it all the way, as I don't think there's a (clean) way for airline to know whether it should load the extension for that specific filetype, but that fix should cut a bunch of that time out of your profile.

One thing that could work better is to just check if there is a configured server in the LanguageClient_serverCommands global and do not load the extension if there isn't, but that sounds a little hacky maybe?

@YaLTeR
Copy link
Contributor

YaLTeR commented Nov 7, 2020

check if there is a configured server in the LanguageClient_serverCommands global and do not load the extension if there isn't

Unfortunately it's impossible to configure extensions at any point past initial plugin load: vim-airline/vim-airline#2086 (comment)

@martskins
Copy link
Collaborator Author

Ah well, that settles that then, I think our only bet is to exit early in that airline#extensions#languageclient#get function then. 👍

martskins added a commit to martskins/LanguageClient-neovim that referenced this pull request Dec 6, 2020
martskins added a commit to martskins/LanguageClient-neovim that referenced this pull request Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants