Skip to content

Commit

Permalink
Merge pull request #72 from factyy/fix/proper-path-translation
Browse files Browse the repository at this point in the history
Avoid multiple substitutions on a single path
  • Loading branch information
factyy authored Jun 27, 2023
2 parents 1fa2fec + 8e4cc50 commit 175b587
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lsp-docker.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Argument URI the uri to translate."
(-if-let ((local . remote) (-first (-lambda ((_ . docker-path))
(s-contains? docker-path path))
path-mappings))
(s-replace remote local path)
(replace-regexp-in-string (format "\\(%s\\).*" remote) local path nil nil 1)
(format "/docker:%s:%s" docker-container-name path))))

(defun lsp-docker--path->uri (path-mappings path)
Expand All @@ -73,7 +73,7 @@ Argument PATH the path to translate."
(-if-let ((local . remote) (-first (-lambda ((local-path . _))
(s-contains? local-path path))
path-mappings))
(s-replace local remote path)
(replace-regexp-in-string (format "\\(%s\\).*" local) remote path nil nil 1)
(user-error "The path %s is not under path mappings" path))))


Expand Down

0 comments on commit 175b587

Please sign in to comment.