diff --git a/lib/AtomAutocompleteProvider.js b/lib/AtomAutocompleteProvider.js index 05a55e6..d3cff20 100644 --- a/lib/AtomAutocompleteProvider.js +++ b/lib/AtomAutocompleteProvider.js @@ -22,20 +22,24 @@ export class AtomAutocompleteProvider { } // autocomplete-plus - getSuggestions({editor, bufferPosition, prefix: origPrefix}) { + getSuggestions({editor, bufferPosition, scopeDescriptor, prefix: origPrefix}) { // text: 'package.Class.me', prefix: 'package.Class', suffix: 'me' // text: 'package.Cla', prefix: 'package', suffix: 'Cla' // text: 'Cla', prefix: '', suffix: 'Cla' // line: 'new Cla', text: 'Cla', prevWord: 'new' + const line = atomJavaUtil.getLine(editor, bufferPosition); const prevWord = atomJavaUtil.getPrevWord(editor, bufferPosition); const text = atomJavaUtil.getWord(editor, bufferPosition, true) .replace('@', ''); const prefix = text.substring(0, text.lastIndexOf('.')); const suffix = origPrefix.replace('.', ''); - const couldBeClass = /^[A-Z]/.test(suffix) || prefix; let isInstance = false; + const scopes = scopeDescriptor.getScopesArray(); + // check if last scope is storage.type.java + const couldBeClass = (_.last(scopes)=="storage.type.java") + let results = null; if (couldBeClass) { const classes = this.classLoader.findClass(text);