This Extension is designed to integrate vscode better as the external editor for Second Life
This project is not associated with Linden Lab any use of trademarks or copyrighted terms is done in good faith to explain clearly what this project is for, and not an attempt to misrepresent
I suggest that you chose a folder on your system to hold all your sl projects, without better support in the SL viewer directly it is difficult to manage multiple, though nothing is stopping you from having as many editors open as you like.
Set the external editor config in the viewer to something like this..
- Windows:
"C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Users\<user>\projects\sl\scripts" "%s" - Mac:
/opt/homebrew/bin/code -r "/Users/<user>/projects/sl/scripting" "%s" - Linux:
/usr/bin/code "/home/<user>/projects/sl/scripting" "%s"
These are not exact examples, your system setup may differ, the location of the directory for your scripts is entirely up to you
After that you should be good to go, though I would advise looking through the config options below, and trying the hint system.
This way works best if you open vscode before you start working in SL
Set the external editor config in the viewer to something like this..
- Windows:
"C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\Code.exe" "%s" - Mac:
/opt/homebrew/bin/code "%s" - Linux:
/usr/bin/code "%s"
These are not exact examples, your system setup may differ.
Contact WolfGang Senizen in world if you are having issues.
Detects saves to recognized file extensions, and matches them to files that the Second Life viewer has created in the system temp directory
This is done either purely by name, by directory and name, or by specified hints using directory and name to match
- Windows, Linux, Mac
- Luau Language Server (optional)
- Selene (optional)
- Any Second Life viewer that has the
ExternalEditorfeature - Automatic type definition downloading for
SLua - External Pre processing tools - See here for documentation
- Attempting to open project directories automatically
SL External Editor: Enable- Enable The extension for the current directorySL External Editor: Update LSP Defs- Force an update and refresh of the LSP DefsSL External Editor: Setup/Update Selene- Force an update and refresh of the Selene Library
Certain hints can be added to a script to make working with this extension smoother, they are completely optional, but will help in situations where you have many separate projects open at once, or use a single "Mono Project" folder.
Hints are written prefixed with the single line comment for their language, //
for LSL, -- for SLua
@project <project_dir>setting this will make the extension only match files for saving if they are within a directory path that containsproject_dir- e.g.
-- @project huds/space_roleplay - Would match a files in a directory like this
/home/user/secondlife/huds/space_roleplay/scripts/main.luau - But not one like this
/home/user/projects/huds/secondlife/space_roleplay/main.luau - This hint will also be used to try and automatically open the right folder,
if the
secondLifeExternalEditor.dir.projectsconfig option is set.
- e.g.
@file <file_name>this will override the default script name detection mechanism, it can be combined with@projectto specify files inside a project- When used in combination with
@projectit restricts to that specific file withing the detected project folder. - When used without
@projectit just overrides the auto detected script name and follows the rest of the matching rules.
- When used in combination with
This extension has the following settings:
secondLifeExternalEditor.enabled: Recommend this is set at a workspace level rather than system widesecondLifeExternalEditor.dir.projects: Used to open vscode automatically to the right directory inside of this specified one, if it can match a file.- e.g.
/home/user/projectsC:\Users\user\projects - When a new tempfile is passed to vscode if it cannot be matched in the
current workspace, the extension will combine this path with the
@projecthint and the (script name or@filehint) to try and locate the right place to open
- e.g.
secondLifeExternalEditor.hints.prefix: The prefix to use to provide hints to the extensionsecondLifeExternalEditor.watcher.tempFilesRequireDirectoryPrefix: Sets wether scripts need to be named with their folder name as well (this can be disabled, but is recommended to avoid false matches, especially when having multiple projects open at once) e.g.<folder_name>/<file_name>as the name of your script in SL.secondLifeExternalEditor.watcher.fileExtensions: List of file extensions to care about. (Defaults tolua, luau, lsl, slua)
secondLifeExternalEditor.download.enabledWether Type Def files should be automatically downloadedsecondLifeExternalEditor.download.locationWhere those files should be stored for your projectssecondLifeExternalEditor.download.snippetsWhere to download snippets for vscode fromsecondLifeExternalEditor.matcher.autoCloseTempScriptIf a temp script file is opened and a matching file is found, the temp file will be closed and matching file opened.- Requires
Luau Language Server
or similar
secondLifeExternalEditor.luau-lsp.downloadTypeDefsA list of url's to download Luau Type Def files fromsecondLifeExternalEditor.luau-lsp.downloadApiDocsA list of url's to download Luau-LSP Api documentation files from
- Requires
Selene
or similar
secondLifeExternalEditor.selene.downloadThe location to download a selene standard library definition from
secondLifeExternalEditor.preprocessor.command.lsl: The command to execute as a preprocessor step to affect the output before it is put into the viewers temp file for lsl scriptssecondLifeExternalEditor.preprocessor.command.slua: The command to execute as a preprocessor step to affect the output before it is put into the viewers temp file for SLua scriptssecondLifeExternalEditor.preprocessor.watchIncludes: If the preprocessor outputs compatible information about extra files it included, then the extension will watch for those files changing as wellsecondLifeExternalEditor.preprocessor.downloadUrl to download preproc from.\n\nIf not specified and the command is run, it will download the default dsl option
- Updates
- It's not finished
0.3.7Add config for temp directory0.3.6Update for luau-lsp compatability0.3.5Bugfix filepath name check too strict0.3.4Stop error processing if no errors0.3.3Disable debug features in release extension0.3.2Actually bump the version.... dingus0.3.1Preproc version bump for bug with line counts0.3.0Error watcher for new .log file the viewer produces, a little pointless at the moment if you have the lsp setup- A fix for preproc being configured in workspace config, should now set in global, avoids leaking username and conflicting in shared projects that choose to commit .vscode directory
0.2.6Better file watcher, and linking log files0.2.5Log file handling for upcoming viewer changes0.2.4Fix escaping bug in preproc path0.2.2Add command to download and install pre-processor0.2.1Add Preproc out file support0.2.0Add Preproc support and fix major save bug
0.1.1Add snippets and better selene toml handling0.1.0Cool icon and "release"
0.0.10Fixed relative paths for type defs0.0.9Better handling of auto opening files.0.0.8Add file open handling and auto closing of temp files0.0.7Fix for file copying not overwriting existing files0.0.6Setup publisher0.0.5Fix version issue0.0.4Implement Automatic type def downloads0.0.3Mac temp directory detection0.0.2Windows file path fixes0.0.1Initial implementation