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

Fix loading type definitions that rely on mutation #745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

voidedWarranties
Copy link
Contributor

Fixes #658

Changes:

  • Previously, the workspace-global definitions file metadata (definitionsMetadata) was set to the metadata of the last definitions file that contained metadata. Now, it is set to the first one. I think this makes sense as it prevents the platform metadata from getting overridden.
  • Since the language server does not do anything useful before the platform is available, WorkspaceFolder::initialize (which only performed type registration) was moved to setupWithConfiguration and renamed to registerTypes.
  • The platform mutation function is now run after every definition file is registered. The platform can disambiguate which definitions file is which by checking what types are available (how it was done before) or with the metadata provided in the file.

This should more or less match the behavior from before 1.30.0. I tested with pilot.d.lua and it seems to work.

- Postpone type registration to `setupWithConfiguration`
- Explicitly keep the first definitions metadata as the global metadata
- Run the platform mutation function after every definition file gets registered
Copy link
Owner

@JohnnyMorganz JohnnyMorganz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to resolve this! And sorry for the delay. Just have one comment

src/Workspace.cpp Show resolved Hide resolved
Copy link
Owner

@JohnnyMorganz JohnnyMorganz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna test this, but looks good to me!

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.

Type definition file stopped working after 1.30.0
2 participants