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

Add support for editor detection on WSL #8172

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

levrik
Copy link
Contributor

@levrik levrik commented Dec 13, 2019

The logic here is the following:

  • If we can find the VS Code Remote server installed in WSL, check if some VS Code process is running on the Windows-side and execute code (or code-insiders) on WSL side
  • If we're trying to open a file under /mnt/ we'll use the normal Windows detection with conversion of the Windows file path to a WSL file path
  • For anything else we fall back to the normal Linux detection (which will work with terminal editors only, except for users running some GUI apps with a x server but this is untested)

Seeing this in action

Inside WSL filesystem with VS Code open:

cra-wsl-vscode_Trim

Inside Windows filesystem with Notepad++ open:

cra-wsl-notepad-_Trim

}

// When called via WSL, new lines are \r\r\n instead of just \r\n
const wmicLineEnding = isWsl ? /\r?\r\n/g : '\r\n';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is like that. Maybe I'm missing something here?

@levrik
Copy link
Contributor Author

levrik commented Jan 10, 2020

@iansu @mrmckeb @ianschmitz @petetnt Friendly ping.

Copy link
Contributor

@mrmckeb mrmckeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @levrik, I assume this got lost during the holidays sorry.

As I understand it, the purpose of this PR is to support VSCode remote with WSL, as we already have WSL support to an extent - is that correct?

@levrik
Copy link
Contributor Author

levrik commented Jan 12, 2020

This PR is not about VS Code and WSL only. VS Code just has some special case in here because of its remote extension.
In general it's like this:

  • Supports every Windows editor if using WSL inside a mounted Windows drive (mainly for legacy WSL, in WSL 2 the Linux file system should be used)
  • Supports VS Code remote WSL extension as a special case, for both Linux file system and mounted Windows drives
  • It falls back to normal Linux-detection if nothing of the above succeeds.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jan 12, 2020

Thanks @levrik - I'll see if anyone on the team can test this. I'm currently on Mac and don't have WSL (although I was previously on a Surface and get that WSL is awesome).

@mrmckeb mrmckeb self-assigned this Jan 12, 2020
@mrmckeb mrmckeb added this to the 3.4 milestone Jan 12, 2020
@levrik
Copy link
Contributor Author

levrik commented Feb 1, 2020

@mrmckeb I removed the is-wsl package. Could you find anyone on the team for testing?

@iansu iansu modified the milestones: 3.4, 3.5 Feb 14, 2020
@levrik
Copy link
Contributor Author

levrik commented Mar 20, 2020

@mrmckeb @iansu Friendly ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants