rktjmp / hotpot.nvim

:stew: Carl Weathers #1 Neovim Plugin.
MIT License
357 stars 9 forks source link

Compiler environment for plugins #130

Closed growler closed 7 months ago

growler commented 7 months ago

I noticed that compiler plugins are compiled in a sandbox:

    (set options.plugins (icollect [_i plug (ipairs (or options.plugins []))]
                           (match (type plug)
                             :string (case (mod-search {:prefix :fnl :extension :fnl :modnames [plug]})
                                       [path] (fennel.dofile path {:env :_COMPILER} plug path

while fennel itself provides full environment:

      :--plugin (let [opts {:env :_COMPILER :useMetadata true :compiler-env _G}
                      plugin (fennel.dofile (table.remove arg (+ i 1)) opts)]
                  (table.insert options.plugins 1 plugin)
                  (table.remove arg i))

Is it a deliberate choice? If yes, why? May it be customisable (i.e., with compiler.plugins option)?

rktjmp commented 7 months ago

Bug I would say. Hotpot aims to match fennels upstream behaviour when possible.

Fixed in lua build 4deb08235bfccfbba8b0c031b1cfc8189883cdb4 (commit a5d6448e01f5a9833066f031e84513fda2314c69).

Can you confirm 4deb08235bfccfbba8b0c031b1cfc8189883cdb4 works as you expect?

growler commented 7 months ago

Yes, thank you!