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

Using vscode as EDITOR in WSL doesn't work to write git commit messages #27101

Closed
jacobian opened this issue May 22, 2017 · 3 comments
Closed
Assignees
Labels
help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@jacobian
Copy link

jacobian commented May 22, 2017

  • VSCode Version: 1.12.2
  • OS Version: 10.0.15063 Build 15063
  • WSL Ubuntu 14.04

Steps to Reproduce:

  1. In Bash, export EDITOR='code -w -n'
  2. In a git repository, make changes.
  3. Try to commit: git commit -a
  4. VS Code launches as expected, but when you save the edit message, git reports Aborting commit due to empty commit message.
@jacobian
Copy link
Author

Investigating further, it appears that the path being passed to VSCode isn't correct:

image

That's the Linux path (i.e. starting with /mnt/c/...), but over in Windows-land it should just be C:\Users\jacob\...). So somehow between the git -> EDITOR -> code handoff the correct path is getting messed up in some way?

@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label May 23, 2017
@bpasero bpasero added this to the Backlog milestone May 23, 2017
@ferreus
Copy link

ferreus commented Jun 8, 2017

Not sure if vscode should actually fix this, as it is not a good idea to modify linux files using windows apps and tools (https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/)

But one can have a simple workaround for this problem:

  1. https://github.com/Milly/wslpath
    This is a script to convert linux path to windows path

  2. A simple wrapper script to launch code with converted path:
    ~/bin/editor

#!/bin/bash

#extract last argument (the file path)
for last; do true; done

#get all the initial command arguments
all="${@:1:$(($#-1))}"

#launch code with windows path
code $all `wslpath.sh -w $last`

git commit:
EDITOR="/home/ferreus/bin/editor -w -n" git commit

@bpasero
Copy link
Member

bpasero commented Jun 11, 2017

This is not in our control.

@bpasero bpasero closed this as completed Jun 11, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

3 participants