How to create a dictionary for a language?


Hi, I just start trying to use Atom several days ago, previously I used Sublime Text (ST). First of all, I like the style of Atom, everything is quite elegant!

I want to write a language package for NCL like the one I created for ST. The package is almost ready to use, but I can not find a way to define completion dictionary.

In ST, the items in completion file will be auto-completed when user just type some characters (in NCL, there are a lot of parameters, which are hard to remember).

What should we do in Atom? The prefix in a snippet must be typed completely, then type TAB to invoke the snippet body.

Edit: In VIM, we also have dictionary invoked by CTRL-p.


Nobody needs this? Please show me the right direction!


Have you taken a look at Autocomplete Plus?


@leedohm Thanks for replying! I have installed Autocomplete Plus and Autocomplete Snippets, but the prefixes in the snippets/language-ncl.cson are not autocompleted. What do I miss? The doc does not mention anything how to add language snippets.


@leedohm I have followed the tutorial of Autocomplete Plus (Registering and creating a suggestion provider), and added a provider as:

File lib/

NCLProvider = require "./ncl-provider"

module.exports =
    editorSubscription: null
    autocomplete: null
    providers: []
    activate: ->
        atom.packages.activatePackage("autocomplete-plus").then (pkg) =>
                @autocomplete = pkg.mainModule
    registerProviders: ->
        @editorSubscription = atom.workspaceView.eachEditorView (editorView) =>
            if editorView.attached and not
                provider = new NCLProvider editorView
                @autocomplete.registerProviderForEditorView provider, editorView
                @providers.push provider
    deactivate: ->
        @editorSubscription = null
        @providers.forEach (provider) =>
            @autocomplete.unregisterProvider provider
        @providers = []


{Provider, Suggestion} = require "autocomplete-plus"

module.exports =
class NCLProvider extends Provider
    buildSuggestions: ->
        suggestions = []
        suggestions.push new Suggestion(this, word: "addfile", label: "@addfile")
        return suggestions


module.exports = require "./lib/language-ncl-completion"

But the completion list does not show up when I am editing a NCL file.

I am very new to CoffeeScript. Any help is appreciated!


Unfortunately, @dongli I don’t have any solutions. I haven’t tried to make anything like what you’re suggesting work … I was just pointing you in a direction that I thought could work :smile: If I get a chance, I’ll try and take a look at it later, but I’m not confident that I’ll be able to solve your issue. My apologies.