-
-
Save TristinDavis/e29e433abc0ee972ad24b085ece03a76 to your computer and use it in GitHub Desktop.
Atom autocomplete suggestions on tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{Point} = require 'atom' | |
atom.commands.add 'atom-text-editor', 'custom:tabcomplete', (e) -> | |
editor = atom.workspace.getActiveTextEditor() | |
cursor = editor.getLastCursor() | |
{row, column} = cursor.getBufferPosition() | |
precedingCharacter = editor.getTextInBufferRange([[row, column - 1], [row, column]]) | |
if /\S/.test(precedingCharacter) | |
autocomplete = atom.packages.getActivePackage('autocomplete-plus') | |
return unless autocomplete? | |
manager = autocomplete.mainModule.activate() | |
manager.shouldDisplaySuggestions = true | |
manager.findSuggestions(true) | |
else | |
e.abortKeyBinding() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment