{"id":19608616,"url":"https://github.com/teamwork/autocomplete","last_synced_at":"2026-02-27T21:02:08.056Z","repository":{"id":36220353,"uuid":"212302233","full_name":"Teamwork/autocomplete","owner":"Teamwork","description":"An autocomplete module for all text editors and frameworks.","archived":false,"fork":false,"pushed_at":"2023-01-08T03:19:32.000Z","size":2295,"stargazers_count":6,"open_issues_count":22,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-10T21:18:54.957Z","etag":null,"topics":["autocomplete"],"latest_commit_sha":null,"homepage":"https://teamwork.github.io/autocomplete/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Teamwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-02T09:36:15.000Z","updated_at":"2023-12-01T07:42:34.000Z","dependencies_parsed_at":"2023-01-16T23:32:00.840Z","dependency_job_id":null,"html_url":"https://github.com/Teamwork/autocomplete","commit_stats":null,"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"purl":"pkg:github/Teamwork/autocomplete","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fautocomplete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fautocomplete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fautocomplete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fautocomplete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teamwork","download_url":"https://codeload.github.com/Teamwork/autocomplete/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fautocomplete/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259503400,"owners_count":22867990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomplete"],"created_at":"2024-11-11T10:15:57.374Z","updated_at":"2026-02-27T21:02:07.967Z","avatar_url":"https://github.com/Teamwork.png","language":"TypeScript","readme":"# @teamwork/autocomplete\n\nAn autocomplete system designed to support virtually any text editor and UI framework with minimal effort.\n\n## Usage\n\nThis is just a trivial example using [CodeMirror](https://codemirror.net/) and [Vue](https://vuejs.org/), however, you can use any other editor and framework in a similar way - `@teamwork/autocomplete` supports a few out of the box and more can be implemented easily.\n\nKeep in mind that autocomplete component styles are not included - you can use `./demo/autocomplete/style.css` as an inspiration when defining your own.\n\n```javascript\nimport 'codemirror/lib/codemirror.css'\nimport CodeMirror from 'codemirror'\nimport Vue from 'vue'\nimport { createAutocomplete } from '@teamwork/autocomplete-core'\nimport { createEditorAdapter } from '@teamwork/autocomplete-editor-codemirror'\nimport { TwAutocomplete } from '@teamwork/autocomplete-ui-vue'\n\n// Prepare the editor.\nconst node = document.getElementById('editor')\nconst editor = CodeMirror(node)\nconst editorAdapter = createEditorAdapter(editor)\n\n// Configure autocomplete.\nconst autocomplete = createAutocomplete({\n    editorAdapter,\n    match(textBeforeCaret, textAfterCaret) {\n        // Match `@\\w*` before caret surrounded by white space or end of string.\n        const match = /(?:^|\\s)(@\\w*)$/.exec(textBeforeCaret)\n        if (match \u0026\u0026 /^($|\\s)/.test(textAfterCaret)) {\n            return [match[1].length, 0]\n        } else {\n            return [-1, -1]\n        }\n    },\n    load(matchedText) {\n        // Load users filtered by the matched text.\n        return loadUsers(match.substring(1))\n    },\n    accept(user) {\n        // Autocomplete with the user's first and last names.\n        return `${user.firstName} ${user.lastName}`\n    },\n})\n\n// Display an autocomplete list as needed.\nconst vm = new Vue({\n    name: 'App',\n    el: '#autocomplete',\n    components: { TwAutocomplete },\n    mounted() {\n        this.$refs.autocomplete.init(autocomplete)\n    },\n    render(createElement) {\n        return createElement('TwAutocomplete', { ref: 'autocomplete' })\n    },\n})\n```\n\n## Demo and API Docs\n\nVisit https://teamwork.github.io/autocomplete/ or run `npm start` locally.\n\n## Notable npm Scripts\n\n-   `npm start`: Compiles TypeScript in \"watch\" mode, runs the demo app with life reload and serves static API docs.\n-   `npm test`: Runs all unit tests.\n-   `npm run build`: Builds and tests all code. It runs automatically on commit.\n-   `npm run docs`: Generates the demo app and API docs in the `./docs` folder for [GitHub Pages](https://pages.github.com/).\n-   `npm run gh-pages`: Builds API docs and demo, and then pushes them to gh-pages branch.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fautocomplete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteamwork%2Fautocomplete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fautocomplete/lists"}