LuaLS / LuaLS/lua-language-server
`@language` tag for embedding other languages in a string
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](https://code.visualstudio.com/api/language-extensions/embedded-languages), something like
```lua
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")
]],
}
```
```lua
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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