Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open definition in new window #92

Open
dineshadepu opened this issue Sep 18, 2017 · 3 comments
Open

Open definition in new window #92

dineshadepu opened this issue Sep 18, 2017 · 3 comments

Comments

@dineshadepu
Copy link

Thanks for the awesome package.

Is there any function which will open the definition in new window.

Thank you.

@4lex1v
Copy link

4lex1v commented Nov 1, 2017

I'm fairly sure that my approach is pretty dumb and buggy, but seems to be working:

  (defun racer-find-definition-other-window ()
    "Run the racer find-definition command and process the results in other window."
    (interactive)
    (-if-let (match (--first (s-starts-with? "MATCH" it)
                             (racer--call-at-point "find-definition")))
        (-let [(_name line col file _matchtype _ctx)
               (s-split-up-to "," (s-chop-prefix "MATCH " match) 5)]
          (if (fboundp 'xref-push-marker-stack)
              (xref-push-marker-stack)
            (with-no-warnings
              (ring-insert find-tag-marker-ring (point-marker))))
          (switch-to-buffer-other-window file)
          (save-selected-window
            (racer--find-file file (string-to-number line) (string-to-number col))))
      (error "No definition found")))

I guess there's a better way to do it, extracting the common part or using the optional argument

@dineshadepu
Copy link
Author

Thanks @4lex1v ! It worked just perfect.

@dineshadepu
Copy link
Author

Hi @4lex1v , When I invoke open in new window, it will open the definition in new window.
But after I close that file, I have another file opened with same name but empty.

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

No branches or pull requests

2 participants