The short answer is you probably can't. I'm using a chromebook to type this (and the fact that it's a chromebook is the reason i use this site) and I've tried this several ways. However it's entirely possible that the reason I haven't been able to is that my chromebook belongs to my school, and my school blocks all extensions not made by Google. So, Your best bet is to download the file, put it in your google drive, and then find an extension that can open your file. Generic text file openers should work as most source files for programming are raw text. If not though, you can generally accomplish what you're (most likely) trying to achieve by copy/pasting your code into a google document, (optionally) installing and using the code blocks addon, and copy and pasting it back when you need to. It's probably best if you have multiple source files to copy and paste their code into separate documents.