LuaLS / LuaLS/lua-language-server

`@language` tag for embedding other languages in a string

Open
#2,925 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

In a few places in factorio's API we have a lua string that contains code (sometimes more lua code, sometimes our noise-expression language), and it woudl be nice to be able to activate language features for these via embedded language tags, something like

local simulation = {
  ---@language lua
  init = [[
    local bp="0eNq1lVtugzAQRfcy36aKzZu/dBtVhIA47UhgkDFRoogFdCHdWFdSG9QEKYRH1fwgbMbncsejmQukecMriUJBdAHMSlFD9HaBGt9Fkps9da44RICKF0BAJIVZCTwht1STcmgJoNjzE0S03RHgQqFC3lO6xTkWTZFyqQPGzhOoylofKYVR0xjLeXEJnPULa1tyB2HLIO4kxF4GYZMQZxnEnoS4yyCbG4SAviUlyzxO+UdyxFKaoAxl1qCK9bf99eQBZa3iu7s8olSN3rlK9xHWFnp4rRJTDxajju8EtucEZruoEpkoowbfn1/Q9rGCZ0atNnhqHpLvh3ePekXtdteOmfeWmaeTGfRHIFZdJHk+VVs6oWOwYA3MnoGFa2BsBkY3a2h0jkbX0DZD2vPq7/VZ9cce1B+9NZNfWUsLpSg6obtEsPk8HDBXXD5oojPGG+OaMttxPT8Ih311hVf6yKv9R6/0f71u77z+zajb+dQTp5tM0WCQETjqv+qcsECXUMh8FgaB5+v28QOiY0wL"
    game.tick_paused = false
    game.simulation.camera_alt_info = true
    local result = {game.surfaces[1].create_entities_from_blueprint_string
    {
      string = bp,
      position = {0, 0},
    }}
    remote.call("nixie-tubes", "RebuildNixies")
  ]],
}
local noise = {
    type = "noise-expression",
    name = "enemy_base_frequency",
    ---@language factorio-noise
    expression = "(0.00001 + 0.000003 * enemy_base_intensity) * var('control:enemy-base:frequency')"
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue examples and the linked VS Code embedded-languages guidance. No repository files, tests, or entry points are named, so first locate how Lua string contents are currently parsed and diagnosed. Done means the proposed @language tags activate the appropriate language features for embedded Lua and factorio-noise strings.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.