Skip to content

prompt to install languageserver is not available#965

Merged
renkun-ken merged 10 commits intoREditorSupport:masterfrom
shrektan:fix754
Feb 6, 2022
Merged

prompt to install languageserver is not available#965
renkun-ken merged 10 commits intoREditorSupport:masterfrom
shrektan:fix754

Conversation

@shrektan
Copy link
Contributor

@shrektan shrektan commented Feb 3, 2022

What problem did you solve?

Fixes #754

Newbies may find it confusing when the R package languageserver is not installed. This PR enables a prompt to instruct the user to install languageserver if missing.

(We can use the added function to check other required R packages as well)
(I've also verified that it works on Windows)

How can I check this pull request?

  1. (R) remove the package via remove.packages("languageserver")
  2. Open VSCode with any R project
  3. A prompt will show up. Click "Not sure" the message vanishes. Click "Click to install" will launch a task to install the package with a notice that the user may need to reload to take effect.

Screenshot

image

image

@renkun-ken
Copy link
Member

@shrektan I rewrite some code in this PR:

  • Checking languageserver installation at createClient to respect the working directory to be used (because different workspace folder might have different .Rprofile, e.g. renv might be used). Also, after installing languageserver, reopening an R file could activate the language service again.
  • executeRCommand uses spawnSync instead of execSync to better handle the quoting of the arguments.
  • executeRCommand now handles the case where user writes anything to stdout before and after the supplied expression is evaluated.

@renkun-ken renkun-ken merged commit f8e29d9 into REditorSupport:master Feb 6, 2022
@shrektan
Copy link
Contributor Author

shrektan commented Feb 6, 2022

@renkun-ken Looks good to me. Much cleaner. Thanks!

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.

Prompt and command to install languageserver

3 participants