Skip to content

javierartero/vscode-equality

Repository files navigation

Equality

Equality evaluates JavaScript expressions inline inside the active editor and replaces them with the result.

Multi-cursor support

Each cursor evaluates the expression that starts at the last configured symbol on its current line.

Multiple cursor demo

Calculate expressions

Write an expression starting with the configured equality symbol and place the cursor at the end of the expression.

=2 + 2

Run Equality: Evaluate expression with Ctrl+Enter on Windows/Linux or Cmd+Enter on macOS.

Calculate demo

Custom variables

Add variables in your VS Code settings through equality.vars. They are exposed inside expressions as e.<name>.

"equality.vars": {
  "name": "Javier Artero",
  "company": "MarsBased",
  "github": "https://github.com/javierartero"
}

Example:

=e.name

Custom variables demo

Help

Use =help to open the documentation picker. When an evaluation fails, Equality shows relevant documentation links for the current expression.

=help

Help demo

Bundled libraries

chroma-js

Equality exposes chroma and the alias c.

=chroma.scale(['#FFF', 'blue']).colors(5)
=c('white').hex()

Chroma demo

lodash

Equality exposes lodash through _.

=_.camelCase('change of format case')
=_.repeat('I will not copy in class \n', 5)

Lodash demo

faker

Equality exposes faker and the alias f. The locale is controlled through faker.locale.

=faker.name.findName()

Faker demo

Built-in helpers

rand(min = 0, max = 100)

=rand(-100, 100)

Rand demo

rgb('#ff00aa')

Converts a hexadecimal color to an RGB string. Shorthand values such as #f0a are supported.

hex(255, 0, 170)

Converts RGB channels to hexadecimal notation.

=rgb('#ff87dd')
=hex(255, 213, 65)

Color helpers demo

Configuration

equality.symbol

Defines the symbol used to find the expression start. The default is =.

equality.vars

Defines custom variables exposed through e.

faker.locale

Controls the locale used by faker helpers.

Development

npm install
npm test

About

Visual studio plugin that replaces content by eval() it

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors