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

Use real file paths as the source of truth across the language server, rather than virtual ones #614

Open
JohnnyMorganz opened this issue May 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@JohnnyMorganz
Copy link
Owner

At the moment, the language server uses virtual file paths as the internal representation for different files. This stems from the original usages where everything was based off Roblox-style instance requires plus a source map.

This behaviour however always leads to subtle bugs where the internal representation (a virtual file path resolved via the sourcemap) may not always match. For example, before c43f068, string requires would always resolve to the real file path. This could cause mismatching if the language server had already resolved a file using a virtual file path. Hence the internal state of the file in the Luau analysis phase would not update when using string requires - it depends on whether the file was resolved virtually or not.

Given that string requires seem to be the future, and the fact that the language server is working primarily with files, it probably makes sense to reconsider the usage of "virtual paths" throughout the server. In the long run this will probably make our lives a lot easier, given that real file paths are also what the language server protocol expects.

We should flip it around, where real file paths become the source of truth for the internal state of the language server. When necessary, we can map a virtual file path to a real one, by using a sourcemap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant