VS Code on Windows: How can I compile a Node/Linux project? - visual-studio-code

I cloned the WebPack Docks repository. Now, when I open that repository in Visual Studio Code, I want to run the NPM script build from that repository. Yet, that doesn't work because the build script uses sh.
So, I installed WSL and an Umbuntu distribution, hoping that's the right direction to go.
Now, how can I have VS Code (on Windows) utilize the Linux dist to run NPM scripts, without me being required to mirror all NPM development tools to the Linux OS which I already have installed on Windows.

Related

vscode inside WSL vs Windows

In tutorial requirement is install vscode in windows and install Remote Development extension pack. Why not just install in wsl?
I've install vscode to wsl. When I run code in wsl I get message:
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the `code` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N]
To no longer see this prompt, start Visual Studio Code with the environment variable DONT_PROMPT_WSL_INSTALL defined.
Which cons of run vscode in wsl as opposed to run it in Windows?
The WSL extension splits VS Code into a “client-server” architecture, with the client (the user interface) running on your Windows machine and the server (your code, Git, plugins, etc) running "remotely" in your WSL distribution.
When VS Code is started in WSL, no shell startup scripts are run.
The extension runs commands and other extensions directly in WSL so you can edit files located in WSL or the mounted Windows filesystem (for example /mnt/c) without worrying about pathing issues, binary compatibility, or other cross-OS challenges.
(source: MSFT DOCUMENTATION)
This is the architectural choice of Windows and - personally speaking - I feel like it's a choice to avoid conflicts and redundancies.
When running the WSL extension, selecting the 'Extensions' tab will display a list of extensions split between your local machine and your WSL distribution.
Installing a local extension, like a theme, only needs to be installed once.
Some extensions, like the Python extension or anything that handles things like linting or debugging, must be installed separately on each WSL distribution. VS Code will display a warning icon ⚠, along with a green "Install in WSL" button, if you have an extension locally installed that is not installed on your WSL distribution.

why my vscode does not have the same libraries installed in wsl?

I'm using wsl and it runs codes in vscode pretty fine and I have different libraries which I installed through pip and conda in wsl but when I run that code using vscode itself it doesn't recognize the libraries or even pip itself.
I don't have any other environment.
I should add that I installed the packages globally using conda install ... or pip install ... in base environment and I only have base environment and I run my code through code . and I also have python and remote wsl extensions installed in my vscode.
what can be the problem?
I don't have much personal experience with this, but I found some useful information in this Stack Overflow question (even though it doesn't utilize conda), along with https://code.visualstudio.com/docs/remote/wsl-tutorial#_python-development.
I also found this blog post useful, even if it doesn't cover WSL.
In short, make sure you:
Have installed the Python extension (by Microsoft) in VSCode. This is critical for being able to detect and select the Python interpreter. You don't mention having this in place, so I believe this is your likely problem.
You have done this already, but including it for others who might read this later -- Install the Remote - WSL extension (or the Remote Development extension pack) in VSCode.
You are also doing this already -- Start VSCode from inside your WSL distribution. Alternatively, you can start VSCode from Windows and then select the Remote WSL - Reopen Folder in WSL from the Command Palette (also accessible from the "Remote" Status Bar).
In VSCode, open the Command Palette with Shift+Ctrl+P, search for the Python: Select Interpreter command, and you should find your Conda environment in the list.
After selecting this, you should find that your project is using the interpreter and modules that you have installed via conda.
One thing I did to overcome this issue is go to Extensions -> Local (You should have two tabs there, Local and WSL:DISTRO) DISTRO refers to whatever DISTRO you're using, you will see that some of the local extensions are disabled in the current workspace (WSL) and there is a little cloud icon in the WSL:DISTRO tab that says install Local Extensions in WSL:DISTRO once you click that it will let you choose which extensions to install and you should be good to go!

VSCode constantly asks me to Restore

VSCode 1.20.0 on Windows 10, with C# extension ms-vscode.csharp 1.14.0.
VSCode Terminal points to bash (Windows Subsystem for Linux)
VSCode is opened on a folder containing a .NET CORE 2.0 C# project
Everything is fine, intellisense works, project references are understood.
Whenever I switch focus to the VS Code terminal and type "dotnet build" or "dotnet test", VSCode gets confused. Red Squigglies underline every line of source code, intellisense stops working, and VSCode opens two info boxes that say
Info: There are unresolved dependencies from src\Project.csproj. Please execute the restore command to continue.
Info: There are unresolved dependencies from test\Project.Tests.csproj. Please execute the restore command to continue.
When I click the "Restore" button inside the info box, about 15 seconds later the project works again. But why, this happens all the time, I tend to dotnet build frequently. Can I configure VS Code differently to avoid this problem? It doesn't seem right that building code would break the editor functionality so I must be doing something wrong.
EDIT:
This problem seems to repro only if I dotnet build or dotnet test in WSL\bash (whether Internal or External Terminal). It doesn't seem to repro when I build or test in an external cmd.exe
EDIT:
cmd.exe dotnet --info
.NET Command Line Tools (2.1.4)
Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.4\
Microsoft .NET Core Shared Framework Host
Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
WSL\bash $ dotnet --info
.NET Command Line Tools (2.0.3)
Product Information:
Version: 2.0.3
Commit SHA-1 hash: eb1d5ee318
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.0.3/
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
The reason this might be happening could be because VS Code is using Omnisharp running on Windows - when you build using Bash, you are building for linux, and therefore all the reference paths generated in files in the obj folder will be linux paths, not Windows paths.
When Omnisharp looks for the referenced dependencies for intellisense in VS Code, it can't find them, and so VS Code requests you to restore your project.
You could confirm by checking any of the files in the obj folder, and looking at the paths.
EDIT - 2019
Just an update on this - things are looking promising. We will soon be able to use the VS Code Remote Extension Pack to run extensions INSIDE the WSL environment (or Docker Containers or even over SSH sessions). This is pretty awesome - it should mean that not only does our code run in WSL, but the extensions will also - and therefore OmniSharp extension will be running in WSL, using the Linux binaries for intellisense etc.
I am personally pretty excited by the new tools Microsoft is releasing. Its a really god time to be developing on the Windows platform with tools like WSL, VS Code, Docker and Hyper V... and the upcoming WSL 2 is going to be incredible (FULL Linux Kernal baked into Windows!!!)

Could not install typings files... in VS Code, with Bash on Ubuntu on Windows

I'm trying to use Visual Studio Code with Bash on Ubuntu on Windows. I have VS Code installed on Windows, but otherwise use Bash exclusively for my JavaScript development workflow.
I have node and npm installed on Bash (via apt-get), however, I do not have node and npm also on Windows to avoid duplication. In my VS Code settings, I have configured the integrated shell to use Bash:
"terminal.integrated.shell.windows": "C:\\windows\\Sysnative\\bash.exe"
The integrated shell works fine, and node and npm are both accessible. However, when I launch VS Code on my project, I get the warning:
Could not install typings files for JavaScript langauge features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings
I have tried both the following settings, neither of which work:
"typescript.npm": "C:\\windows\\Sysnative\\bash.exe"
"typescript.npm": "C:\\windows\\Sysnative\\bash.exe -c \"npm\""
Is it possible to get VS Code to install typings files via the npm that is installed on Bash?
Try setting “externalTerminal.windowsExec”: “bash” in your settings file to set it as the terminal executable and then restart VS Code

i had developed a tool using gtk in linux. its working fine now i want to make it port to windows?

For that tool i used glade -3 to build windows in linux and imported inside code using gtk builder, now want to port this tool to windows xp what is best way ?
thanks in advance :)
Install the GTK-all-in-one bundle available on gtk.org. Installation procedure ins included in the README file contained in the bundle. Then, install MinGW on your Windows platform, and use mingw-get (the package management tool), to install msys (a shell). For a 64-bits build, you may use MinGW-64 (which is a fork of MinGW). You then will have a platform for developing on Windows.
I personally used that platform with CMake to successfully build some code sample. Read my answer on How do I link gtk library more easily with cmake in windows? for a CMake + GTK code sample.