Intellij-IDEA: How to put path to a method in my clipboard

intellij-idea, java

Solution

CTRL+ALT+SHIFT+C is "Copy Reference" which should do what you want.

Problem

Intellij has this cool feature where if you type `ctrl+alt+c`, it copies the absolute path of the file your cursor is in to your clipboard. I want something similar, but instead of the file path I want the path to the method my cursor is on. For example, look at this class: ``` package com.sandbox; public class Sandbox { public void doSomething() { } } ``` If I put my cursor on/in `doSomething()`, I'd like to press some keyboard command that will put "com.sandbox.Sandbox#doSomething()" into my clipboard. If my cursor is in the method, it would be even better if it could put this into my clipboard: "com.sandbox.Sandbox#doSomething():line 45" as the line my cursor was on when I typed the command. Here's why I want this: I often write emails/instant message other developers and need to tell them to "look at this". It's very easy to get the method name because I'm usually already there. But then I need to scroll up to the class name to tell them the class and I lose my place on the method. I do this often enough in a day that I think I could get some benefit into automating this process.

Original source