Skip to content

Conversation

yuansl
Copy link
Contributor

@yuansl yuansl commented Sep 7, 2025

This change enhances lsp--window-show-document to handle external URLs by:

  • Adding external? parameter support from ShowDocumentParams
  • Opening external URIs in browser via browse-url if external? is t
  • Maintaining existing file-based document handling

This change enhances lsp--window-show-document to handle external URLs by:
- Adding external? parameter support from ShowDocumentParams
- Opening external URIs in browser via browse-url
- Maintaining existing file-based document handling
@yuansl
Copy link
Contributor Author

yuansl commented Sep 7, 2025

This is useful for gopls web-based features (https://go.dev/gopls/features/web)

  1. Browse assembly for a function in browser
  2. Browse document for a package in browser
  3. "Split package" code action
    and so on

(with-current-buffer (find-file path)
(when selection?
(goto-char (lsp--position-to-point (lsp:range-start selection?))))
t)))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the indentation is a bit off here. 🤔 Can you fix this for us? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your review, it seems github's issue mabye, it looks just ok in my emacs, and my git diff shows that the indentation is ok (I also just checkout this PR locally, it seems normal)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sorry, I find there is a 'tab' before "(with-current-buffer ..." in my code (my emacs's electric-indent-mode messed it up), which should be a whitespace , thanks for your fix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem! :)

@jcs090218 jcs090218 merged commit 9d2bab7 into emacs-lsp:master Sep 9, 2025
18 checks passed
@jcs090218
Copy link
Member

Thank you for adding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants