Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

How to install visual studio code?

Setting up Visual Studio Code

The VS Code Ballerina extension provides the Ballerina development capabilities in VS Code. The below sections include instructions on how to download, install, and use the features of the VS Code extension.

Downloading VS Code

Download the Visual Studio Code editor



Installing the extension

  • Installing via the VS Code editor
  • Installing by downloading the extension


git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'

Debugging

Configure debugger

Open the Command Palette (Ctrl+Shift+P) and select Debug: Open launch.json, which will prompt you to select the environment that matches your project (Node.js, Python, C++, etc). This will generate a launch.json file. Node.js support is built-in and other environments require installing the appropriate language extensions. See the debugging documentation for more details.


Task runner

Auto detect tasks

Select Terminal from the top-level menu, run the command Configure Tasks, then select the type of task you'd like to run. This will generate a tasks.json file with content like the following. See the Tasks documentation for more details.

// See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "type": "npm", "script": "install", "group": { "kind": "build", "isDefault": true } } ] }

There are occasionally issues with auto generation. Check out the documentation for getting things to work properly.

Run tasks from the Terminal menu

Select Terminal from the top-level menu, run the command Run Task, and select the task you want to run. Terminate the running task by running the command Terminate Task


Define keyboard shortcuts for tasks

You can define a keyboard shortcut for any task. From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench.action.tasks.runTask command, and define the Task as args.

For example, to bind Ctrl+H to the Run tests task, add the following:

{
  "key": "ctrl+h",
  "command": "workbench.action.tasks.runTask",
  "args": "Run tests"
}

Run npm scripts as tasks from the explorer

With the setting npm.enableScriptExplorer, you can enable an explorer that shows the scripts defined in your workspace.

Filter problems

From the explorer you can open a script in the editor, run it as a task, and launch it with the node debugger (when the script defines a debug option like --inspect-brk). The default action on click is to open the script. To run a script on a single click, set npm.scriptExplorerAction to "run". Use the setting npm.exclude to exclude scripts in package.json files contained in particular folders.

With the setting npm.enableRunFromFolder, you can enable to run npm scripts from the File Explorer's context menu for a folder. The setting enables the command Run NPM Script in Folder... when a folder is selected. The command shows a Quick Pick list of the npm scripts contained in this folder and you can select the script to be executed as a task.

Post a Comment

0 Comments