Skip to main content

VSCode Extension

The official hitspec VSCode extension (v0.2.0) provides syntax highlighting, snippets, and language configuration for .http and .hitspec files.

Features

  • Full syntax highlighting via TextMate grammar
  • 46 code snippets covering requests, assertions, captures, annotations, blocks, and built-in functions
  • Comment toggling (#)
  • Bracket matching and auto-closing for {}, [], (), "", '', {{}}, and >>> / <<<
  • Code folding for request separators (###) and assertion blocks

Syntax Highlighting

The TextMate grammar highlights these elements:
  • HTTP methods — GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE, CONNECT, WS
  • Request separators### lines
  • Annotations@name, @tags, @auth, @depends, @if, @unless, @import, @stress.*, @contract.*, and others
  • Headers — key-value pairs like Content-Type: application/json
  • Assertion blocks (>>> / <<<) — expect keyword, comparison operators (==, !=, >, <, >=, <=), matchers (contains, matches, exists, type, schema, snapshot, etc.), and subjects (status, body, header, duration)
  • Typed blocks>>>capture, >>>graphql, >>>db, >>>shell, >>>multipart, >>>variables
  • Variable interpolation{{variable}}
  • Built-in functions$uuid(), $timestamp(), $env(), $random(), and others
  • File includes< ./path/to/file
  • Query parameters? key = value and & key = value
  • Strings, numbers, booleans, null

Installation

1

Build the extension

cd apps/vscode
npm install
npm run package
This generates a .vsix file in the apps/vscode directory.
2

Install in VSCode

  1. Open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux)
  2. Run Extensions: Install from VSIX…
  3. Select the generated .vsix file
The extension is declarative-only — no IntelliSense or autocomplete beyond snippets. The REST Client extension is an alternative for basic .http support, but it does not highlight assertion blocks, typed blocks, or annotations.

Neovim

The hitspec Neovim plugin provides syntax highlighting, filetype detection, buffer settings, and optional LuaSnip snippets for .http and .hitspec files.

Features

  • Syntax highlighting via Vim syntax file (not TreeSitter)
  • Filetype detection for .http and .hitspec
  • Buffer settings: commentstring (# %s), 2-space indentation
  • 57 LuaSnip snippets (optional) covering HTTP methods, assertion/capture blocks, annotations, built-in functions, and a complete request template

Installation

{
  "abdul-hamid-achik/hitspec",
  ft = { "http", "hitspec" },
  config = function()
    require("hitspec").setup()
  end,
}
Snippets require LuaSnip. Call require("hitspec").setup() in your config to register them. If LuaSnip is not installed, snippets are silently skipped.

Shell Completions

hitspec can generate completion scripts for your shell, giving you tab completion for commands and flags.
hitspec completion bash > /etc/bash_completion.d/hitspec
After installing completions, restart your shell or source the completion file for changes to take effect.
On macOS with Homebrew, Bash completions are typically loaded from /opt/homebrew/etc/bash_completion.d/. For Zsh, you may need to add the completions directory to your fpath in ~/.zshrc before compinit is called.