@@ -401,3 +401,28 @@ def is_processable_html_response(response):
401
401
and content_encoding == ""
402
402
and content_type in _HTML_TYPES
403
403
)
404
+
405
+
406
+ def get_editor_url (file : str , line : int = 1 ) -> str | None :
407
+ formats = {
408
+ "cursor" : "cursor://file/{file}:{line}" ,
409
+ "emacs" : "emacs://open?url=file://{file}&line={line}" ,
410
+ "espresso" : "x-espresso://open?filepath={file}&lines={line}" ,
411
+ "idea" : "idea://open?file={file}&line={line}" ,
412
+ "idea-remote" : "javascript:(()=>{let r=new XMLHttpRequest; r.open('get','http://localhost:63342/api/file/?file={file}&line={line}');r.send();})()" ,
413
+ "macvim" : "mvim://open/?url=file://{file}&line={line}" ,
414
+ "nova" : "nova://open?path={file}&line={line}" ,
415
+ "pycharm" : "pycharm://open?file={file}&line={line}" ,
416
+ "pycharm-remote" : "javascript:(()=>{let r=new XMLHttpRequest; r.open('get','http://localhost:63342/api/file/{file}:{line}');r.send();})()" ,
417
+ "sublime" : "subl://open?url=file://{file}&line={line}" ,
418
+ "vscode" : "vscode://file/{file}:{line}" ,
419
+ "vscode-insiders" : "vscode-insiders://file/{file}:{line}" ,
420
+ "vscode-remote" : "vscode://vscode-remote/{file}:{line}" ,
421
+ "vscode-insiders-remote" : "vscode-insiders://vscode-remote/{file}:{line}" ,
422
+ "vscodium" : "vscodium://file/{file}:{line}" ,
423
+ "windsurf" : "windsurf://file/{file}:{line}" ,
424
+ }
425
+ template = formats .get (dt_settings .get_config ()["EDITOR" ])
426
+ if template is None :
427
+ return None
428
+ return template .format (file = file , line = line )
0 commit comments