Coder Social home page Coder Social logo

brackets-show-whitespace's Introduction

Show Whitespace

A Brackets extension to visualize whitespace (both spaces and tabs) in the same style as Sublime Text.

Usage

Activate using View > Show Whitespace or by using the shortcut Ctrl-Alt-W (Command-Shift-W on Mac OS X). The extension state is remembered across Brackets launches. Whitespace in all editor windows are visualized, including inline editors.

Technical Details

This extension uses CodeMirror overlays to construct and render whitespace for both spaces and tabs. Each individual character is wrapped in a <span></span> with an appropriate denoting class. The following are all the classes this extension uses and their purpose. Do note that tabs follow this same structure, with the word space replaced with tab.

  • .cm-dk-whitespace-space: Whitespace between any characters
  • .cm-dk-whitespace-leading-space: Whitespace that makes up any indentation
  • .cm-dk-whitespace-empty-line-space: Any lines that consist solely of whitespace
  • .cm-dk-whitespace-trailing-space: Whitespace at the end of a line after any characters
  • .cm-dk-whitespace-*-nonbrk-space: A non-breaking space, which can be classed with any location (such as .cm-dk-whitespace-empty-line-nonbrk-space). This is the only class that does not have a tab counterpart.

The primary extension styling is defined in styles/main.less, which is compiled into CSS, while whitespace colors are defined in Brackets preferences and rendered into styles/whitespace-colors-css.tmpl. Both files are then loaded into Brackets on startup.

Install

Method 1: Open the Brackets Extension Manager and search for "show whitespace"

Method 2: Download the latest revision in .zip archive directly from GitHub and drag it onto the "Drag .zip here" area in the Extension Manager. Alternatively, use the "Install from URL..." link also in the Extension Manager.

Known Issues

  • CodeMirror overlays have a side effect of slowing down the editor in many aspects, including typing and scrolling. If the slowdown is too unbearable, it may be worthwhile to disable the extension except when required.

Brackets Wishlist

What I wish Brackets would provide:

  • An API to remove a command
  • An API to remove a menu item

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.