package org.dylanfoundry.deft.filetypes.lid;

import com.intellij.codeInsight.completion.*;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.util.ProcessingContext;
import org.dylanfoundry.deft.filetypes.lid.psi.LIDTypes;
import org.jetbrains.annotations.NotNull;

public class LIDCompletionContributor extends CompletionContributor {
    // See: http://opendylan.org/documentation/library-reference/lid.html#lid-keyword-statements
    private static final String[] STANDARD_KEYWORDS = {
        "Library:",
        "Files:",
        "Synopsis:",
        "Keywords:",
        "Author:",
        "Version:",
        "Description:",
        "Comment:",
        "C-Source-Files:",
        "C-Header-Files:",
        "C-Object-Files:",
        "RC-Files:",
        "C-Libraries:",
        "LID:",
        "Jam-Includes:",
        "Executable:",
        "Base-Address:",
        "Linker-Options:"
    };

    public LIDCompletionContributor() {
        // LID Keywords Statements, complete with standard keywords
        extend(CompletionType.BASIC,
                PlatformPatterns.psiElement(LIDTypes.KEY).withLanguage(LIDLanguage.INSTANCE),
                new CompletionProvider<CompletionParameters>() {
                    @Override
                    protected void addCompletions(@NotNull CompletionParameters completionParameters,
                                                  ProcessingContext processingContext,
                                                  @NotNull CompletionResultSet completionResultSet) {
                        for (String s : STANDARD_KEYWORDS) {
                            completionResultSet.addElement(LookupElementBuilder.create(s));
                        }
                    }
                });
    }
}

@@ -963,16 +963,131 @@
 ptions:%22
+,%0A        %22Copyright:%22,%0A        %22License:%22,%0A        %22Warranty:%22,%0A        %22Major-Version:%22,%0A        %22Minor-Version:%22
 %0A    %7D;%0A

Add in some additional LID keywords.