Skip to content

move definition files type to map or array, add default names to array definition files - #49

Open
nnullcolumn wants to merge 1 commit into
4teapo:mainfrom
nnullcolumn:fix-47
Open

move definition files type to map or array, add default names to array definition files#49
nnullcolumn wants to merge 1 commit into
4teapo:mainfrom
nnullcolumn:fix-47

Conversation

@nnullcolumn

@nnullcolumn nnullcolumn commented Jun 8, 2026

Copy link
Copy Markdown

full disclosure this was vibecoded
fixes #47

the human part (i'm so sorry i forgot to include this section on initial PR open):

  • verification
    • code compiles
    • definition files now apply after API / built-ins and generally are required to have names
    • old configurations still work
  • i will be happy to make revisions myself if the code is unsatisfying or unacceptable
  • revised a comment or two

@4teapo 4teapo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR! Overall looks good but I added a couple comments I think need to be resolved

Comment thread src/luau.rs
// Fold `luau-lsp.types.definitionFiles` into `settings.definitions` so all definition
// files are registered the same way. Like `definitions`, it may be either an array of
// paths (unnamed) or a map of package name -> path
match types.remove("definitionFiles") {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Might be best to just reuse the deserialize_definition_files function here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ya sounds good, will do

Comment thread src/luau.rs
// avoid treating definition files as regular Luau files; it only looks at the paths, so
// package names are irrelevant here. Registration into the global scope is done instead
// via the `--definitions` CLI arguments built in `language_server_command`.
types.insert(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Probably should re-insert them with names as an object and resolve (optionalName, path) into (name, path) here already using the logic for replacing None-names; backwards compatibility in the language server might get removed some day as hinted to by todos in luau-lsp source, which could cause errors or definition files being treated as normal files, and it should only possibly be better to keep the names

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i agree

@nnullcolumn

Copy link
Copy Markdown
Author

will be coming back to work on this soon, been very busy

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.

(vscode divergence) cannot override luau type definitions

2 participants