summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manual/src/hyperlinks.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/manual/src/hyperlinks.md b/manual/src/hyperlinks.md
index 6b33df6..bfd6a2a 100644
--- a/manual/src/hyperlinks.md
+++ b/manual/src/hyperlinks.md
@@ -36,6 +36,7 @@ If your editor does not have its own URL protocol, then there are still many pos
Here's some Python code that could be used as a starting point:
```python
from http.server import BaseHTTPRequestHandler, HTTPServer
+ from pathlib import Path
from subprocess import call
from urllib.parse import parse_qs, urlparse
@@ -44,8 +45,10 @@ If your editor does not have its own URL protocol, then there are still many pos
if self.path.startswith("/open-in-editor"):
query = parse_qs(urlparse(self.path).query)
[path], [line] = query["path"], query["line"]
- # Replace with the right command for your editor
- call(["code", "-g", f"{path}:{line}"])
+ # TODO: Replace with the appropriate command for your editor
+ cwd = Path(path).parent
+ print("cwd", cwd)
+ call(["code", "-g", f"{path}:{line}"], cwd=cwd)
self.send_response(200)
else:
self.send_response(404)