While I was perusing the entries here on energy sources for interstellar travel, it occurred to me that a problem accompanying a low energy density in space distant from stars is darkness. Is there a feasible way to detect the location and shape of masses that don't naturally emit light in order to avoid impacts, like by emitting light from our spacecraft or through gravity?
There are a number of methods used nowadays to detect non-light emitting objects in space employed by a wide variety of machines from vessels to satellites to telescopes.
1) Radar- A staple of most vessels, radar isn't infallible and it has limits to its range which can be tricky when dealing with objects traveling at stellar speeds.
2) Electro Magnetic Radiation Bands - This is a gross categorization of various technologies like radio telescopes, infrared, ultraviolet, etc. Just because an object does not emit visible light does not mean it does not emit another EM frequency. This is probably the most diverse field with tons of different machines, algorithms, and applications. (yes I know radar is technically part of this, I called it out separately more for its close range applications) The only limitation to these technologies, in a sci-fi space travel context, is that EMR is still light and can only travel at the speed of light.
Now we reach some of the more crafty techniques
3) Gravitational Wobble - though not its official name, this technique is used to find planets by closely observing the wobble visible objects in deep space make. Just as the Sun influences the movement of Jupiter so too does Jupiter influence the position of the Sun. Then by observing even smaller deviations of that movement can you discern the presence of other smaller planets.
4) Deviations in light - This is another planet hunting technique that could be adapted for long range object detection. This technique involves closely observing the output of light from an object. Decreases in light can indicate the presence of objects between the light source and the observer. This could be adapted for deep space travel.
5) Gravitational Lensing - This is mostly used to find black holes. Light is affected by gravity. In the presence of extremely high gravitational fields the path of light can become so bent that objects that would have been hidden on the opposite side of the black hole can become visible. The most famous example of this is referred to as Einstein's Cross where the light from a star directly behind a black hole (from our perspective) wrapped around producing the appearance of 4 identical stars (something that is on the verge of impossible).
Realistically, the more practical methods are going to be EMR based methods. This is because we understand them, we can emit them and they travel fast. They can cover large areas and their effective range is usually constrained by the limits of their emission source. Though, like shining a flashlight out into the woods you can only make out so much with your eyes and tiny flashlight.
For interstellar travel - Is there a feasible way to detect the location and shape of masses that don't naturally emit light in order to avoid impacts, like by emitting light from our spacecraft or through gravity?
Since the location where you will be traveling is very distant from Earth trying to perform a preventative measure on Earth will be subject to inaccuracies due to the distance and lead time. That probably restricts you to relying on equipment and techniques aboard your vessel.
Emitting light from your spacecraft would probably involve a scanning laser beam to illuminate potential targets; that assumes that the target isn't non-reflective, like carbonaceous or D-type asteroids which have a low albedo.
Going the opposite direction with that idea and attempting to see the dark object blocking backlight relies on having the two line up on a vector relative to your direction and speed, both decreasing the probability of detection and increasing the complexity of the calculations - not helpful if you prefer to travel quickly over long distances.
Relying on gravity has similar problems, gravitational waves have only been detected from black hole mergers and stellar sized objects; alternatively, attempting to detect the effect of one object on another and calculate the paths of objects will be slow. An object needs to be big enough to have enough gravity to detect easily, and a black hole a millionth the size of a dime would be difficult to detect until you were close enough to be in trouble.
Probably the least expensive way to detect all objects in your path would be by using radar.
It would be possible to send simple scouting drones ahead of you equipped with instruments to detect obstructions but I don't see how it would be better or less expensive than radar, for a manned mission.
For the next few hundred, probably the next few thousand years, unmanned missions make the most sense for travel outside the solar system. Sending two probes allows comparative measurements and 3D calculations along with permitting one to look out for the other, and redundancy.
Space is mostly empty, hitting an object isn't an uninsurable risk.
This depends mostly on how large the mass is you want to detect. Large masses (planets and up) and spacecraft are usually warmer than their surroundings, so they can be picked up with infrared sensors.
For large, cold objects against a reasonably bright background you can use occultation (the object obscuring the light of background stars).
Small, cold objects are much harder. Active detection (using light or e.g. radar to illuminate an object) requires huge amounts of power to get a usable return at a range where you can still avoid the object.