crsh / citr

RStudio Addin to Insert Markdown Citations
Other
407 stars 46 forks source link

VSCode compatibility: check for rstudioapi functions using hasFun rather than version num #73

Closed MilesMcBain closed 4 years ago

MilesMcBain commented 4 years ago

Hi,

Very soon VSCode will have support for RStudio addins. citr is quite a popular addin so I thought I would test compatibility.

Currently the way citr checks for specific RStudio versions is not compatible with VSCode {rstudioapi} emulation, since VSCode will probably never lie and claim to be a specific RStudio version. However if citr checks for API functions it is dependent on using rstudioapi::hasFun, it would be fully compatible with VSCode. I have made this change in this PR and tested it locally and it verified citr works with VSCode and RStudio using this verification method.

Thanks for the great addin. I would love to be able to include it on the list of verified supported addins in VSCode.

MilesMcBain commented 4 years ago

After digging a bit deeper into the source of the API I see this might be a bit of a goof. I had assumed that hasFun checked with RStudio if the call was supported but that appears no to be so.

So what I might do then is make VSCode ignore the version requirement for hasFun, findFun etc. That way you could use your original version constraints with those. If you're ammenable to that let me know. And I can update the PR.

MilesMcBain commented 4 years ago

Turns out I was right the first time see replies and end of this: https://github.com/Ikuyadeu/vscode-R/issues/302#issuecomment-703023270

crsh commented 4 years ago

Hi Miles, thanks for the PR. I have been following the activity on the VSCode project closely and was delighted to see you efforts over there. In fact, I was considering to deprecate citr in favor of the new RStudio Visual Editor, but if it is of some interest to VSCode users, I may reconsider.