Roast walnuts in a pan over medium heat until nuts start to turn golden brown and become fragrant. Allow to cool and roughly chop.
Preheat oven to 350 degrees F (175 degrees C). Grease a baking dish.
Bring a large pot of lightly salted water to a boil. Cook gnocchi in the boiling water until they float to the top, 2 to 4 minutes. Drain well. Put in prepared baking dish in one layer. Sprinkle walnuts over gnocchi.
Trim garlic scapes if needed by cutting off ends and tips. If you have very fresh and young stalks you can use the entire stalk. Finely chop.
Melt butter in a pan over medium heat. Add garlic scapes and saute for 1 minute. Don't brown butter. Season with salt and pepper and layer over gnocchi. Sprinkle evenly with Parmesan cheese.
Bake in the preheated oven until heated through, about 10 to 15 minutes.