DEV Community

stereobooster
stereobooster

Posted on • Originally published at stereobooster.com on

Improve your IDE

Improve syntax highlighting

Traditionally IDE (or text editors) use regular expressions to do syntax highlighting. This approach is limited in what is highlight correctly. They do it because:

  • it will work even for files with syntax errors
  • it is faster than do real parsing on each keystroke (programming languages typically use context-free grammar)

Tree-sitter uses incremental parsing, which allows it to do real parsing on each keystroke fast - it reparses only changed region of code and reuses parse tree from the previous parse for the rest.

Support for IDEs:

Note: you don't need to use tree-sitter if you use a language server

Improve code completion, code navigation and more

Language server can parse and analyze your code (do type checking if it is available for the PL). This allows LS to do more intelligent code completion, show documentation or type information on hover, jump to definition (more intelligently than ctags), find references (more intelligently than text search).

Support for IDEs:

Support for languages: see table here.

Improve code formatting

Pretty-printer (sometimes called code beautifier or code formatter) will automatically apply code formatting rules to the code, for example, it will put correct indentation, use correct quotes, add or remove the semicolon at the end of the line.

Examples pretty-printers: prettier (JavaScript, Flow, TypeScript, Vue, JSON, CSS, Less, SCSS, GraphQL, and Markdown), black. See big list of code formatters here.

Note: ESLint's and RuboCop's autofix features are not good examples of pretty-printers. They were designed with a different purpose - they are good linters, but they are less effective as pretty-printer and they don't use stable algoriths for printing.

What is your recommendation for improving IDEs?

There are other cool projects, like predictive code competition which uses machine learning to provide more relevant suggestions (kite, tabnine). But I recommended only things that I have tried.

What would you recommend that you tried and it significantly improved your experience?

Discussion (1)

Collapse
sinepel profile image
Constantin Boulanger

Hi ! Thanks for your post !

I also write a post on my blog to share my favorite plugins for VS Code !