A Lasso syntax mode for Coda 2.5. This is a replacement for the original LassoScript-HTML mode included in Coda, and comes with improved file recognition, syntax highlighting, code folding, autocompletion, support for the navigator sidebar, and full support for Lasso 9 syntax.
Download/extract the zip or clone this repo, rename the folder to
Lasso-HTML.mode, and double-click the resulting package. Or, drop into
~/Library/Application Support/Coda 2/Modes. If that folder doesn't exist,
Then, to have Coda use the mode, either:
open Coda's Preferences and assign the ".lasso" and ".inc" extensions to Lasso-HTML under Editor > Custom Syntax Modes
inside the Coda application package, remove the old LassoScript-HTML mode from
Full support for Lasso 9 syntax, including all delimiter styles (
[ ... ],
?>), tag literals, backticked strings, doc comments, and
Folding works on both 9-style braces blocks and 8-style container blocks, for all container tags that Lasso 8 ships with. Will still fold if the block is interspersed with sections of HTML. Also folds between Lasso delimiters.
- The default fold level is 2, so the
↑ upshortcut will fold blocks inside delimiters, but not the delimiter blocks themselves.
- The default fold level is 2, so the
Ignores square brackets after
[no_square_brackets]is encountered, and all delimiters in a
[noprocess] ... [/noprocess]block.
A file starting with an open square or angle bracket is assumed to be HTML with Lasso between delimiters; otherwise, it's read as a Lasso library or shell script.
Highlights Lasso 8's built-in types and tags, and Lasso 9's built-in types, traits, and unbound methods; as well as language keywords, variables, strings, numerals, method calls, keyword parameters, tag literals, logical operators, and comments.
The Navigator sidebar generates a clickable list of elements in the current file for quickly jumping to points in the code. The following types of entries are supported:
define_typeand Lasso 9 type definitions
T: Lasso 9 trait definitions
define_tagand Lasso 9 unbound method definitions
M: Lasso 9 member methods
E: Lasso 9 externally-defined member methods
!: versioning conflicts
- bookmark: reminders in comments, indicated by
⚠: important reminders in comments, indicated by
- (no icon): markers in comments, indicated by
//- mark Textor
Includes all built-in types, traits, unbound methods, and keywords in the autocomplete dictionary. (Generated using this script.)
- Autocomplete for Lasso 8-only tags is provided by this plugin.
Names from type/trait/method definitions, variable definitions or references, or imported trait references in the current file or other open files referenced with
includestatements are added to the autocomplete dictionary on-the-fly.
Associated with the filename extensions ".lasso", ".lasso8", ".lasso9", ".las", & ".incl", plus files starting with a Lasso delimiter or hashbang.
Line or block comments can be added/removed with the
/ slashshortcut, depending on the current selection.
Only boolean operators are highlighted, but there's a commented-out regex in SyntaxDefinition.xml that covers all operators.
Coda's PHP mode already claims ".inc" files, so you'll want to change that in the Preferences if you use that extension. (It also currently claims any files containing
<?, but that only applies to filenames without a recognized extension.)
Doesn't currently work with SubEthaEdit 3.5 or 4.
Folding of container tag blocks requires that if such a block is interrupted by HTML, the closing tag needs to be enclosed with the same style of delimiters (square vs. angle brackets) as the opening tag.
When member method definitions are separated by commas rather than keywords, a method definition not surrounded by braces will cause the next method not to appear in the navigator sidebar.
[no_square_brackets]will cause the highlighter to ignore square brackets among plain HTML and within
<style>blocks, but not inside HTML tags or tag attributes. (This is technically fixable, but would increase the highlighter's complexity considerably.)
[no_square_brackets]isn't recognized when it appears among markup that's inside a container block or braces block, nor in
[/noprocess]among HTML/XML will work only if it's nested at the same level as its opening
HTML tag blocks aren't foldable, since they frequently overlap Lasso delimiter blocks.
For comma-separated variable definitions (e.g.
local(a = 1, b = 2)or
var(x, y) = (:3, 4)), the parser adds only the first in the list to the autocomplete dictionary.