| <!DOCTYPE html> |
| <html lang="en"> |
| <!-- Global site tag (gtag.js) - Google Analytics --> |
| <script async src="https://www.googletagmanager.com/gtag/js?id=UA-112407000-2"></script> |
| <script> |
| window.dataLayer = window.dataLayer || []; |
| |
| function gtag() { |
| dataLayer.push(arguments); |
| } |
| gtag('js', new Date()); |
| |
| gtag('config', 'UA-112407000-2'); |
| </script> |
| |
| <!-- Google Tag Manager --> |
| <script> |
| (function (w, d, s, l, i) { |
| w[l] = w[l] || []; |
| w[l].push({ |
| 'gtm.start': new Date().getTime(), |
| event: 'gtm.js' |
| }); |
| var f = d.getElementsByTagName(s)[0], |
| j = d.createElement(s), |
| dl = l != 'dataLayer' ? '&l=' + l : ''; |
| j.async = true; |
| j.src = |
| 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; |
| f.parentNode.insertBefore(j, f); |
| })(window, document, 'script', 'dataLayer', 'GTM-KS8HHSF'); |
| </script> |
| <!-- End Google Tag Manager --> |
| |
| <head> |
| <base href="/codewind/" /> |
| <title>Tutorial: Tools for VS Code | Codewind</title> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta name="description" content="Tutorial: Tools for VS Code"> |
| <meta name="keywords" content="tools, vscode, visual, studio, code, example, how, use, using, tutorial, Codewind for VS Code tutorial"/> |
| <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png"> |
| <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png"> |
| <link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:300,400,600&display=swap" rel="stylesheet"> |
| <!-- Bootstrap CSS CDN --> |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" |
| integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> |
| <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> |
| <link rel="stylesheet" href="css/styles.css"> |
| <link rel="stylesheet" href="css/docs.css"> |
| |
| |
| </head> |
| |
| <body data-spy="scroll" data-target="#toc"> |
| <!-- Google Tag Manager (noscript) --> |
| <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KS8HHSF" |
| height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
| <!-- End Google Tag Manager (noscript) --> |
| <div class="main"> |
| <!-- Bootstrap NavBar --> |
| <nav class="navbar navbar-expand-lg navbar-light cw-banner fixed-top"> |
| <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" |
| data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" |
| aria-label="Toggle navigation"> |
| <span class="navbar-toggler-icon"></span> |
| </button> |
| <a class="navbar-brand" href=""> |
| <img src="images/header-logo.svg" class="cw-header-logo" alt=""> |
| </a> |
| <div class="collapse navbar-collapse justify-content-end cw-navbar-padding" id="navbarNavDropdown"> |
| <ul class="navbar-nav cw-navbar-nav"> |
| <li class="nav-item cw-navbar-item cw-header-link"> |
| <a class="nav-link cw-nav-link" href="docindex.html">Docs</a> |
| </li> |
| <!-- li class="nav-item cw-navbar-item" id="download-li"> |
| <button onClick="window.location.href='https://microclimate.dev/download/codewind';" type="button" class="btn cw-download-button">Download</button> |
| <a href="https://microclimate.dev/download/codewind" class="nav-link cw-nav-link cw-download-link" href="#">Download</a> |
| </li> --> |
| |
| |
| <li class="nav-item cw-navbar-item" id="github-stars-button"> |
| <!-- Place this tag where you want the button to render. --> |
| <a class="github-button" href="https://github.com/eclipse/codewind" data-size="large" |
| data-show-count="true" aria-label="Star eclipse/codewind on GitHub">Star</a> |
| </li> |
| <!-- Smaller devices menu END --> |
| |
| </ul> |
| </div> |
| </nav> |
| <!-- NavBar END --> |
| |
| <!-- Bootstrap row --> |
| <div class="row" id="body-row"> |
| <!-- Sidebar --> |
| <div id="sidebar-container" class="bg-light"> |
| <!-- Bootstrap List Group --> |
| <ul class="list-group sticky-top bg-light cw-sticky-offset"> |
| <!-- Separator with title --> |
| <li class="list-group-item cw-sidebar-separator-title cw-text-gray d-flex bg-light align-items-center menu-collapsed"> |
| <small class="badge badge-success cw-margin-auto">DOCUMENTS</small> |
| </li> |
| <!-- /END Separator --> |
| <!-- Hard coded TOC --> |
| |
| <a href="#install_on_cloud" data-toggle="collapse" aria-expanded="false" class="bg-light list-group-item list-group-item-action flex-column align-items-start collapsed"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Installing and Using Codewind on Cloud</span> |
| <span class="submenu-icon ml-auto"></span> |
| </div> |
| </a> |
| <div id="install_on_cloud" class="cw-sidebar-div cw-sidebar-submenu collapse" style=""> |
| <a href="installoncloud.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Installing and Using Codewind on Kubernetes</span> |
| </div> |
| </a> |
| <a href="supportingmultipleusers.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Support for multiple users</span> |
| </div> |
| </a> |
| <a href="viewkibanalogs.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Viewing logs using Kibana in IBM Cloud Private</span> |
| </div> |
| </a> |
| </div> |
| |
| <a href="installlocally.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Installing Codewind locally</span> |
| </div> |
| </a> |
| |
| <a href="#codewind_for_eclipse" data-toggle="collapse" aria-expanded="false" class="bg-light list-group-item list-group-item-action flex-column align-items-start collapsed"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Codewind for Eclipse</span> |
| <span class="submenu-icon ml-auto"></span> |
| </div> |
| </a> |
| <div id="codewind_for_eclipse" class="cw-sidebar-div cw-sidebar-submenu collapse" style=""> |
| <a href="mdteclipseoverview.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Overview</span> |
| </div> |
| </a> |
| <a href="mdteclipsegettingstarted.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Installation and Getting Started</span> |
| </div> |
| </a> |
| <a href="mdteclipsemanagingprojects.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Managing Codewind projects</span> |
| </div> |
| </a> |
| <a href="mdteclipsebuildproject.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Building Codewind projects</span> |
| </div> |
| </a> |
| <a href="mdteclipsedebugproject.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Debugging Codewind projects</span> |
| </div> |
| </a> |
| <a href="mdteclipsetroubleshooting.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Troubleshooting</span> |
| </div> |
| </a> |
| <a href="mdteclipseuninstall.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Uninstalling</span> |
| </div> |
| </a> |
| </div> |
| |
| <a href="#codewind_for_vscode" data-toggle="collapse" aria-expanded="false" class="bg-light list-group-item list-group-item-action flex-column align-items-start collapsed"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Codewind for VS Code</span> |
| <span class="submenu-icon ml-auto"></span> |
| </div> |
| </a> |
| <div id="codewind_for_vscode" class="cw-sidebar-div cw-sidebar-submenu collapse" style=""> |
| <a href="mdt-vsc-overview.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Overview</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-getting-started.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Getting started</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-tutorial.html" |
| |
| |
| class="cw-current-page bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Tutorial</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-commands-overview.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Commands overview</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-commands-project.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Project commands</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-commands-restart-and-debug.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Restart and debug commands</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-troubleshooting.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Troubleshooting</span> |
| </div> |
| </a> |
| <a href="mdt-vsc-uninstall.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Uninstalling</span> |
| </div> |
| </a> |
| </div> |
| |
| <a href="#configuring_codewind" data-toggle="collapse" aria-expanded="false" class="bg-light list-group-item list-group-item-action flex-column align-items-start collapsed"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Configuring Codewind</span> |
| <span class="submenu-icon ml-auto"></span> |
| </div> |
| </a> |
| <div id="configuring_codewind" class="cw-sidebar-div cw-sidebar-submenu collapse" style=""> |
| <a href="usingadifferenttemplate.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Using a template repository of your own</span> |
| </div> |
| </a> |
| |
| </div> |
| |
| <a href="guide_performance.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Guide: Monitoring applications with the performance dashboard</span> |
| </div> |
| </a> |
| |
| <a href="uninstall.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Uninstalling Codewind</span> |
| </div> |
| </a> |
| |
| <a href="troubleshooting.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Troubleshooting</span> |
| </div> |
| </a> |
| |
| <a href="limitations.html" |
| |
| |
| class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Limitations</span> |
| </div> |
| </a> |
| |
| <!-- END hard coded TOC --> |
| |
| <!-- Separator without title --> |
| <li class="list-group-item cw-sidebar-separator-title bg-light cw-text-gray d-flex align-items-center menu-collapsed"> |
| <small class="badge badge-success cw-margin-auto">HELPFUL |
| LINKS</small> |
| </li> |
| <!-- /END Separator --> |
| <a href="https://projects.eclipse.org/proposals/eclipse-codewind" class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Eclipse Codewind project page</span> |
| </div> |
| </a> |
| <a href="https://www.youtube.com/channel/UCnKCVK6RFDyHFqUmXlAhCHQ" class="bg-light list-group-item list-group-item-action"> |
| <div class="d-flex w-100 justify-content-start align-items-center"> |
| <span class="menu-collapsed">Eclipse Codewind YouTube channel</span> |
| </div> |
| </a> |
| |
| |
| <!-- Logo --> |
| <li class="list-group-item cw-logo-separator bg-light d-flex justify-content-center"> |
| <img src="images/header-logo.svg"> |
| </li> |
| </ul> |
| <!-- List Group END--> |
| </div> |
| <!-- sidebar-container END --> |
| <!-- MAIN --> |
| <div id="content-container" class="py-5 px-5"> |
| <div role="main"><h1 id="tutorial-codewind-for-vs-code">Tutorial: Codewind for VS Code</h1> |
| <p>Follow this example workflow to use the tools for VS Code to develop a Node.js project. All the features demonstrated in this tutorial are also available for Microprofile and Spring projects.</p> |
| |
| <p>For more detail on any of the commands, see the <a href="mdt-vsc-commands-overview.html">commands overview</a>.</p> |
| |
| <ol> |
| <li>First, ensure that Codewind is installed and running. For more information, see the <a href="mdt-vsc-getting-started.html">Getting started: Codewind for VS Code</a> page. Proceed after your projects appear with the <strong>Codewind view</strong>.</li> |
| <li>Create a Node.js project in Codewind. Skip this step if a Node.js project already exists. This tutorial assumes that your project is called <em>nodeproject</em>. |
| <ul> |
| <li>Right-click the <strong>Projects (Local)</strong> item in the Codewind tree and select <strong>Create new project</strong>.</li> |
| <li>In the <strong>Command Palette</strong>, select <strong>Node.js Template</strong> and press <strong>Enter</strong>.</li> |
| <li>In the <strong>Command Palette</strong>, type a name for the project and press <strong>Enter</strong>.</li> |
| </ul> |
| </li> |
| <li>Make the new project your workspace folder. This project is the only project that you need to work on for this tutorial. |
| <ul> |
| <li>Right-click the project and select <a href="mdt-vsc-commands-project.html#open-folder-as-workspace">Open Folder as Workspace</a>. VS Code restarts with the selected project folder as the workspace folder.</li> |
| </ul> |
| </li> |
| <li>Open the <strong>Project Overview</strong> page to view project information. |
| <ul> |
| <li>Right-click the project and select <a href="mdt-vsc-commands-project.html#show-project-overview">Show Project Overview</a>.</li> |
| </ul> |
| </li> |
| <li>To view the project standard output and error as you develop it, open the application logs. |
| <ul> |
| <li>Right-click the project and select <a href="mdt-vsc-commands-project.html#logs">Show Application Log</a>. The log appears in the <strong>Output</strong> view.</li> |
| <li>Node.js projects do not have build logs, but if you work on some other types of projects, you can also view the build logs.</li> |
| </ul> |
| </li> |
| <li>Open a file to edit. For example, modify the <code class="highlighter-rouge">health</code> endpoint of the default Node.js project. |
| <ul> |
| <li>Open a Javascript file, such as <code class="highlighter-rouge">nodeproject/server/routers/health.js</code>.</li> |
| <li>Make a code change.</li> |
| <li>For example, you can add the following endpoint to <code class="highlighter-rouge">health.js</code> after the existing <code class="highlighter-rouge">GET /</code> middleware function: |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> router.get('/test', function (req, res, next) { |
| return res.send("Yep, it worked!!"); |
| }); |
| </code></pre></div> </div> |
| </li> |
| <li>Codewind detects the file changes and restarts your application. |
| <ul> |
| <li>In the Codewind tree, the application stops and starts again as the application server restarts.</li> |
| <li>You can also see <strong>nodemon</strong> restart the project in the application logs.</li> |
| </ul> |
| </li> |
| <li>At this point, your VS Code should look similar to the following example: |
| <br /><img src="dist/images/cdt-vsc/tutorial-1.png" alt="Editing nodeproject" /></li> |
| </ul> |
| </li> |
| <li>To make sure your code change was picked up, test your new endpoint. |
| <ul> |
| <li>Right-click the project and select <a href="mdt-vsc-commands-project.html#open-in-browser">Open in Browser</a>. The project root endpoint opens in the browser, and the <strong>IBM Cloud Starter</strong> page appears.</li> |
| <li>Navigate to the new endpoint. If you copied the previous snippet, add <code class="highlighter-rouge">/health/test/</code> to the URL.</li> |
| <li>See the new response:<br /> |
| <br /><img src="dist/images/cdt-vsc/tutorial-2.png" alt="New endpoint response" /></li> |
| </ul> |
| </li> |
| <li>You can debug your application within the container. To debug a containerized project, restart it in <strong>Debug</strong> mode. |
| <ul> |
| <li>Right-click the project and select <a href="mdt-vsc-commands-restart-and-debug.html#restart">Restart in Debug Mode</a>.</li> |
| <li>The project restarts into the <strong>Debugging</strong> state.</li> |
| <li>A debug launch configuration is created in <code class="highlighter-rouge">nodeproject/.vscode/launch.json</code>.</li> |
| <li>The debugger attaches, and VS Code opens the <strong>Debug</strong> view.</li> |
| <li>You can detach and <a href="mdt-vsc-commands-restart-and-debug.html#attach-debugger">reattach the debugger</a> at any time, as long as the project is still in <strong>Debug</strong> mode.</li> |
| </ul> |
| </li> |
| <li>All of the VS Code debug functionality is now available. |
| <ul> |
| <li>If your code matches the screenshot, set a breakpoint at line 13 in <code class="highlighter-rouge">health.js</code>.</li> |
| <li>Refresh the new endpoint page that you opened in step 7 so that a new request is made, and the breakpoint gets hit.</li> |
| <li>VS Code suspends your application at the breakpoint. Here you can step through the code, inspect variables, see the call stack, and evaluate expressions in the <strong>Debug Console</strong>. |
| <img src="dist/images/cdt-vsc/tutorial-3.png" alt="Debugging" /></li> |
| </ul> |
| </li> |
| </ol> |
| </div> |
| </div> |
| </div> |
| <!-- Main Col END --> |
| <!-- footer row --> |
| <footer> |
| <div class="row" id="footer-div"> |
| <div class="col-lg-3 col-md-3 footer-col text-center"> |
| <div> |
| <div> |
| <a href="https://twitter.com/EclipseCodewind"><img src="images/twitter-logo.svg" class="cw-logo" /></a> |
| </div> |
| <div>@EclipseCodewind</div> |
| </div> |
| </div> |
| |
| <div class="col-lg-3 col-md-3 footer-col text-center"> |
| <div> |
| <div> |
| <a href="https://github.com/eclipse/codewind"><img src="images/github-logo.svg" |
| class="cw-logo" /></a> |
| </div> |
| <div>@Codewind</div> |
| </div> |
| </div> |
| <div class="col-lg-3 col-md-3 footer-col text-center"> |
| <div> |
| <div> |
| <a href="mailto:codewind-dev@eclipse.org"><img src="images/email-icon.svg" class="cw-logo" /></a> |
| </div> |
| <div>@Codewind</div> |
| </div> |
| </div> |
| |
| <div class="col-lg-3 col-md-3 footer-col text-center"> |
| <div class="cw-logo-mm" > |
| <div class="cw-logo-mm" > |
| <a href="https://mattermost.eclipse.org/eclipse/channels/eclipse-codewind"><img src="images/mattermost-logo.png" class="cw-logo-mm" /></a> |
| </div> |
| </div> |
| </div> |
| |
| </div> |
| </footer> |
| <!-- footer row END --> <!-- Jquery --> |
| <script |
| src="https://code.jquery.com/jquery-3.4.1.min.js" |
| integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" |
| crossorigin="anonymous"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" |
| integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"> |
| </script> |
| |
| |
| |
| <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" |
| integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"> |
| </script> |
| |
| |
| <!-- Font Awesome JS --> |
| <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" |
| integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"> |
| </script> |
| <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" |
| integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"> |
| </script> |
| <!-- Place this tag in your head or just before your close body tag. --> |
| <script async defer src="https://buttons.github.io/buttons.js"></script> |
| |
| <script src="js/jquery.matchHeight-min.js"></script> |
| <script src="js/index.js"></script> |
| <script src="js/docs.js"></script> |
| |
| </div> |
| </body> |
| |
| </html> |