Types for luau-lsp for lua in secondlife

See here and here for more information about lua in secondlife.

Example of syntax highlighting and hovertips

Created with plenty of help and original findings from @gwigz

VSCode installaion

Setup luau-lsp (Inline type checks, code completion, some linting)

Work is happening to add support for setting urls for definitions in the vscode extension, to allow automatic updating of the definitions. For now you will need to update them manually. When they change

  1. Install vscode

  2. Install this extension (github link)

  3. Download a sl_lua_types.zip from here

  4. Extract and place those files somewhere memorable (<user_dir>/.sl-luau/ for instance)

  5. Then Either globaly or in your project add the 2 files to the options with the following config

    "luau-lsp.types.definitionFiles": [
        "~/.sl-luau/ll.d.luau"
    ],
    "luau-lsp.types.documentationFiles": [
        "~/.sl-luau/ll.d.json"
    ],
    "luau-lsp.platform.type": "standard"
    

    or through the UI

  6. You may need to restart vscode or reload the ui

Setup Selene (linting)

  1. Install this extension to vscode (github link)
  2. Add the the sl_selene_defs.yml to your project (Suggest : ./types/sl_selene_defs.yml)
  3. Create a selene.toml in the root of your project with the following content
    std = "types/sl_selene_defs"
    
    [rules]
    global_usage = "allow"
    shadowing = "allow"
    
    [config]
    empty_if = { comments_count = true }
    unused_variable = { ignore_pattern = "^_|^touch_start$|^touch_end$|^touch$" }
    
  4. Selene should pick this up and start giving you linting hints.

Recommendations