BotBuilder-Samples/experimental/adaptive-tool
Josh Gummersall 50c827dd3f
bump: js to 4.13.4 (#3282)
2021-05-18 17:16:50 -07:00
..
.vscode Qna support in vscode extension (#2962) 2021-01-13 15:17:55 +08:00
client Adaptive-tools update (#3107) 2021-03-04 18:51:31 +08:00
resources Add icon for adaptive tool (#3125) 2021-03-17 10:52:47 +08:00
server bump: js to 4.13.4 (#3282) 2021-05-18 17:16:50 -07:00
.env Update adaptive-tool regularly (#2955) 2020-11-30 10:02:37 +08:00
.eslintrc.js T sheny/completion lg (#2522) 2020-06-30 10:07:51 +08:00
.gitignore update adaptive-tool package (#3202) 2021-04-27 14:00:13 +08:00
.vscodeignore Qna support in vscode extension (#2962) 2021-01-13 15:17:55 +08:00
README.md Add QNA description in adaptive tools README (#3039) 2021-01-20 16:14:17 +08:00
languageServer.md Fix adaptive-tool does not work in offline install case (#2655) 2020-08-07 13:23:12 +00:00
package.json update adaptive-tool package (#3202) 2021-04-27 14:00:13 +08:00
shared.webpack.config.js fix bundling not work in certain case (#2610) 2020-07-23 20:51:49 +08:00
tsconfig.base.json bundling LG extension code to reduce the package size (#2586) 2020-07-23 10:52:33 +00:00
tsconfig.json Transform lu extension into LSP (#2601) 2020-08-03 01:54:35 +00:00

README.md

Bot Framework Adaptive Tools

Bot Framework Adaptive Tools is a Microsoft VS Code extension that helps developers handle LG (.lg), LU (.lu), QNA (.qna), and dialog (.dialog) files efficiently. Adaptive Tools has tools and settings that make it easy to debug, analyze and enhance you language files.

Supported features include the following:

Feature File type supported
Syntax highlighting LG, LU, QNA
Diagnostic checks LG, LU, QNA
Autocompletion LG, LU, QNA
Template and function hover LG
Template definition LG
Template, function, and structure suggestions LG
Debugging LG, LU, QNA, Dialog

Getting started

Adaptive Tools can be installed from Visual Studio Marketplace or from a local VSIX file.

Install from the Visual Studio Marketplace

  1. Install Bot Framework Adaptive Tools from the VS Code tab of the Visual Studio Marketplace.
  2. Open an LG, LU, QNA, or dialog file and the extension will activate.

Install from a local VSIX file

  1. Clone the BotBuilder-Samples repo.

  2. In a terminal or command prompt, navigate to the directory containing the Adaptive Tools, experimental/adaptive-tool, and run the following commands:

    npm install
    
    npm run build
    
  3. Run the command below to install vsce:

    npm install -g vsce
    
  4. Finally, run the following command to export the VSIX file:

    vsce package
    

    You're now ready to install Adaptive Tools.

  5. Open VS Code and open the Extensions view.

  6. Click the Views and More Actions button (...) in the upper-right corner of the Extensions panel. Then click Install from VSIX.. and select the VSIX file you created earlier.

  7. Open an LG, LU, QNA, or dialog file and the extension will activate.

Language features

Language features are driven by the language server protocol. See the Language Server Extension Guide for more information.

Syntax highlighting, diagnostic checks, and autocompletion

LU

Different colors and styles for intent, entity, and comment components: lu_syntax_highlighting

Formatting warnings and errors: lu_diagnostic

Automatic completion of some entities: lu_completion

QNA

Different colors and styles for intent, entity, and comment components: qna_syntax_highlighting

Formatting warnings and errors: qna_diagnostic

Automatic completion of some entities: qna_completion

LG

Different colors and styles for template, function, multiline, structure, comment, condition, and switch components: lg_syntax_highlighting

Formatting warnings and errors: lg_diagnostic

Hover, suggestions, and navigation

LG

Template reference hover: template_hover

Prebuilt function hover: function_hover

Suggestions for templates and functions: function_template_suggestion

Structure property suggestions: structure_suggestion

Template navigation:

template_definition

Debugging

Adaptive Tools lets developers debug LG, LU, QNA, and dialog files. When using a debugger you set breakpoints in your code, but those breakpoints correspond to classes and methods. Setting breakpoints in dialogs, LG, LU and QNA files allow you to get breakpoints in specific instances of a template rather than a code breakpoint which applies to all instances. This section covers the steps and shows an example of how to configure, initialize, and debug a bot.

Configuration

  • Install the Adaptive Tools extension.
  • Open the LG, LU, QNA, or dialog file to debug.
  • To configure Visual Studio Code, add a target in your launch.settings file.

Here's an example of a typical launch.json:

{
    "type": "json",
    "request": "attach",
    "name": "Attach to Dialog",
    "debugServer": 4712
}

debugServer refers to the port bot runs on. The default value is 4712.

Start your bot and complete initialization

  1. Start a bot. For this example we'll start the bot project TodoBot in SampleBots.
  2. Make sure the debugger port has been registered in BotFrameworkHttpAdapter with the UseDebugger method.
  3. There are several ways to initialize a bot, and the BotFramework Emulator is a typical approach. Open the Emulator and attach it to the bot to finish the initialization.

Debug your bot

  1. Run the VS Code program by clicking F5 and set break points in the LG, LU, QNA, and dialog files.
  2. Chat with the bot in the Emulator.
  3. If the extension is working properly the cursor will stop when the code hits any of corresponding breakpoints.

breakpoints

Adaptive Tools settings

Settings for LG files can be found under LG in the Extensions settings.

Setting name Description
LG.Expression.ignoreUnknownFunction Set the severity diagnostic level for unknown functions in a LG file.

The levels include:
error: treat unknown functions as an error
warn: treat unknown functions as a warning
ignore: ignore unknown functions
LG.Expression.customFunctionList Create a comma-separated customized function list (example: a, b, c). You can use both custom functions added in your logic as well as functions added to the customFunctionList setting.

Contributing

Code contributions are welcome via the BotBuilder-Samples repo. Change NODE_DEBUG to true in .env for debugging.

Feedback

File bugs in GitHub Issues.