Staff and customers were in Peppers takeaway on St John’s Road, Birkby, Huddersfield, when shots were fired at around 10.30pm on Thursday.
A 19-year-old man was taken to hospital for treatment to a minor injury caused by broken glass.
Detectives are also investigating an assault on a man outside a private hospital on Birkby Hall Road, Huddersfield, in the early hours of Wednesday morning.
That attack forced the closure of BMI The Huddersfield Hospital.
The incidents remain two separate investigations, but officers are investigating the possibility that they are linked.
Detective Chief Inspector Jim Griffiths, of West Yorkshire Police said: “We believe Thursday night’s incident was a targeted attack involving parties known to each other.
“The criminal use of firearms in our communities will not be tolerated and we are treating the incident very seriously, with specialist officers and firearms officers carrying out extensive enquiries to find those involved.”
Call police on 101, quoting crime reference 13180421039.