Editor

Problems

  • encoding
  • style
  • hint
  • large code base
  • extension

Solution

gitattributes

Git can handle file encoding and line ending, use config file to override gloabl config.

Offical Doc

  • encoding, UTF-8
  • end of line (crlf) , sh files can only use LF

Example:

# Force sh file use lf
*.sh text eol=lf
Makefile text eol=lf
*.bat text eol=crlf

editorconfig

A editor independent style config. Some editor has it built in, most has plugin for it.

Offical Site

  • encoding
  • end of line (crlf)
  • indent
  • tab

Example

root = true

[*]
insert_final_newline = true
indent_style = space
charset = utf-8

[*.{sh,js,php,css,scss}]
end_of_line = lf
charset = utf-8

[*.{js,json,yml}]
indent_size = 2

[*.php]
indent_size = 4

[*.{md,markdown}]
indent_size = 4

[Makefile]
indent_style = tab

lint tools

Lint tools can change your style, some can auto fix minor problems. You can also config git hooks to force running lint tools before commit. Some git host like phabricator also support running it on server.

IDE

Integrated Development Environment. Editor + Code runner + Debugger .... etc.

Jetbrains

Student can have free liciense

Also have plugin for Golang

How hint works

Hint is the editor show a list of words based on what you typed. It is also known as autocomplete, intellisense.

Text only

The editor show hint based on the words in this file only.

TODO: image

Example

  • Atom
  • Sublmie
  • VSCode

Analysis result

The editor (most time IDE) analysis all the code used in current project, including your code, library code, standard library code. This is also called index, similar to what search engine does.

TODO: image

Example

  • Eclipse
  • JetBrains IDE
  • Visual Studio

However, with plugins, a lot editors can also show hint based on analysis result, like VSCode works perfectly with C# if you have Visual Studio installed.

Outdated editor and IDE

If you want to waste time, try one of the following. If you want to waste other people’s time, recommend those to them.

  • Dreamweaver