What is a Code Editor?
A code editor is a light, fast text editor made for code that colors it, suggests what comes next and flags mistakes, without the weight of a full IDE.
Novice · Software Development · Updated
After this lesson you can
- Explain what a code editor adds to a plain text editor such as Notepad
- Choose between a code editor and an IDE for a task
Key takeaways
- A code editor is a text editor made for code. It colors your code, suggests what comes next and marks mistakes.
- A plain text editor such as Notepad saves the same text, but it knows nothing about code.
- A code editor opens fast and works with many languages. An IDE is bigger, knows one language deeply, and has build, run and debug built in.
- Use your IDE for a Java or C# program, and a code editor for web pages, quick edits and single files.
You could write code in Notepad (TextEdit on a Mac). Code is only text, and a program doesn't care what you typed it in. But Notepad doesn't know it's code: every word looks the same, nothing warns you about a missing quote, and you type every letter yourself. A code editor is a text editor made for code.
What a code editor adds
A code editor saves plain text, like Notepad, and adds the help a programmer needs:
- Syntax highlighting. Syntax means the rules for how code must be written. The editor colors each part of your code by those rules: keywords, text in quotes, numbers and comments each get their own color. You can read code at a glance, and a missing quote shows up as a run of the wrong color.
- Code completion. As you type, the editor suggests names that fit, and Tab or Enter finishes them for you. Less typing, and fewer spelling mistakes.
- Error checking. A wavy red line marks a mistake, before you run anything.
- A whole folder at once. Open a project's folder, and a side bar lists all its files. You can search every file in one go.
Code editor or IDE?
If an IDE is a fitted kitchen, a code editor is a good knife and cutting board: you can grab them in a second, and they do any small job well.
| Code editor | IDE | |
|---|---|---|
| Size | Small: opens in a second or two | Large: takes a while to open a project |
| Languages | Many, with an extension for each | Built for one language or platform |
| Build, run and debug | Added with extensions, or done in the terminal | Built in, ready to go |
| Best for | Web pages, quick edits, single files | A whole Java or C# program |
Many developers keep both open all day. In this course you write Java in IntelliJ IDEA, or C# in Visual Studio, and you write web pages (HTML, CSS and JavaScript) in a code editor, VS Code.
Popular code editors
- Visual Studio Code (VS Code): free, from Microsoft, for Windows, macOS and Linux. It starts small and grows with extensions. It's the code editor this course uses, and the next lesson is about it.
- Notepad++: free and fast, for Windows only. Good for opening a file quickly, even a very large one.
- Sublime Text: fast, for Windows, macOS and Linux. You can try it for free, and it asks you to buy a license to keep using it.
Try it. Open a code file you made during setup, such as HelloBootcamp.java or hello.cs, first in Notepad (TextEdit on a Mac), then in VS Code. In VS Code, delete the closing " of a piece of text in quotes, and watch the colors of the rest of the line change. Then undo it with Ctrl+Z (Cmd+Z on a Mac).
Check yourself
2 questions to try on the lesson page.
So what
Not every job needs the whole kitchen. Knowing when to grab a light code editor and when to open your IDE saves you time every day.