ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

i​Rules

by billchurch ST3

iRules Syntax Highlighting for Sublime Text Editor http://www.sublimetext.com

Details

  • 1.0.1
    0.9.10
  • github.​com
  • github.​com
  • 4 days ago
  • 25 minutes ago
  • 11 years ago

Installs

  • Total 645
  • Win 323
  • Mac 259
  • Linux 63
Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

iRules for Sublime Text

Syntax highlighting, completions, snippets and a formatter for F5 BIG-IP iRules in Sublime Text 4.

Command completions

Features

  • Highlighting for every documented command and event, generated from F5's iRules reference (current through BIG-IP 21.0). Deprecated commands and events are marked deprecated; Tcl commands disabled in iRules are marked illegal; an unknown event name after when is flagged without breaking the rest of the file. (Your color scheme must style invalid.deprecated and invalid.illegal; the built-in Monokai does.)
  • Completions for about 1,000 commands. Each shows a one-line description, the BIG-IP version that introduced it, and a link to F5's reference page.
  • Event completions only where they belong: right after when. Completing when (or typing when and a space) opens the event list straight away. Picking an event expands it to when EVENT priority 500 { with a body: 500 is selected so you can type over it, and Tab moves into the body.
  • Double-substitution warnings: expr, eval and if without braces, and switch, regexp, regsub, class match and similar without --.
  • Formatter: iRules: Format Code re-indents the selection, or the whole file, using your view's tab settings. Optional format on save. It never changes the text of a multi-line "..." string, or of a braced payload whose content starts on the same line as its { (HTTP::respond 200 content {<html>...). A payload whose { ends its line looks like a code block and is re-indented, so start the content on the brace's line or keep it in a variable.
  • Snippets: when (opens the event list), if, ife, ifei, for, foreach, while, switch, proc. A word with a snippet appears once in the completion list, as the snippet.

Deprecated commands

Install

Requires Sublime Text 4 (build 4107 or later).

  1. Open the Command Palette (⌘⇧P on macOS, CtrlShiftP elsewhere).
  2. Run Package Control: Install Package and choose iRules.

Files ending in .irul, .irule or .irules open as iRules. For other files use View → Syntax → iRule.

Sublime Text 3 users keep receiving version 0.9.10.

Installed from the GitHub URL? Older instructions had you add this repository to Package Control by URL. Remove that repository (Package Control: Remove Repository) and the sublime-iRules package, then install iRules as above so you get updates.

Settings

Preferences → Package Settings → iRules → Settings:

{
    // Re-indent the whole file every time an iRule is saved.
    "format_on_save": false
}

Want more? Try tcl-lsp

This package gives you highlighting, completions and a formatter. If you want an editor that understands your iRules, have a look at tcl-lsp by James Deucker (@bitwisecook).

James has done more for this package than almost anyone. He maintained it through 2019, brought it up to date for TMOS 15.1, and wrote the formatter. Before that he built the vscode-iRule extension for VS Code. tcl-lsp is his language server for Tcl 8.4–9.1, F5 iRules, iApps and other Tcl dialects. It adds diagnostics, hover help, go to definition and references, rename, signature help, code actions and more, and it works in Sublime Text, VS Code, Neovim, Zed, Emacs, Helix and JetBrains IDEs. Thank you, James.

To use it alongside this package in Sublime Text:

  1. Install LSP and LSP-Tcl with Package Control.
  2. Open Preferences → Package Settings → LSP → Servers → LSP-Tcl and add source.irule to the selector, so the server also runs on files that use this package's iRule syntax:
{
       "selector": "source.tcl | source.irule"
   }

tcl-lsp chooses its iRules dialect from the .irul, .irule and .irules extensions, so no other setting is needed. See the tcl-lsp Sublime Text guide for details.

Contributing

Bug reports and pull requests are welcome at https://github.com/billchurch/sublime-iRules/issues. See CONTRIBUTING.md for running the tests and docs/maintaining-data.md for refreshing the command and event lists from F5.

License

MIT

Credits

Created by Bill Church in 2014. James Deucker (@bitwisecook) maintained it through 2019 and rebuilt the syntax and the formatter. Thanks also to Shain Singh and everyone who has filed issues.

Command and event descriptions come from F5's iRules reference.