Options
All
  • Public
  • Public/Protected
  • All
Menu

autosuggestion

test coverage npm version

Generate dynamic, composable suggestions for text completion.

  • suggest words/phrases by scope.
  • define phrase-based suggestions.
  • define lookup-based suggestions (recursive).
  • dynamically add/remove suggestion patterns.

Install

autosuggestion can be used in Node.js and browsers.

npm install autosuggestion

Import

// ES Module (ESM)
import { Dictionary } from 'autosuggestion'
// CommonJS (CJS)
const autosuggestion = require('autosuggestion')
<!-- HTML Script Tag  -->
<script type='text/javascript' src='https://unpkg.com/autosuggestion'></script>

Getting Started

For more details, see documentation.

Creating a Dictionary
const dictionary = new Dictionary()

Examples

list of live example pages brief section descriptions of each feature

Releasing

  1. run npm version major|minor|patch
  2. create release on github manually (triggers a github workflow to publish tp npm)

eventually, consider using semantic-release

Todo

General

  • automate test coverage reporting
  • get 100% test coverage
  • clean up and restructure code
  • setup ci for coverage report + doc generation + npm publishing (look into tags as a mechanism for publishing)
  • generate badges with shields.io
  • include doc comments for typedoc
  • fill out readme
  • update package.json
  • update github
  • update package (use latest package from unpkg.org in browser examples)
  • host documentation

    Documentation

  • Dictionary
  • Scope
  • Suggestion
  • Node
  • types

    Features

  • make Dictionary API handle multiple input data shapes
  • suggestion token annotations (context, etc.)
  • configuration (lookup brackets, etc.)

    Examples

  • examples landing page (browser) (or link in docs)
  • simple, dynamic dictionary (browser)
  • complex, dynamic CFG (browser)
  • lookahead configuration (browser)
  • large dictionary (browser)
  • basic (nodejs)

Index

Type aliases

Pattern

Pattern: Term[]

A sequence of terms which define a suggesion pattern.

ScopeGroupName

ScopeGroupName: string

The name of a scope group defined by a lookup.

ScopeName

ScopeName: string

The name of a scope.

SuggestedPattern

SuggestedPattern: (Word | {})[]

A suggested pattern.

Term

Term: Word | Lookup

A Term is the basic building block of a suggestion pattern. A Term can either be a word or a lookup.

Word

Word: string

A Word is a string.

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Property

Generated using TypeDoc