Usually the first steps are to try different FACTORY ammo that's high quality, and to check the extractor for proper shaping and power.
If there's a problem with the extractor the cases can slide out of it before the ejector gets a good bite.
Next is to check the ejector for breaks, chips, alteration, or malformation.
In the case of a gun only ejecting a few feet or the cases more or less just falling out of the ejection port, you'd look at too strong a recoil spring, or the presence of some sort of recoil buffer.
Also comps may add too much weight and slow the slide speed down, or I guess a super effective comp might reduce slide speed too much.
If it's possible, remove the comp and see if that has any effect.
You can buy different power recoil springs direct from Wolff Gun Springs. Carefully experiment with lighter springs, starting with a factory spec spring and working down one weight at a time.
Watch for things like frame or slide battering and don't go too light.