How to represent source code in NLP for tasks like code retrieval? How to represent code features in NLP? Can treat code like a language and pour into the neural network? Are there some work, paper or material around this topic?

Yes, I remember I saw some work started many years ago. I quick search returns these results.
I think (not sure) for character level modeling, not too much preprocess needed.
https://www.nytimes.com/2021/09/09/technology/codex-artificial-intelligence-coding.html
https://www.economist.com/science-and-technology/2021/07/07/ai-is-transforming-the-coding-of-computer-programs
https://arxiv.org/abs/2107.03374
https://arxiv.org/pdf/1709.06182.pdf
