Skip to content
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

[Feature] Add option to load all exported types into global scope #458

Closed
BasadoBased opened this issue Sep 2, 2023 · 3 comments
Closed

Comments

@BasadoBased
Copy link

Greetings, in our codebase we have type exports at class declaration through the codebase e.g.
export type Stuff = typeof(table)
If one of these types works its way into another file that hasn't required it you can't use the type as far as I'm aware e.g.
-- other module local a: Stuff = func() -- a is recognized as Stuff and checked properly
Roblox LSP handles this by letting you add the directory back into the Workspace: Library list. After which all exported types are recognized everywhere. I think this feature would be useful to some people if you considered adding it.

I looked at definitions files and such but it didn't quite do what I wanted. I also saw #84 which might allow for part of this though I'm not sure.

@JohnnyMorganz
Copy link
Owner

Exporting types into the global scope is something you would have to ask Luau to support.
As far as I am aware, they are not interested in supporting such functionality

@BasadoBased
Copy link
Author

BasadoBased commented Sep 4, 2023

I get that it's not in the language spec, that's why I wrote "an option". If this project just wants to stay on the spec, I get it. The hack on the other LSP works just good enough that I think it's useful.

@JohnnyMorganz
Copy link
Owner

Yeah, we try to not deviate from the Luau type system at all. Implementing something like this is hard without Luau support. There are also negatives to "global types" in the same way _G. is typically not recommended

@JohnnyMorganz JohnnyMorganz closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants