Closed ashiklom closed 3 years ago
~I just updated to Neovim v0.5 and the problem went away -- completion works exactly as it should, including for the dplyr
functions above.~ I'm guessing the issue somewhere in here (https://github.com/jalvesaq/Nvim-R/blob/master/R/common_global.vim#L3794-L3817), perhaps because user_data must be a string
?
~Anyway, upgrading Neovim solved the problem for me, but I'll leave this open because Neovim 0.5 is only in nightly release right now.~
EDIT: Actually, I am still hitting the same error -- it seemed to work at first, but now I'm hitting the same error again. Very strange. I tried deleting the .cache/Nvim-R
directory, but that did not resolve the problem.
I get the result below with both /usr/bin/nvim (0.4.4) and the current github version of nvim (0.5.0):
The \Sexpr
code shouldn't be there but I don't get errors related to missing quotes.
Sorry for the long silence -- I haven't had a chance to dig into this until now.
I can confirm that I am not encountering this problem on a Linux HPC running R 3.5.3, only on my MacOS running R 4.0.4. (I haven't tried a Linux box with R 4.0.x yet).
After a lot of debug by fprintf
, I've narrowed the problem down to something in the description string. If I modify the nclientserver.c
file to use a dummy description string like this:
p = str_cat(p, "', 'descr': '");
/* p = str_cat(p, f[6]); */
p = str_cat(p, "DESCRIPTION GOES HERE");
p = str_cat(p, "'}},");
...and rebuild nvimcom, the completion works fine (albeit with the dummy description string for all functions).
I tried adding a fprintf(stderr, ...)
statement in there to see what compl_buffer
actually looks like at the end of this process and I noticed that the entry for select
had this (full output in details below; emphasis mine):
except that no error is thrown for names that ***don''t*** exist
Note the double quotes in don''t
.
However, I also get similar errors to the one reported in the original issue when I try to complete fil
(with dplyr
loaded), but I don't hit any errors when trying to complete filt
. I also don't hit any errors when trying to complete fil
without dplyr
loaded. As far as I can tell, filter
doesn't have any single quotes in its documentation.
Could this be an OS/compiler-specific variation in how C works with character strings? Perhaps it freaks out when the list of completion candidates gets too long, or perhaps I'm running up against the upper limit of the allocated completion buffer size in a weird way? Those are my best guesses.
I still get the same result shown in the screenshot that I posted on December 4, 2020. It's obviously wrongly formatted because the LaTeX like syntax isn't parsed, but there are no errors in the Vim script. Indeed, the single quotes are duplicated to avoid errors in the Vim script.
That's good to know, thanks! I'll try comparing the omnicompletion lists generated on my MacOS with those generated on a similarly configured Linux machine to see if there are any differences.
@ashiklom, do you still see the bug in your Mac OS? Single quotes are now saved in the omnls_ files as "\004" and the byte "\004" is replaced with single quotes only during the float window creation.
Thanks! Unfortunately, I'm still seeing the error on MacOS. When trying to autocomplete the string fil
(with dplyr
loaded), I get:
Error detected while processing function CompleteR[94]..WaitRCompletion[1]..ROnJobStdout:
line 7:
E115: Missing quote: 'func [sta
Error detected while processing function CompleteR[94]..WaitRCompletion[1]..ROnJobStdout:
line 7:
E116: Invalid arguments for function SetComplMenu
[ClientServer] Unknown command: ts]', 'user_data': {'cls': 'f', 'pkg': 'stats', 'usage': [['x'], ['filter'], ['method', 'c("convolution", "recursive")'], ['side [...]
Based on the latter, I'm not sure this is a quoting issue. Rather, could this have to do with some kind of unique buffer flushing behavior in MacOS / BSD?
I'm sure this is a frustrating issue for you to debug without more information from me, and I'm sorry I haven't found the time to investigate further! Feel free to close this issue as wontfix
in the meantime until I can find the time to get a better sense of what's causing this.
Maybe it's fixed now in the branch omni_tmp
. Could you try it, please?
Yes, that fixed it! Completion on fil<|>
now works beautifully and very efficiently. Thanks so much!
Thanks for the feedback! I'll let the branch active for a few days before merging it. Please, report any new bug that you find.
Omni-completion (
C-x C-o
) works fine for functions with simple docstrings:However, for functions with more complex formatting in their documentation, completion fails:
Another example, looking for
dplyr::filter
:It looks like Nvim-R un-quotes the documentation prematurely and tries to interpret the rest of the documentation string as a vimscript function, which obviously fails.
My system information is below: