using cmder in vs code for debug


  • | 1686 points

    Hi,
    First all Laragon rocks, only started using it recently but I have been looking for a replacement for usbwebserver for a long time and Laragon is super cool, esp with the node.js support, it is the most up to date , portable variant of Node I have found, now for my problem... I have looked through the last few years of posts and am I right in thinking it is basically impossible to use Cmder as the default terminal in VSCode? I really wanted to use the VS Code debugger for Node.js but it doesn't work I think its because it still looking at the PC environment and not the Laragon local, I thought that if we got Cmder to work with it, it might all be OK or is there another solution?Or am I right that this is just a casualty of going portable? Either way it would be nice to know. thanks - zen

    thanks

    zen


  • | 3487 points

    Hey @zenonline,

    How's it going? Not sure if you've already read this, but maybe it would help: https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration

    I thought about setting that up myself as well, but I kind of enjoy the extra real estate in VS Code by having the terminal in a separate window. My thinking is that you should be able to reference the Cmder path in the Laragon root folder to get it to work the way you want. I hope it helps! =)


  • | 1686 points

    Hi @maxxheth,

    Thanks a lot for that link it was really helpful and does 90% of what I need.
    The problem I have is that : a. I am no good at these types of things :( b. I want to use Laragon on a USB drive

    I want to use it on a pendrive so that I can work on the same files at home and at work, the problem is that I've hardcoded the directory of Cmder to the D drive but that isn't always the case, on some machines it will E: others F: etc, I tried using relative paths as in: "CMDER_ROOT": "../../cmder" but it creates an error, it think that .. is a command and I cant seem to find an environmental value. The code I'm currently now using in settings.json is:
    {
    "terminal.explorerKind": "external",
    "terminal.integrated.shell.windows": "cmd.exe",
    "terminal.integrated.env.windows": {
    "CMDER_ROOT": "D:\PortableApps\laragon\bin\cmder"
    },
    "terminal.integrated.shellArgs.windows": [
    "/k D:\PortableApps\laragon\bin\cmder\vendor\init.bat"
    ],
    }
    regards
    Zen


  • | 1686 points

    Damn also just realised that it hasn't changed the setting for the debugger, that is still using the desktop version and not the one on Laragon, any ideas what settings I need to change for this?

    thanks

    Zen


  • | 1686 points

    OK so I have sorted out the debugging on a fixed drive on file launch.json:

    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${workspaceFolder}\onetest\app.js",
    "outFiles":[
    "${workspaceFolder}/*/.js"
    ],
    "runtimeExecutable": "E:\\PortableApps\\laragon\\bin\\nodejs\\node-v12\\node.exe"
    }
    ]
    }
    But the problem that it is a fixed and not a relative path is still the issue, does anyone know how to make it a relative path that vs code will understand?

    thanks again for your time and help

    Zen


  • | 3487 points

    Hey @zenonline,

    I found this on the Visual Studio Code website: https://code.visualstudio.com/docs/editor/variables-reference

    This may be a useful extension for your use case: https://marketplace.visualstudio.com/items?itemName=jakob101.RelativePath

    I would also try adding relative variables like %CMDER_ROOT% to the PATH of whichever computer you happen to be using and pointing it to the laragon\bin\cmder folder.


  • | 1686 points

    Hi @maxxheth,

    thanks for that link, I do really appreciate you helping.

    This is where (or to be more precise another point where..) I am a complete noob at, being self taught I only learnt the stuff that I knew I needed to know at the time and this area isn't one of them :( from what i remember of that link, VSCode only has environmental references to VSCode itself and the working file/directory and nowhere else, it seems to be on a lot of peoples wish list for the last 4+ years but for some reason it has not been implemented. The relative path module I think is to help find files quickly for the apps you are building, I don't think it works within the JSON files. Finally although I understand the idea of PATH my noobiness is strong with this one, I understand that for some PATHs definitions need Admin access and I can't get that at work, plus at the moment I have no idea how to do it, I',m assuming I could create a .bat file to so the job but alas for now I'll just manually change the json files until I have more time to beat this bugger.

    thanks again for the help

    regards

    zen


  • | 3487 points

    Sure thing! =)

    Well, if you do ever manage to gain admin access (I can imagine you could make a case for enhancing productivity in a way that benefits your company or team), here's what you can try:

    1. Pop open the Start Menu and type in "advanced system settings" into the search bar.

    2. In the dialog that pops up, click on the button in the bottom-right-hand corner that says "Environmental variables".

    3. In the next dialog that pops up, you'll see two fields. The PATH variable is in the "System variables" field. When it click it open, you'll see a list of all the files and directories that are currently in the PATH.

    4. Since you want to reference Cmder via the variable %CMDER_ROOT%, just click the "New" button, plug %CMDER_ROOT% into the "Variable name" field and then the Cmder bin path into the "Variable path" field.

    5. Go to "PATH" or "Path" depending on how it's spelled, click "New", and then enter the %CMDER_ROOT% variable into the field.

    After that, click all the OK buttons, restart the computer, and then you should be all set.

    After reviewing the doc about assigning variables and such, you should be able to reference the Cmder path like you tried doing before:

    "terminal.integrated.env.windows": {
    "CMDER_ROOT": "D:\PortableApps\laragon\bin\cmder"
    }

    Hope that works out!


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.