castwide / solargraph-utils

A Node module for interacting with the Solargraph rubygem.
Other
5 stars 10 forks source link

Support WSL #9

Open gosukiwi opened 4 years ago

gosukiwi commented 4 years ago

This PR adds support for WSL (Windows Subsystem for Linux). In order to reach WSL's Ruby, we need to add wsl before the Linux path, as described here.

$ wsl /usr/bin/ruby
# or using rvm
$ wsl /home/<my_user>/.rvm/gems/ruby-2.6.6/wrappers/ruby
# for reaching solargraph binary
$ wsl /home/<my_user>/.rvm/gems/ruby-2.6.6/wrappers/solargraph

This PR implements useWSL flag in the configuration so it will append wsl to the commandPath, so you can use it as such:

import * as solargraph from 'solargraph-utils';
let configuration = new solargraph.Configuration(useWSL: true, commandPath: '/home/<my_user>/.rvm/gems/ruby-2.6.6/wrappers/solargraph');
let provider = new solargraph.SocketProvider(configuration);
provider.start().then(() => {
    console.log('Socket server is listening on port ' + provider.port);
});