LSL
Syntax definitions for LSL(Linden Scripting Language) in Second Life and OSSL(OpenSimulator Scripting Language) in OpenSimulator.
Details
Installs
- Total 3K
- Win 2K
- Mac 450
- Linux 435
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 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 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 3 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
LSL/OSSL Bundle for Sublime Text
Current supported language
- LSL [*.lsl]: Second Life 2023-03-24.579022
- OSSL [*.ossl]: OpenSimulator v0.9.2.1
- Including mod*, os*, wl*(LightShare) functions
kwdb version 0.0.20230409000
Features
- More quick completion of functions & events.
- Stricter syntax detection - if you miss something, the rest will be colored oddly.
- You can even use Second Life Viewer styled theme.
- Compatible with TextMate scoping rules.
- lslint as build system(F7, CtrlB or CommandB).
- No Commands, no Macros, no Templates …
Syntax Indentation
- Allman Style (default)
- K&R Style
See LSL Style Guide for coding samples. (method one = K&R Style, method two = Allman style)
Installation
This bundle is designed to work with the latest version of Sublime Text 2.
v1.3.2 or later will work with Sublime Text 3 as well.
Using Sublime Package Control
The easiest way to install this is via Package Control.
- If you just went and installed Package Control, you probably need to restart Sublime Text before doing this next bit.
- Bring up the Command Palette (CommandShiftP on OS X, CtrlShiftP on Linux/Windows).
- Select “Package Control: Install Package” (it'll take a few seconds)
- Type and select “LSL” when the list appears.
Package Control will automatically keep LSL/OSSL Bundle up to date with the latest version.
Using Git
Alternatively, if you are a git user, you can install the plugin and keep up to date by cloning the repo directly into your Packages
directory in the Sublime Text application settings area.
You can locate your Sublime Text Packages
directory by using the menu item Preferences -> Browse Packages...
.
While inside the Packages
directory, clone the plugin repository using the command below:
git clone https://github.com/Makopo/sublime-text-lsl LSL
Download Manually
- Download the files using the GitHub *.zip or *.tar.gz download options.
- Unzip the files and rename the folder to
LSL
. - Copy the folder to your Sublime Text
Packages
directory.
Upgrade
I try to update the keyword list as soon as it is updated by kwdb, however, I sometimes may not be able to do that. Please refrain from requesting maintenance for at least one month after the kwdb have higher version than the version above. If you want to make an urgent request, please poke me via @makopo on Twitter or send an inworld IM to Mako Nozaki.
Using Sublime Package Control
Having auto_upgrade
option in your setting file, or due to some other cause, Packate Control may not upgrade this package. If you feel your version is behind, try to upgrade it:
- Bring up the Command Palette (CommandShiftP on OS X, CtrlShiftP on Linux/Windows).
- Select “Package Control: Upgrade Package” (it'll take a few seconds)
- Type and select “LSL” when the list appears.
Download Manually
Since nothing will take care of your version, you will need to maintain it by yourself. Simply re-download the *.zip or *.tar.gz and overwrite it in the Packages
directory.
Additional Features
Second Life Viewer Theme
You can use the bundled theme for only .lsl or .ossl files to the same look-and-feel with inworld editor.
To activate it, use the menu item Preferences -> Package Settings -> LSL/OSSL -> Use Viewer Theme
.
The same steps to deactivate it.
Note that you need to have this bundle in “LSL” package directory to use it.
Changing Snippet Insertion Style
You can change insertion style of snippets from default Allman style to K&R style.
To activate it, use the menu item Preferences -> Package Settings -> LSL/OSSL -> K&R Style
.
The same steps to deactivate it.
lslint Build System
You can run lslint as LSL/OSSL build system.
lslint is originated by http://w-hat.com.
I added some features on it for use as build command in Sublime Text. https://github.com/Makopo/lslint
Simply hit F7 or CtrlB or CommandB to check the syntax of currently opened lsl/ossl script.
Currently it is not supported for os/mod/wl functions.
If you want to change the key bindings, use “build” command for it in your Default.sublime-keymap. Following example assigns CommandL to lslint.
[
{
"keys": ["super+l"],
"command": "build",
"context":[
{ "key": "selector", "operator": "equal", "operand": "source.lsl" }
]
},
{
"keys": ["super+l"],
"command": "build",
"context":[
{ "key": "selector", "operator": "equal", "operand": "source.ossl" }
]
}
]
non-ascii system issue
If you have lsl/ossl script in the path conatins non-ascii (eg. UTF-8) characters, the check may fail.
You might want to avoid placing your scripts in such a path, or if you can't,
You may workaround this issue by inserting a line after line 99 in “Packages/Default/exec.py”.
cmd = [c.encode(sys.getfilesystemencoding()) for c in cmd]
Additionally if your system encoding isn't UTF-8, you may need to modify “Packages/LSL/LSL.sublime-build”.
"windows":
{
"encoding": "cp932",
"cmd": ["$packages\\LSL\\windows\\lslint.exe", "-p", "$file"]
},
This example above is for Japanese version of Windows. Change the corresponding block(windows/linux/osx) with your environment.
Using other build systems for dialects
You can use other build systems than lslint for some dialects.
LSL-PyOptimizer
You can use LSL-PyOptimizer for optimizing your lsl code.
Navigate Tools
-> Build System
-> New Build System...
and edit the newly created file like that:
For windows: “ { "file_regex”: “::[A-Z]++::\”((?:\.|[\“\])*+)\”:(\d++):(\d++): (.*+)“, "selector”: “source.lsl”, “cmd”: [“C:\Python27\python.exe”, “PYOPTIMIZER_PATH\main.py”, “–emap”, “–bom”, “$file”, “-o”, “$file_path/${file_base_name}_optimized.$file_extension”], “env”: { “PYTHONIOENCODING”: “utf-8” } }
For osx:
{ “file_regex”: “::[A-Z]++::\”((?:\.|[\“\])*+)\”:(\d++):(\d++): (.*+)“, "selector”: “source.lsl”, “cmd”: [“python2.7”, “PYOPTIMIZER_PATH/main.py”, “–emap”, “–bom”, “$file”, “-o”, “$file_path/${file_base_name}_optimized.$file_extension”], “env”: { “PYTHONIOENCODING”: “utf-8” } }
* These samples assume that LSL-PyOptimizer revision is 7282e53 (Feb 5, 2019) or later.
* In this example, output will be created as `SOURCE_FILE_NAME_optimized.SOURCE_EXTENSION`.
* [Official document](http://lsl.blacktulip-virtual.com/lsl-pyoptimizer/) says you need to use Python 2.7.
* Outputs are streamed as utf-8 so you need `PYTHONIOENCODING` environment variable to successfully decode them.
Save this file as `LSL-PyOptimizer.sublime-build`.
Now you'll find `LSL-PyOptimizer` in `Tools` -> `Build System`.
Select `Tools` -> `Build With...`(<kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>B</kbd> or <kbd>Command</kbd><kbd>Shift</kbd><kbd>B</kbd>) and choose `LSL-PyOptimizer`.
From now on, your source will be compiled with LSL-PyOptimizer. `Tools` -> `Build With...` again to switch back to lslint.
## Using lslint as Build System for files with non-ascii characters in their paths
lslint prints output in ascii characters. When calling lslint on the Build System, Python tries to decode the output as utf8, which translates most non-ASCII characters incorrectly. To avoid this, add an argument and specify your system encoding in `LSL.sublime-build`. The encoding value must be one of the codecs in [this list](https://docs.python.org/3.3/library/codecs.html#id3).
"windows":
{
"cmd": ["$packages\\LSL\\windows\\lslint.exe", "-p", "$file"],
"encoding": "YOUR_CODEC"
},
## LSL/OSSL sidebar icons
Starting from Sublime Text 3062, you can assign file icons on the sidebar. However, since this plugin is not a theme, I can't provide this feature, instead you can assign your favorite icon to LSL/OSSL entries by yourself.
In short: scope "source.lsl" for LSL and "source.ossl" for OSSL.
1. Create or fetch a 16x16 image. FYI, you can find SecondLife icons in [BitBucket repository](https://bitbucket.org/lindenlab/viewer-release/src/5b51b28e057c/indra/newview/icons/release/?at=default).
2. Rename the image to "file_type_lsl.png".
3. You can even add secondary 32x32 image as "file_type_lsl@2x.png". I don't know how it will be used though.
4. Create a file "icon_lsl.tmPreferences" with the following contents.
5. Put the file above and PNG image(s) into your active theme folder.
icon_lsl.tmPreferences:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.lsl</string>
<key>settings</key>
<dict>
<key>icon</key>
<string>file_type_lsl</string>
</dict>
</dict>
</plist>
For ossl, put 16x16 “file_type_ossl.png” and “icon_ossl.tmPreferences” with scope “source.ossl” into the theme folder.
API Reference Tooltip
Starting from Sublime Text 3070, you can look in the API reference by context meny on the keywords. Due to performance overhead, I created anothe plugin “TooltipLSL”. The project is here.
In short, install “TooltipLSL” with Package Control, then place the caret on functions/constants/events before choosing “Show LSL Reference” from the right-click context menu.
About Keyword Database
This bundle uses kwdb as source of its LSL/OSSL funcion/event/constant names. The LSL/OSSL keywords in .tmLanguage and .sublime-completions are automatically generated from the file kwdb.xml within. I have the automation tool in another project(kwdb_to_sublime). Thus, if you find any flaw in the keywords, please first search for the keyword you want to use in kwdb.xml
. Then compare kwdb version at the top of this readme to that in kwdb.xml
. If you find mine is way behind of kwdb.xml
, please be patient or poke me @makopo on Twitter or send an inworld IM to Mako Nozaki.