Created
          January 9, 2023 14:25 
        
      - 
      
- 
        Save chendesheng/99e673571c8dd19ddf9557a5ff6d2bcc to your computer and use it in GitHub Desktop. 
    Sublime Text jump to file from Find Results using keyboard
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sublime | |
| import sublime_plugin | |
| class DoubleClickAtCaretCommand(sublime_plugin.TextCommand): | |
| def run(self, edit, **kwargs): | |
| view = self.view | |
| cursor = view.sel()[0] | |
| (rg, scope) = view.extract_tokens_with_scopes(view.line(cursor))[1] | |
| if 'line-number.match.find-in-files' in scope: | |
| linenum = view.substr(rg) | |
| colnum = cursor.a - rg.b - 1 | |
| # print(linenum) | |
| regions = view.symbol_regions() | |
| regions.sort(key=lambda s: s.region.a, reverse=True) | |
| for symbol_region in regions: | |
| if symbol_region.region.b < cursor.a: | |
| file_path = symbol_region.name | |
| view.window().open_file( | |
| "{}:{}:{}".format(file_path, linenum, colnum), | |
| sublime.ENCODED_POSITION) | |
| # print(file_path) | |
| break | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
WORKS BRILLIANTLY! THANK YOU FOR UPDATING THIS!
After upgrading my Sublime Text to the latest build, this critical feature/script stopped working. This did the trick and got my workflow back up and running. Thanks again!