// Path: com.palantir.typescript/src/com/palantir/typescript/TypeScriptPlugin.java
// public static IStatus logError(String message, Throwable t) {
//     IStatus status = new Status(IStatus.ERROR, TypeScriptPlugin.ID, message, t);
//     TypeScriptPlugin.getDefault().getLog().log(status);
//     return status;
// }
// 
// Path: com.palantir.typescript/src/com/palantir/typescript/services/language/CompletionEntryDetails.java
// public final class CompletionEntryDetails {
// 
//     private String name;
//     private ScriptElementKind kind;
//     private ImmutableList<ScriptElementKindModifier> kindModifiers;
//     private ImmutableList<SymbolDisplayPart> displayParts;
//     private ImmutableList<SymbolDisplayPart> documentation;
//     private ImmutableList<JSDocTagInfo> tags;
// 
//     public CompletionEntryDetails(
//             @JsonProperty("name") String name,
//             @JsonProperty("kind") ScriptElementKind kind,
//             @JsonProperty("kindModifiers") String kindModifiers,
//             @JsonProperty("displayParts") List<SymbolDisplayPart> displayParts,
//             @JsonProperty("documentation") List<SymbolDisplayPart> documentation,
//             @JsonProperty("tags") List<JSDocTagInfo> tags) {
//         checkNotNull(name);
//         checkNotNull(kind);
//         checkNotNull(kindModifiers);
// 
//         this.name = name;
//         this.kind = kind;
//         this.kindModifiers = ScriptElementKindModifier.parseList(kindModifiers);
//         this.displayParts = ImmutableList.copyOf(displayParts);
//         this.documentation = ImmutableList.copyOf(documentation);
//         this.tags = ImmutableList.copyOf(tags);
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public ScriptElementKind getKind() {
//         return this.kind;
//     }
// 
//     public ImmutableList<ScriptElementKindModifier> getKindModifiers() {
//         return this.kindModifiers;
//     }
// 
//     public String getDisplayParts() {
//         return SymbolDisplayPart.getText(this.displayParts);
//     }
// 
//     public String getDocumentation() {
//         return SymbolDisplayPart.getText(this.documentation);
//     }
// 
//     public String getTags() {
//         return JSDocTagInfo.getText(this.tags);
//     }
// 
//     @Override
//     public String toString() {
//         return Objects.toStringHelper(this)
//             .add("name", this.name)
//             .add("kind", this.kind)
//             .add("kindModifiers", this.kindModifiers)
//             .add("displayParts", this.displayParts)
//             .add("documentation", this.documentation)
//             .add("tags", this.tags)
//             .toString();
//     }
// 
// }


import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.palantir.typescript.TypeScriptPlugin.logError;
import java.util.List;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ContentAssistEvent;
import org.eclipse.jface.text.contentassist.ContextInformationValidator;
import org.eclipse.jface.text.contentassist.ICompletionListener;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.swt.graphics.Image;
import com.google.common.base.CharMatcher;
import com.google.common.base.StandardSystemProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.palantir.typescript.Images;
import com.palantir.typescript.services.language.CompletionEntryDetails;
import com.palantir.typescript.services.language.CompletionInfoEx;

    @Override
    public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
        checkNotNull(viewer);
        checkArgument(offset >= 0);

        // get the completion info
        if (this.currentCompletionInfo == null || offset < this.currentOffset) {
            try {
                this.currentCompletionInfo = this.editor.getLanguageService().getCompletionsAtPosition(offset);
                this.currentOffset = this.getOffset(offset);
            } catch (RuntimeException e) {
                logError(e.getMessage(), e);
            }
        }

        // create the completion proposals from the completion entries
        List<CompletionProposal> proposals = Lists.newArrayList();
        if (this.currentCompletionInfo != null) {
            ImmutableList<CompletionEntryDetails> entries = this.currentCompletionInfo.getEntries();

            // get the current prefix
            String prefix;
            try {
                prefix = this.editor.getDocument().get(this.currentOffset, offset - this.currentOffset);
            } catch (BadLocationException e) {
                throw new RuntimeException(e);
            }
            PrefixMatcher prefixMatcher = new PrefixMatcher(prefix);

// Path: com.palantir.typescript/src/com/palantir/typescript/TypeScriptPlugin.java
// public static IStatus logError(String message, Throwable t) {
//     IStatus status = new Status(IStatus.ERROR, TypeScriptPlugin.ID, message, t);
//     TypeScriptPlugin.getDefault().getLog().log(status);
//     return status;
// }
// 
// Path: com.palantir.typescript/src/com/palantir/typescript/services/language/CompletionEntryDetails.java
// public final class CompletionEntryDetails {
// 
//     private String name;
//     private ScriptElementKind kind;
//     private ImmutableList<ScriptElementKindModifier> kindModifiers;
//     private ImmutableList<SymbolDisplayPart> displayParts;
//     private ImmutableList<SymbolDisplayPart> documentation;
//     private ImmutableList<JSDocTagInfo> tags;
// 
//     public CompletionEntryDetails(
//             @JsonProperty("name") String name,
//             @JsonProperty("kind") ScriptElementKind kind,
//             @JsonProperty("kindModifiers") String kindModifiers,
//             @JsonProperty("displayParts") List<SymbolDisplayPart> displayParts,
//             @JsonProperty("documentation") List<SymbolDisplayPart> documentation,
//             @JsonProperty("tags") List<JSDocTagInfo> tags) {
//         checkNotNull(name);
//         checkNotNull(kind);
//         checkNotNull(kindModifiers);
// 
//         this.name = name;
//         this.kind = kind;
//         this.kindModifiers = ScriptElementKindModifier.parseList(kindModifiers);
//         this.displayParts = ImmutableList.copyOf(displayParts);
//         this.documentation = ImmutableList.copyOf(documentation);
//         this.tags = ImmutableList.copyOf(tags);
//     }
// 
//     public String getName() {
//         return this.name;
//     }
// 
//     public ScriptElementKind getKind() {
//         return this.kind;
//     }
// 
//     public ImmutableList<ScriptElementKindModifier> getKindModifiers() {
//         return this.kindModifiers;
//     }
// 
//     public String getDisplayParts() {
//         return SymbolDisplayPart.getText(this.displayParts);
//     }
// 
//     public String getDocumentation() {
//         return SymbolDisplayPart.getText(this.documentation);
//     }
// 
//     public String getTags() {
//         return JSDocTagInfo.getText(this.tags);
//     }
// 
//     @Override
//     public String toString() {
//         return Objects.toStringHelper(this)
//             .add("name", this.name)
//             .add("kind", this.kind)
//             .add("kindModifiers", this.kindModifiers)
//             .add("displayParts", this.displayParts)
//             .add("documentation", this.documentation)
//             .add("tags", this.tags)
//             .toString();
//     }
// 
// }


// Path: com.palantir.typescript/src/com/palantir/typescript/text/ContentAssistProcessor.java
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.palantir.typescript.TypeScriptPlugin.logError;
import java.util.List;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ContentAssistEvent;
import org.eclipse.jface.text.contentassist.ContextInformationValidator;
import org.eclipse.jface.text.contentassist.ICompletionListener;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.swt.graphics.Image;
import com.google.common.base.CharMatcher;
import com.google.common.base.StandardSystemProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.palantir.typescript.Images;
import com.palantir.typescript.services.language.CompletionEntryDetails;
import com.palantir.typescript.services.language.CompletionInfoEx;


    @Override
    public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
        checkNotNull(viewer);
        checkArgument(offset >= 0);

        // get the completion info
        if (this.currentCompletionInfo == null || offset < this.currentOffset) {
            try {
                this.currentCompletionInfo = this.editor.getLanguageService().getCompletionsAtPosition(offset);
                this.currentOffset = this.getOffset(offset);
            } catch (RuntimeException e) {
                logError(e.getMessage(), e);
            }
        }

        // create the completion proposals from the completion entries
        List<CompletionProposal> proposals = Lists.newArrayList();
        if (this.currentCompletionInfo != null) {
            ImmutableList<CompletionEntryDetails> entries = this.currentCompletionInfo.getEntries();

            // get the current prefix
            String prefix;
            try {
                prefix = this.editor.getDocument().get(this.currentOffset, offset - this.currentOffset);
            } catch (BadLocationException e) {
                throw new RuntimeException(e);
            }
            PrefixMatcher prefixMatcher = new PrefixMatcher(prefix);

            for (CompletionEntryDetails entry : entries) {