justarandomgeek / vscode-factoriomod-debug

Factorio Mod Tool Kit
Other
121 stars 26 forks source link

Allow resolution of clusterio module exports #144

Closed Cooldude2606 closed 1 month ago

Cooldude2606 commented 1 month ago

Updates the require resolution logic when the clusterio option is enabled. 1) The clusterio loader now creates the file modules/plugin_name.lua if the plugin contains a module_exports.lua file in it's source. Therefore any require paths of the form ^modules/plugin_name$ should resolve to plugin_name/module/module_exports.lua. Change: This new logic was added. 2) There is the assumption that the workspace of vscode is external_plugins when working on plugins, similar to how mod development assumes the workspace is mods. The previous logic discarded the plugin name which could cause multiple files to be resolved for a single path. e.g. modules/plugin_a/foo would resolve to both plugin_a/module/foo.lua and plugin_b/module/foo.lua which was particularly noticeable for module exports. Change: the plugin name is no longer discarded.