feat: --definitions-dir flag, --config file support, glob ** expansion - #1612
Open
fluffy-den wants to merge 1 commit into
Open
feat: --definitions-dir flag, --config file support, glob ** expansion#1612fluffy-den wants to merge 1 commit into
fluffy-den wants to merge 1 commit into
Conversation
Add --definitions-dir CLI flag to load definition files from a directory tree, replacing the need to specify each file individually. Add --config flag and auto-discovery of luau-lsp-settings.json config files with per-directory merge. Config files are walked from CWD up to the project root; root-level settings are inherited by subdirectories and overridden by closer files. Add glob ** (double-star) pattern support via split-on-separator strategy for matching across directory boundaries. Fix LSP crash on stdin disconnect by joining the message processor thread in the LanguageServer destructor. Support VFS @ prefix stripping in glob patterns for addon resolution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat:
--definitions-dirflag,--configfile support, and glob**expansionContext
When using luau-lsp with projects that have definition files spread across multiple directories, the current workflow requires listing every
.d.luaufile individually or writing wrapper scripts to generate file lists. This is fragile and hard to maintain. Additionally, there is no way to configure luau-lsp per-project through a settings file.This PR addresses three related issues:
--definitions-dirflag -- users must pass each definition file individually--definitions,--platform, and--docsrequire CLI flags with no persistence**glob expansion -- patterns likesrc/**/*.d.luauare not expanded across directoriesIt also fixes a crash where the LSP server calls
std::terminate()on stdin disconnect.Changes
--definitions-dirCLI flag (src/main.cpp,src/AnalyzeCli.cpp):--definitions-dir <path>flag recursively finds all.luauand.luafiles in a directory treeglob()library for directory walkingConfig file support (
src/AnalyzeCli.cpp,src/include/Analyze/AnalyzeCli.hpp):--config <path>CLI flag to explicitly load a config fileluau-lsp-settings.jsonwalking from CWD up to the project rootLuau.LanguageServer.ConfigurationJSON schemadefinitions,definitionsDir,docs,ignoreGlob,platform,baseLuaurc,requireMode,fflagsConfigFileDatastruct andloadConfigFile(),parseConfigJson()functionsPer-directory config merge:
definitions,definitionsDir,docs) are concatenated with dedupplatform,baseLuaurc) use the closest non-empty valueGlob
**expansion (src/AnalyzeCli.cpp):**matching across directories**matches zero or more intermediate directoriesLSP crash fix (
src/LanguageServer.cpp):join()onmessageProcessorThreadin theLanguageServerdestructorstd::terminate()because the thread was detached but not joinedVFS
@prefix stripping:@A/,@B/, etc. have the prefix stripped for filesystem resolutionTesting
--definitions-diroutput ordering and config file loadingHow to verify