Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server fails to launch due to bad arguments; extension can't handle user profile paths with spaces in the username? #20

Closed
WToorenburghIntiveo opened this issue Jan 30, 2018 · 4 comments

Comments

@WToorenburghIntiveo
Copy link

WToorenburghIntiveo commented Jan 30, 2018

Hey there,

OS: Windows 10 Pro 1709 build 16299.192
VSCode Version: 1.19.3
Solargraph extension: 0.11.1
Possibly relevant extensions:
Ruby extension: rebornix.ruby version 0.16.0
Chef Extension for Visual Studio Code Pendrica.chef version 0.6.4
All extensions:

code --list-extensions
AlanWalk.markdown-toc
bierner.markdown-preview-github-styles
burtlo.inspec
castwide.solargraph
codezombiech.gitignore
DavidAnson.vscode-markdownlint
donjayamanne.githistory
DotJoshJohnson.xml
felipecaputo.git-project-manager
felixfbecker.php-intellisense
formulahendry.code-runner
hangxingliu.vscode-nginx-conf-hint
hnw.vscode-auto-open-markdown-preview
irvinlim.language-modsecurity
jirkafajfr.vscode-kitchen
le0zh.vscode-regexp-preivew
mikestead.dotenv
ms-vscode.PowerShell
Pendrica.chef
PeterJausovec.vscode-docker
rebornix.Ruby
robertohuertasm.vscode-icons
shanoor.vscode-nginx
ziyasal.vscode-open-in-github

I've been trying to get your extension to work, and I think I found a bug. Entering Ctrl+Space to show suggestions was showing a Loading... prompt that would never finish. When I opened Process Explorer to see if VSCode had a Ruby process running, there was nothing. Running Solargraph: Restart Solargraph showed a Ruby process running for a split second, then exiting.

To make sure the Gem was working, I ran solargraph server -p 0 in a Powershell prompt (having seen you suggest that as a method for testing in another issue), and pointed my browser to the localhost port. I saw the "Sinatra doesn’t know this ditty.", and corresponding output in the server log in my terminal, so that confirmed there wasn't anything the matter with the Gem.

My username has a space in it, so my profile path does as well ("C:\Users\<Firstname> <Lastname>\..."). In the dev console, when running the Solargraph: Restart Solargraph command, this error is thrown: [Extension Host] ERROR: "solargraph server" was called with arguments ["<Lastname>\\.vscode\\extensions\\castwide.solargraph-0.11.1/views"] Usage: "solargraph server". It seems like the command is getting split by the space in my profile folder name?

Let me know if there's any further context I can provide!

@WToorenburghIntiveo
Copy link
Author

I did a little digging through the code, and I found this line: https://github.com/castwide/vscode-solargraph/blob/master/src/extension.ts#L78

config.viewsPath = vscode.extensions.getExtension('castwide.solargraph').extensionPath + '/views';

My suspicion is that it needs to be wrapped in double quotes, like so:

config.viewsPath = "${vscode.extensions.getExtension('castwide.solargraph').extensionPath}/views";

I know pretty much nothing about typescript, so forgive me if I am barking up the wrong tree with this.

@castwide
Copy link
Owner

Thanks for the report. I'll fix it in the solargraph-utils package to ensure that command-line arguments are always escaped. Seeing as how the function accepts arguments as an array, I'm a little surprised it isn't already being done.

@castwide
Copy link
Owner

Version 0.11.3 of the extension should fix this issue.

@WToorenburghIntiveo
Copy link
Author

Perfect! Suggestions are now working. Thank you for such a quick response!

@castwide castwide closed this as completed Feb 5, 2018
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

No branches or pull requests

2 participants