}
private void doAddCompletions(CompletionParameters parameters, CompletionResultSet result) {
PsiFile originalFile = parameters.getOriginalFile();
if (originalFile instanceof DBLanguageFile) {
DBLanguageFile file = (DBLanguageFile) originalFile;
CodeCompletionContext context = new CodeCompletionContext(file, parameters, result);
CodeCompletionLookupConsumer consumer = new CodeCompletionLookupConsumer(context);
DBLanguage language = context.getLanguage();
int caretOffset = parameters.getOffset();
if (file.findElementAt(caretOffset) instanceof PsiComment) return;
LeafPsiElement leafBeforeCaret = PsiUtil.lookupLeafBeforeOffset(file, caretOffset);
int invocationCount = parameters.getInvocationCount();
if (invocationCount > 1) context.setExtended(true);
if (leafBeforeCaret == null) {
ElementTypeBundle elementTypeBundle = file.getElementTypeBundle();
Set<LeafElementType> firstPossibleLeafs = elementTypeBundle.getRootElementType().getLookupCache().getFirstPossibleLeafs();
for (LeafElementType firstPossibleLeaf : firstPossibleLeafs) {
if (firstPossibleLeaf instanceof TokenElementType) {
TokenElementType tokenElementType = (TokenElementType) firstPossibleLeaf;
if (context.getCodeCompletionFilterSettings().acceptReservedWord(tokenElementType.getTokenTypeCategory())) {