feat(ts_ls): support node_modules not in workspace root directory#4422
Open
Tsukina-7mochi wants to merge 1 commit into
Open
feat(ts_ls): support node_modules not in workspace root directory#4422Tsukina-7mochi wants to merge 1 commit into
Tsukina-7mochi wants to merge 1 commit into
Conversation
Member
|
does this match what the tsgo and other js configs are doing? they all generally end up having the same problems, so want to make sure they are following the same patterns. |
Author
|
@justinmk I only knew about this in the context of Node.js, so I looked into it. Since this is about
|
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.
This pull request enhances the TypeScript LSP (
ts_ls.lua) configuration to better support projects with non-standardnode_moduleslayouts, such as monorepos or pnpm workspaces. The main improvement is the introduction of a helper function to locate packages withinnode_modulesdirectories, ensuring the correct TypeScript server and binaries are used regardless of project structure.Improvements for locating TypeScript packages and binaries:
find_node_packagefunction that searches for a specified package withinnode_modulesdirectories up the directory tree, improving compatibility with monorepos and pnpm setups.init_options.tsserver.pathto use the new helper, ensuring the TypeScript server uses the correctlibdirectory for the current buffer, even ifnode_modulesis not at the project root.cmdfunction to usefind_node_packagewhen resolving the localtypescript-language-serverbinary, making sure the correct binary is used in complex project structures.