Skip to content

Commit

Permalink
feat(debugger): Normalize the samples_dir path (#139)
Browse files Browse the repository at this point in the history
Show absolute path in codelens "Select hash for context" error message to avoid indistinct "Sample abc not found in ."

Normalize the path right at the start when we request it through LSP get
config. This way we will see the absolute path in the error message and
also add support for the path relative to the user (home) directory.

---------

Co-authored-by: MatejKastak <[email protected]>
  • Loading branch information
ruppde and MatejKastak authored Oct 23, 2023
1 parent f62beda commit 8afe641
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yls/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def display_py_object(value: Any) -> str:
async def get_samples_dir(ls: Any) -> Path | None:
samples_dir_config = await utils.get_config_from_editor(ls, "yls.yari.samplesDirectory")
log.debug(f"[DEBUGGER] Got {samples_dir_config=}")
samples_dir_path = Path(samples_dir_config)
samples_dir_path = Path(samples_dir_config).expanduser().resolve()
log.debug(f"[DEBUGGER] Resolved {samples_dir_config=}")

if not samples_dir_path.is_dir():
log.debug("[DEBUGGER] Samples dir does not exist or is not a directory")
Expand Down

0 comments on commit 8afe641

Please sign in to comment.