Code Monkey home page Code Monkey logo

atom-ide-code-format-1's Introduction

Code Format

Usage

  • By default the currently open file is formatted on save.

  • Format a selection of code using the code-format:format-code (CTRL+SHIFT+C) command. (Also accessible via context menu, or "Edit > Text > Format Code"). When no selection is provided, the entire file is formatted.

  • For the languages that support on type formatting, the package is able to format as you type in the editor. You should enable this from the settings of this package (disabled by default).

Code Format

Developer Service API

Code Format also provides APIs to:

  • format code on save (after you press save but before writing to disk).
  • format code as you type

You can enable format-on-save using plain range/file providers from the atom-ide-code-format's settings

Provide code format Atom services by adding one or more of these to your package.json: (Only the ones that you want to use; you don't need all of them!)

"providedServices": {
  "code-format.range": {
    "versions": {
      "0.1.0": "provideRangeCodeFormat"
    }
  },
  "code-format.file": {
    "versions": {
      "0.1.0": "provideFileCodeFormat"
    }
  },
  "code-format.onType": {
    "versions": {
      "0.1.0": "provideOnTypeCodeFormat"
    }
  },
  "code-format.onSave": {
    "versions": {
      "0.1.0": "provideOnSaveCodeFormat"
    }
  }
}

Then, in your package entry point:

export function provideRangeCodeFormat(): RangeCodeFormatProvider {}
export function provideFileCodeFormat(): FileCodeFormatProvider {}
export function provideOnTypeCodeFormat(): OnTypeCodeFormatProvider {}
export function provideOnSaveCodeFormat(): OnSaveCodeFormatProvider {}

The various provider types are described in atom-ide-code-format/lib/types.js.

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.