botserver/docs/src/chapter-13-community/ide-extensions.md

6.2 KiB

IDEs

General Bots supports development with any text editor or IDE. Choose the one that works best for your workflow.

Zed Editor (Best for Rust Development)

Zed is a high-performance, collaborative code editor that excels at Rust development and is recommended for working with General Bots core.

Why Zed?

  • Native Rust support with excellent syntax highlighting
  • Fast performance and minimal resource usage
  • Built-in collaboration features
  • Modern, clean interface

Installation

# Install Zed
curl https://zed.dev/install.sh | sh

You can use any IDE or text editor you prefer:

Visual Studio Code

  • Extensive extension marketplace
  • Good BASIC syntax highlighting with custom extensions
  • Integrated terminal for running General Bots
  • Git integration

IntelliJ IDEA / RustRover

  • Excellent Rust support
  • Powerful refactoring tools
  • Database tools for PostgreSQL integration

Neovim

  • Lightweight and fast
  • Highly customizable
  • Terminal-based workflow

Sublime Text

  • Fast and responsive
  • Multiple cursors and powerful search
  • Customizable syntax highlighting

BASIC Script Support

For editing .bas files (General Bots dialog scripts): { "bindings": { "cmd-shift-b": "botserver:run-script", "cmd-shift-d": "botserver:deploy-bot", "cmd-shift-l": "botserver:view-logs" } }


#### Project Settings

Create `.zed/settings.json` in your bot project:
```json
{
  "file_types": {
    "BASIC": ["*.bas", "*.gbdialog"],
    "Config": ["*.csv", "*.gbot"]
  },
  "format_on_save": true,
  "tab_size": 2
}

Vim/Neovim Plugin

Installation

Using vim-plug:

" ~/.vimrc or ~/.config/nvim/init.vim
Plug 'botserver/vim-botserver'

Using lazy.nvim:

-- ~/.config/nvim/lua/plugins/botserver.lua
return {
  'botserver/nvim-botserver',
  config = function()
    require('botserver').setup({
      server_url = 'http://localhost:8080',
      default_bot = 'edu'
    })
  end
}

Features

Syntax Files

" ~/.vim/syntax/basic.vim
syn keyword basicKeyword TALK HEAR SET GET LLM
syn keyword basicConditional IF THEN ELSE END
syn keyword basicRepeat FOR EACH NEXT
syn match basicComment "^REM.*$"
syn match basicComment "'.*$"

Commands

  • :BotDeploy - Deploy current bot
  • :BotRun - Run current script
  • :BotLogs - View server logs
  • :BotConnect - Connect to server

Emacs Mode

Installation

;; ~/.emacs.d/init.el
(add-to-list 'load-path "~/.emacs.d/botserver-mode")
(require 'botserver-mode)
(add-to-list 'auto-mode-alist '("\\.bas\\'" . botserver-mode))

Features

Major Mode

(define-derived-mode botserver-mode prog-mode "BotServer"
  "Major mode for editing BotServer BASIC scripts."
  (setq-local comment-start "REM ")
  (setq-local comment-end "")
  (setq-local indent-line-function 'botserver-indent-line))

Key Bindings

  • C-c C-c - Run current script
  • C-c C-d - Deploy bot
  • C-c C-l - View logs

Sublime Text Package

Installation

# Via Package Control
# Cmd+Shift+P -> Package Control: Install Package -> BotServer

# Manual installation
cd ~/Library/Application\ Support/Sublime\ Text/Packages
git clone https://github.com/botserver/sublime-botserver BotServer

Features

  • BASIC syntax highlighting
  • Build system for running scripts
  • Snippets for common patterns
  • Project templates

TextMate Bundle

Installation

cd ~/Library/Application\ Support/TextMate/Bundles
git clone https://github.com/botserver/botserver.tmbundle

Features

  • Language grammar for BASIC
  • Commands for deployment
  • Tab triggers for snippets

Language Server Protocol (LSP)

BotServer includes an LSP server that works with any LSP-compatible editor:

Starting the LSP Server

botserver --lsp --stdio

Capabilities

  • Completion
  • Hover documentation
  • Go to definition
  • Find references
  • Diagnostics
  • Code actions

Configuration Example

For any LSP client:

{
  "command": ["botserver", "--lsp", "--stdio"],
  "filetypes": ["basic", "bas"],
  "rootPatterns": [".gbai", "config.csv"],
  "initializationOptions": {
    "bot": "default"
  }
}

Common Features Across All Editors

Snippets

Tool Definition

PARAM ${name} AS ${type} LIKE "${example}" DESCRIPTION "${description}"
DESCRIPTION "${tool_description}"
${body}

Dialog Flow

TALK "${greeting}"
HEAR response
IF response = "${expected}" THEN
    ${action}
END IF

Knowledge Base Usage

USE KB "${collection}"
# System AI now has access to the KB
TALK "How can I help you with ${collection}?"
CLEAR KB

File Associations

Extension File Type Purpose
.bas BASIC Script Dialog logic
.gbdialog Dialog Package Contains .bas files
.gbkb Knowledge Base Document collections
.gbot Bot Config Contains config.csv
.gbtheme Theme Package CSS themes
.gbai Bot Package Root container

Debugging Support

Breakpoints

Set breakpoints in BASIC scripts:

TALK "Before breakpoint"
' BREAKPOINT
TALK "After breakpoint"

Watch Variables

Monitor variable values during execution:

' WATCH: user_name
' WATCH: greeting
user_name = GET "name"
greeting = "Hello " + user_name

Step Execution

Control flow with debug commands:

  • Step Over: Execute current line
  • Step Into: Enter function calls
  • Step Out: Exit current function
  • Continue: Resume execution

Best Practices

  1. Use Format on Save: Keep code consistently formatted
  2. Enable Linting: Catch errors early
  3. Configure Shortcuts: Speed up common tasks
  4. Use Snippets: Reduce repetitive typing
  5. Keep Extensions Updated: Get latest features and fixes

Troubleshooting

LSP Not Starting

  • Check botserver binary is in PATH
  • Verify server is running on expected port
  • Review LSP logs in editor

Syntax Highlighting Missing

  • Ensure file extensions are properly associated
  • Restart editor after installing extension
  • Check language mode is set correctly

Commands Not Working

  • Verify server connection settings
  • Check API credentials if required
  • Review editor console for errors