File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 131
131
```
132
132
133
133
</Accordion >
134
+
135
+ ### ResolveRequire
136
+
137
+ This function allows plugin to manually resolve ` require('...') ` file paths. Useful for environments that implement custom require resolution.
138
+
139
+ Return ` nil ` to use default LuaLS resolution. If you return an empty table - LuaLS will not resolve paths.
140
+
141
+ ``` Lua
142
+ --- @param uri string # The URI of file
143
+ --- @param name string # Argument of require()
144
+ --- @return string[] ?
145
+ function ResolveRequire (uri , name ) end
146
+ ```
147
+
148
+ <Accordion >
149
+ <span slot = " summary" id = " demo-example" >Example</span >
150
+
151
+ ``` Lua
152
+ --- @param uri string # The URI of file
153
+ --- @param name string # Argument of require()
154
+ --- @return string[] ?
155
+ function ResolveRequire (uri , name )
156
+ -- Check if it's our custom name format
157
+ if name :byte (1 ) ~= 0x40 then -- '@' at beginning
158
+ return nil
159
+ end
160
+
161
+ -- Return path to real file location
162
+ return { " file:///path/to/mods/" .. name :sub (2 ) .. " /main.lua" }
163
+ end
164
+ ```
165
+
166
+ </Accordion >
You can’t perform that action at this time.
0 commit comments