Don't embed a screenshot of code - paste in the original code into the body of the document as raw text.
To learn how to get syntax highlighting in Google Docs, see https://github.com/styles-wiki/techwriting/issues/4
Why?
- Screenshots can't be easily updated. The original author has to go back to their IDE and take a new screenshot. Coauthors would have to retype the whole thing out.
- In Google Docs, you can't comment on specific lines - only the image as a whole.
- Accessibility - screenshots can't be read out be screen readers, colors can't be changed, the font size can't be increased without blurring etc...