none
How To Install Json Task in VS Code?

    Question

  • hi

    i'd like to add an "open in browser" feature to VS Code. 

    i found this:
    http://donovanbrown.com/post/2015/05/21/launch-default-browser-from-visual-studio-code

    but i can't get it to work. how to install? 

    i read .settings folder is now called .tasks, but i cannot find either folder. Should i put the json file here?
    \Microsoft VS Code\resources\app\out\vs\workbench\parts\tasks

    Is it ok to change it's name to browse.JSON?
    Am i supposed to copy this code into some other tasks config file?

    I played around with stuff in this thread, but didn't get anywhere.
    http://stackoverflow.com/questions/34268034/where-is-the-tasks-json-file-in-vscode

    thx!


    • Edited by johny w Saturday, January 02, 2016 11:18 PM
    Wednesday, December 30, 2015 10:31 PM

Answers

  • thx, but we don't have an answer yet. 

    Let's consider a simple windows command. I tried this:

    • i executed the following from a windows command line:
    • start chrome C:\Path-To-My-HTML-File

    that worked. The file was opened in chrome. Then i tried the following:

    • added the following to task-runner:
    {
        "version""0.1.0",
        "command""start chrome",
        "isShellCommand"true,
        "args": ["${file}"]

    }

    • this returns:

    '"start chrome"' is not recognized as an internal or external command,
    operable program or batch file."

    what's the problem?

    it works if i put the whole path to chrome into tasks.json, but i should not have to put the whole path the to executable:

     // Open in browser
     {
        "version": "0.1.0",
        "command": "C:\\Users\\BOOM\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
        "isShellCommand": true,
        "args": ["${file}"]
    }


    thx


    • Edited by johny w Tuesday, January 05, 2016 6:57 PM
    • Marked as answer by johny w Wednesday, January 06, 2016 9:34 AM
    Tuesday, January 05, 2016 6:31 PM

All replies

  • figured out i need to put package.json in %USERPROFILE%\.vscode\extensions, in its own folder. I did not change the name of package.json. Still not working. 

    Then i found this-

    http://stackoverflow.com/a/30043507/209942

    Followed the instructions. Unsure whether to "change" parameters in task runner, or ADD that code to task runner. 

    just getting "Failed to launch external program chrome {$file}. spawn chrome ENOENT"

    appreciate any help. -thx

    Saturday, January 02, 2016 11:23 PM
  • Hi johny w,

    Since the document shared by you was the third party site, my suggestion is that you could add a comment here:

    http://donovanbrown.com/post/2015/05/21/launch-default-browser-from-visual-studio-code

    So we could get the direct information from the document writer, so we could know that how we could achieve this extension of the VS code.

    A document shared us how to create a task for VS code, maybe it would provide you some useful information about "how to add the task to the tasks.json file".

    http://stevemichelotti.com/create-node-task-for-visual-studio-code/

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 04, 2016 9:10 AM
    Moderator
  • thx, but we don't have an answer yet. 

    Let's consider a simple windows command. I tried this:

    • i executed the following from a windows command line:
    • start chrome C:\Path-To-My-HTML-File

    that worked. The file was opened in chrome. Then i tried the following:

    • added the following to task-runner:
    {
        "version""0.1.0",
        "command""start chrome",
        "isShellCommand"true,
        "args": ["${file}"]

    }

    • this returns:

    '"start chrome"' is not recognized as an internal or external command,
    operable program or batch file."

    what's the problem?

    it works if i put the whole path to chrome into tasks.json, but i should not have to put the whole path the to executable:

     // Open in browser
     {
        "version": "0.1.0",
        "command": "C:\\Users\\BOOM\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
        "isShellCommand": true,
        "args": ["${file}"]
    }


    thx


    • Edited by johny w Tuesday, January 05, 2016 6:57 PM
    • Marked as answer by johny w Wednesday, January 06, 2016 9:34 AM
    Tuesday, January 05, 2016 6:31 PM
  • Hi johny w,

    It seems that it really has the specific requirement for browsers in the task-runner.

    Reference:

    How to Add a Browser to Task Runner in Visual Studio Code

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 06, 2016 7:58 AM
    Moderator