-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make auto require more data model aware? #625
Comments
Sounds reasonable to support to me! We can definitely be more clever in our auto require logic, the current implementation is quite rudimentary.
I think this should follow automatically by implementing the first point - we should add the require after the fixed variable. |
Cool 😃 As a side note, I forgot to mention that ideally it puts some whitespace around itself too like the GetService option |
Do you mean whitespace between the fixed variable (Plugin) and the block of requires (Script etc.?) |
Yeah basically I mean that I want to make sure that in the following code: local Plugin = script:FindFirstAncestor("PluginName")
local function doinStuff() ...that the first require gets placed like: local Plugin = script:FindFirstAncestor("PluginName")
local Library = require(Plugin.Src.Library)
local function doinStuff() No idea WRT separateGroupsWithLine. I think it makes sense to put it under there on first blush though. |
I'm experimenting with using Luau LSP internally at Roblox. Auto requires are fantastic, but we have a common pattern of the following:
Unfortunately, it looks like Luau LSP will auto-require without the Plugin part, and will just script.Parent etc, which we don't want.
I think that Luau LSP should (optionally?) use variables if they exist and statically point to the strict data model instance. That is, if we have some require already such that Luau LSP already knows where to put stuff, and it sees that the equivalent to script.Parent.Parent exists in the form of Plugin, it should use that.
I think another problem with trying to use auto requires exclusively for us is that I'm not sure Luau LSP will actually split itself off from the Plugin variable, but instead might try to put itself at the beginning. Would be cool to also be able to tell it to place the first require wherever it can find a strict data model instance?
The text was updated successfully, but these errors were encountered: