Skip to content

Instantly share code, notes, and snippets.

Last active February 24, 2023 06:03
What would you like to do?
Sample Ace Editor custom completer
// fetch ace's language tools module:
var langTools = ace.require('ace/ext/language_tools');
// data stub:
var sqlTables = [
{ name: 'users', description: 'Users in the system' },
{ name: 'userGroups', description: 'User groups to which users belong' },
{ name: 'customers', description: 'Customer entries' },
{ name: 'companies', description: 'Legal entities of customers' },
{ name: 'loginLog', description: 'Log entries for user log-ins' },
{ name: 'products', description: 'Products offered in the system' },
{ name: 'productCategories', description: 'Different product categories' }
// create a completer object with a required callback function:
var sqlTablesCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
callback(null, {
return {
caption: table.description,
meta: "Table"
// finally, bind to langTools:
Copy link

mahdi943 commented Mar 9, 2021

I am using Ace editor in my project and also used CustomeCompleter to have my own list.
Could you please help me to delete the old list if I need to replace it with a new one?


Copy link

@mahdi943 You want to clear the completers list before adding one. So change the last line of this gist:


Copy link

pazooki commented Sep 27, 2022

hi there, var langTools = ace.require('ace/ext/language_tools');
ace.require returns none for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment