sourcekit-lsp icon indicating copy to clipboard operation
sourcekit-lsp copied to clipboard

🚥 Implement Document Highlight for all return / throws (function/closure/accessor/init/deinit) and break / continue (for/while/repeat...while)

Open lokesh-tr opened this issue 11 months ago • 4 comments

⚠️ Under Progress ⚠️

  • Explanation: Upgrades textDocument/documentHighlight to highlight various return / throw statements corresponding to a function / closure / accessor / init / deinit, and break / continue statements corresponding to a loop, thereby allowing us to not wonder about which statements could cause an exit from a function or loop.

This also makes use of a new API introduced in SwiftLexicalLookup Library in Swift Syntax.

  • Scope: This doesn't break existing code. This is Additive.
  • Issues: Fixes: https://github.com/swiftlang/sourcekit-lsp/issues/2400
  • Original PRs: This is the original PR. New API for Swift Syntax introduced in https://github.com/swiftlang/swift-syntax/pull/3216
  • Risk: I don't think there's any risk associated with this new feature.
  • Testing: Tests and Docs are yet to be written. The code & This PR description will also be polished.
  • Reviewers: Suggested by @ahoppen and Open to be reviewed by anyone. Note: At the current state, the code is messy since I was focused on getting it to work, will polish it.

lokesh-tr avatar Dec 22 '25 21:12 lokesh-tr

This is how it looks:

Inner function return statements are highlighted Outer function return statements are highlighted

lokesh-tr avatar Dec 22 '25 22:12 lokesh-tr

@lokesh-tr are you working on this problem?

DPrakashhh avatar Jan 26 '26 06:01 DPrakashhh

@DPrakashhh yeah, i got some pushes to be made

lokesh-tr avatar Jan 26 '26 13:01 lokesh-tr

@lokesh-tr Okay!

DPrakashhh avatar Jan 27 '26 07:01 DPrakashhh