GithubHelp home page GithubHelp logo

mossskito / autocomplete-plus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atom/autocomplete-plus

0.0 1.0 0.0 1.59 MB

View and insert possible completions in the editor while typing

License: MIT License

JavaScript 98.16% CSS 1.84%

autocomplete-plus's Introduction

Autocomplete+ package

macOS Build Status Windows Build status Dependency Status

Displays possible autocomplete suggestions on keystroke (or manually by typing ctrl-space) and inserts a suggestion in the editor if confirmed.

autocomplete+

Changelog

Installation

autocomplete+ is bundled with Atom. You don't have to do anything to install it.

Providers

autocomplete+ has a powerful autocomplete provider API, allowing provider authors to add language-specific behavior to this package.

You should definitely install additional providers (the default provider bundled with this package is somewhat crude): https://github.com/atom/autocomplete-plus/wiki/Autocomplete-Providers

Usage

Just type some stuff, and autocomplete+ will automatically show you some suggestions. Press UP and DOWN to select another suggestion, press TAB or ENTER to confirm your selection. You can change the default keymap in Preferences:

  • Keymap For Confirming A Suggestion

Additionally, the confirm keymap can be customized in your keymap.cson:

'atom-text-editor.autocomplete-active':
  'tab': 'unset!'
  'ctrl-shift-a': 'autocomplete-plus:confirm'

If setting custom keybindings, use the none setting for the confirmation keymap. All this option does is not set any other keybindings. This allows the TAB and ENTER keys to be used like normal, without side effects.

Remapping Movement Commands

By default, autocomplete-plus commandeers the editor's core movement commands when the suggestion list is open. You may want to change these movement commands to use your own keybindings.

First you need to set the autocomplete-plus.useCoreMovementCommands setting to false, which you can do from the autocomplete-plus settings in the settings view.

core-movement

Or by adding this to your config file:

"*":
  "autocomplete-plus":
    "useCoreMovementCommands": false

Then add these to your keymap file:

'body atom-text-editor.autocomplete-active':
  'ctrl-p': 'autocomplete-plus:move-up'
  'ctrl-n': 'autocomplete-plus:move-down'
  'pageup': 'autocomplete-plus:page-up'
  'pagedown': 'autocomplete-plus:page-down'
  'home': 'autocomplete-plus:move-to-top'
  'end': 'autocomplete-plus:move-to-bottom'

Features

  • Shows suggestions while typing
  • Includes a default provider (SymbolProvider):
    • Wordlist generation happens when you open a file, while editing the file, and on save
    • Suggestions are calculated using fuzzaldrin
  • Exposes a provider API which can be used to extend the functionality of the package and provide targeted / contextually correct suggestions
  • Disable autocomplete for file(s) via blacklisting, e.g. *.md to blacklist Markdown files
  • Disable autocomplete for editor scope(s) via blacklisting
  • Expands a snippet if an autocomplete+ provider includes one in a suggestion
  • Allows external editors to register for autocompletions

Provider API

Great autocomplete depends on having great autocomplete providers. If there is not already a great provider for the language / grammar that you are working in, please consider creating a provider.

Read the Provider API documentation to learn how to create a new autocomplete provider.

SymbolProvider Configuration

If the default SymbolProvider is missing useful information for the language / grammar you're working with, please take a look at the SymbolProvider Config API.

The watchEditor API

The watchEditor method on the AutocompleteManager object is exposed as a provided service, named autocomplete.watchEditor. The method allows external editors to register for autocompletions from providers with a given set of labels. Disposing the returned object will undo this request. External packages can access this service with the following code.

In package.json:

{
  "consumedServices": {
    "autocomplete.watchEditor": {
      "versions": {
        "1.0.0": "consumeAutocompleteWatchEditor"
      }
    }
  }
}

In the main module file:

consumeAutocompleteWatchEditor(watchEditor) {
  this.autocompleteDisposable = watchEditor(
    this.editor, ['symbol-provider']
  )
}

autocomplete-plus's People

Contributors

50wliu avatar abe33 avatar aerijo avatar as-cii avatar benogle avatar braver avatar damieng avatar jasonrudolph avatar jeancroy avatar joefitzgerald avatar kevinnathan avatar kevinsawicki avatar lee-dohm avatar leroix avatar maxbrunsfeld avatar mcolyer avatar mnquintana avatar nixel2007 avatar okbel avatar park9140 avatar pfitzseb avatar phyllisstein avatar sadikovi avatar saschagehlich avatar simurai avatar smashwilson avatar timvdlippe avatar tinloaf avatar willthemoor avatar yongkangchen avatar

Watchers

 avatar

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.