<commit_before>package org.jetbrains.haskell.actions

import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.codeInsight.hint.HintManager
import org.jetbrains.haskell.external.BuildWrapper
import org.jetbrains.haskell.util.getRelativePath
import org.jetbrains.haskell.util.LineColPosition
import com.intellij.psi.PsiElement

/**
 * Created by atsky on 5/30/14.
 */
class ShowSymbolInfoAction : AnAction() {

    override fun actionPerformed(e: AnActionEvent?) {
        if (e == null) {
            return
        }
        val editor = e.getData(CommonDataKeys.EDITOR)
        val psiFile = e.getData(CommonDataKeys.PSI_FILE)

        if (editor == null || psiFile == null) {
            return
        }

        val offset = editor.getCaretModel().getOffset();
        val element = psiFile.findElementAt(offset)

        if (element == null) {
            return
        }

        val moduleContent = BuildWrapper.getModuleContentDir(element)
        val relativePath = getRelativePath(moduleContent.getPath(),
                psiFile.getVirtualFile()!!.getPath())

        val lineColPosition = LineColPosition.fromOffset(psiFile, element.getTextOffset())!!

        val info = BuildWrapper.init(moduleContent).thingatpoint(relativePath, lineColPosition)
        System.out.println(info)
        val name = info?.get("Name") as String?
        val aType = info?.get("QType") as String?
        val text = name + " :: " + aType

        HintManager.getInstance()!!.showInformationHint(editor, text)
    }


}<commit_msg>Remove debug info. Fix NPE<commit_after>package org.jetbrains.haskell.actions

import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.codeInsight.hint.HintManager
import org.jetbrains.haskell.external.BuildWrapper
import org.jetbrains.haskell.util.getRelativePath
import org.jetbrains.haskell.util.LineColPosition
import com.intellij.psi.PsiElement

/**
 * Created by atsky on 5/30/14.
 */
class ShowSymbolInfoAction : AnAction() {

    override fun actionPerformed(e: AnActionEvent?) {
        if (e == null) {
            return
        }
        val editor = e.getData(CommonDataKeys.EDITOR)
        val psiFile = e.getData(CommonDataKeys.PSI_FILE)

        if (editor == null || psiFile == null) {
            return
        }

        val offset = editor.getCaretModel().getOffset();
        val element = psiFile.findElementAt(offset)

        if (element == null) {
            return
        }

        val moduleContent = BuildWrapper.getModuleContentDir(element)
        val relativePath = getRelativePath(moduleContent.getPath(),
                psiFile.getVirtualFile()!!.getPath())

        val lineColPosition = LineColPosition.fromOffset(psiFile, element.getTextOffset())!!

        val info = BuildWrapper.init(moduleContent).thingatpoint(relativePath, lineColPosition)

        val name = info?.get("Name") as String?
        val aType = info?.get("QType") as String?
        if (name != null && aType != null) {
            val text = name + " :: " + aType
            HintManager.getInstance()!!.showInformationHint(editor, text)
        }
    }


}
{'fraction_non_alphanumeric': 0.10488298179716844, 'fraction_numerical': 0.002889338341519792, 'mean_word_length': 3.039673278879813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7487117', 'n_tokens_mistral': 1034, 'n_tokens_neox': 992, 'n_words': 188}