Skip to content

Commit

Permalink
Fixed code that was by mistake not committed with commit:80623dcc3bfb…
Browse files Browse the repository at this point in the history
…35eaf67c34f37e87b52a10f43cfd
  • Loading branch information
alberti42 committed Oct 6, 2024
1 parent 531d4db commit eea5e8f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions python_packages/jupyter_lsp/jupyter_lsp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,18 @@ class LanguageServerManagerAPI(LoggingConfigurable, HasListeners):
help=_("additional absolute paths to seek node_modules first"),
).tag(config=True)

def find_node_module(self, *path_frag):
def find_node_module(self, node_module, alternatives):
"""look through the node_module roots to find the given node module"""
all_roots = self.extra_node_roots + self.node_roots
found = None

for candidate_root in all_roots:
candidate = pathlib.Path(candidate_root, "node_modules", *path_frag)
self.log.debug("Checking for %s", candidate)
if candidate.exists():
found = str(candidate)
break
for path_frag in alternatives:
for candidate_root in all_roots:
candidate = pathlib.Path(candidate_root, "node_modules", node_module, *path_frag)
self.log.debug("Checking for %s", candidate)
if candidate.exists():
found = str(candidate)
break

if found is None: # pragma: no cover
self.log.debug(
Expand Down

0 comments on commit eea5e8f

Please # to comment.