Propposed Change: require to @require to be able to distinquish the difference #2

Open
opened 2026-09-18 10:26:22 +00:00 by dutchie031 · 1 comment
Owner

With lua addons one can create rewrites in the lua language server.

Meaning, for the language server we can rewrite @require to require, which will then properly fill the intellisense data.

For the script compilation however we can make a distinction between the @require which we will replace with in-line references.
Which will keep the require calls to exist. Which makes it so that if one does want to use require in DCS, which is possible if that function is not removed/sanitized in MissionScripting.lua, they can.

It will break current scripts.
It will also possibly cause confusion as require will be valid according to the LUALS however, it will not actually resolve anything if it's a local transpiled file reference.

Another option might be to have a _require that will also rewrite in the LUALS, but it will then be rewritten to require in the transpilation, leaving require

With lua `addons` one can create rewrites in the lua language server. Meaning, for the language server we can rewrite `@require` to `require`, which will then properly fill the intellisense data. For the script compilation however we can make a distinction between the `@require` which we will replace with in-line references. Which will keep the `require` calls to exist. Which makes it so that if one does want to use `require` in DCS, which is possible if that function is not removed/sanitized in `MissionScripting.lua`, they can. It will break current scripts. It will also possibly cause confusion as `require` will be valid according to the LUALS however, it will not actually resolve anything if it's a local transpiled file reference. Another option might be to have a `_require` that will also rewrite in the LUALS, but it will then be rewritten to `require` in the transpilation, leaving `require`
Author
Owner

Instead of this we'd go the LuaLS route.

Which will mark it as "unknown" unless marked as "globalRequirable".
Otherwise it will mark it when the file reference does not exist.

Instead of this we'd go the LuaLS route. Which will mark it as "unknown" unless marked as "globalRequirable". Otherwise it will mark it when the file reference does not exist.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchie031/DcsMissionScriptingTools#2