Finely chop the onion and garlic. Zest the lemon and squeeze the juice into a small bowl, reserving a little zest for garnish.
Place a large deep skillet or sauté pan over medium heat. Add the olive oil and chopped onion. Cook for 2–3 minutes, stirring occasionally, until the onion softens.
Add the garlic and cook for about 1 minute, stirring frequently so it does not burn.
Pour in the broth and bring it to a boil.
Add the lemon juice and most of the lemon zest, reserving a little for serving. Pour in the heavy cream and bring the mixture to a very gentle boil.
Add the uncooked gnocchi to the skillet and stir to coat it in the sauce.
Cover the pan and cook over medium-low heat for 4 minutes.
Remove the lid and give the gnocchi a good stir. Add the raw shrimp and stir well to distribute them throughout the sauce.
Cook uncovered over low heat for about 3 minutes, or until the shrimp are pink, opaque, and cooked through. Stir the sauce regularly while the shrimp cook to prevent sticking and encourage an even, creamy consistency.
Season with salt and black pepper to taste. Serve immediately with fresh parsley and the reserved lemon zest.