Skip to content

Conversation

@JohnnyMorganz
Copy link
Owner

Adds support for type environments.

Environments can now be configured using luau-lsp.types.environments and luau-lsp.types.environmentGlobs.
You can create an environment name and point it to a definitions file, then assign an environment to a glob.

This is useful e.g. by creating a "testez" environment, only applicable to "*.spec.lua". TestEZ related global types will then only be available in those particular files, and will not pollute the global types.

In future, the environment name will be used for documentation parsing.

This extends onwards from #29

luau-lsp.types.definitionFiles has been deprecated in favour of environments. Assign the glob "*" to a global environment.

Blocked on luau-lang/luau#610

@JohnnyMorganz
Copy link
Owner Author

This feature is currently blocked on the following:

We modify typeCheckerForAutocomplete to provide more expressive DM types not present in the base type checker (which AIUI Studio does as well). For environment scopes though, there is no differentiation between the two so we can't do this. Environment scopes only build off the base typeChecker global scope

@itsmath
Copy link
Contributor

itsmath commented Mar 16, 2025

Is this still blocked? I'm making a Rojo-like tool that uses Luau and this would be extremely useful.

@JohnnyMorganz
Copy link
Owner Author

I believe this feature is blocked until the new type solver becomes standard

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

Successfully merging this pull request may close these issues.

Register extra definition files depending on file

3 participants