Developer Resources and Skill Writing Tips

Overview

This article provides a basic overview of resources and coding practices to keep in mind when writing skills in Visual Studio Code.

 

In this Article

 

Skill Coding Language

All skills will be written using TypeScript, a coding language created by Microsoft as a superset of JavaScript. A few resources on TypeScript, as well as JavaScript are included below if needed for reference while writing your skills.

Supported Language Versions

  • TypeScript: v2.9.2
  • JavaScript: ES6 and prior

Unsupported Keywords

The JavaScript keywords listed below are not supported or have limited support as part of skill writing. A skill with these keywords will not run and will generate an error in the skill history.

Keyword Skill Support
import/require

Limited 

Allowed Packages: underscore (1.8.3), andiskills, and andiexternal

clearImmediate/setImmediate No
clearInterval/setInterval No
eval No


Resources

TypeScript

 

JavaScript

 

Additional Resources

If needing more of an introduction to computer science principles:

 

Skill Writing Tips

IntelliSense

IntelliSense.PNG

  • Visual Studio Code includes IntelliSense which allows you to see possible suggestions for your function properties as you write your code. Property suggestions should appear after you type a ‘.’ Another way to trigger the possible properties is to hit CTRL+Space. Once you find the property you need, you can either select it and hit enter or type the property. For more information, see IntelliSense.

  • If you’re unsure of what a property does, you can complete one of the following options to see its definition, if available, in a new tab in the IDE:

    • Place your cursor anywhere in that specific property’s name and select F12; OR

    • Right-click on the property and select one of the following options from the menu:
      • Go to Definition
      • Peek Definition – this will generate a small pop-up window instead of a new tab
      • Go to Type Definition

General Coding Practices

  • Use // to enter comments to describe what the line of code is intended to do or provide additional instructions. Not only will this allow you to remember the intent of the code, but it will also be helpful if you share that skill code with other skill writers in your organization. Because json files do not accept comments, you will not be able to leave comments in the skillmanifest.

  • As you write your skill or make changes, updates are not automatically saved in the IDE. Make sure you save your work as you go.

Line Breaks

  • If wanting to include line breaks in field tag messages, chat responses, or email messages, include <br/> or \n in the message string where you'd like the break to occur

    • Example: "it's a <br/>break" becomes "it's a
      break"

Cross-Browser Compatibility

  • When using shouldIShow and action functions, which write code to the browser, you need to make sure your code is cross-browser compatible. IE 11 in particular does not support some popular Javascript methods. Check here to see what is not supported for your browser version in Javascript (scroll to the bottom of the page after you select your browser version).

Unit Testing

  • If familiar with unit testing, use Wallaby and Mocha to test your code prior to deploying your skill. The mocha test files are not required to be utilized prior to deploying your skill.

 

 

Was this article helpful?
2 out of 2 found this helpful