Search in sources :

Example 6 with LintResult

use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.

the class JscsFixAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return;
    final VirtualFile file = (VirtualFile) e.getDataContext().getData(DataConstants.VIRTUAL_FILE);
    JscsProjectComponent component = project.getComponent(JscsProjectComponent.class);
    //        JscsConfigFileListener.start(collectedInfo.project);
    //        actualFile = ActualFile2.getOrCreateActualFile(JSCS_TEMP_FILE_KEY, file, collectedInfo.fileContent);
    //        if (actualFile == null || actualFile.getActualFile() == null) {
    //            return null;
    //        }
    //            File cwd = new File(project.getBasePath());
    //            if (actualFile instanceof ActualFile2.TempActualFile) {
    //                cwd = ((ActualFile2.TempActualFile) actualFile).getTempFile().file.getParentFile();
    //            }
    //        String relativeFile = actualFile.getActualFile().getName();
    //        File cwd = actualFile.getActualFile().getParentFile();
    //            String relativeFile = FileUtils.makeRelative(cwd, actualFile.getActualFile());
    String rc = JscsExternalAnnotator.getRC(project, component.jscsRcFile);
    LintResult result = JscsRunner.fix(project.getBasePath(), file.getPath(), component.nodeInterpreter, component.jscsExecutable, rc, component.preset, component.settings.esnext, component.settings.esprima);
    file.refresh(true, false);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) LintResult(com.jscs.cli.data.LintResult) JscsProjectComponent(com.jscs.JscsProjectComponent)

Aggregations

LintResult (com.jscs.cli.data.LintResult)6 JscsSettings (com.jscs.cli.JscsSettings)3 JscsLint (com.jscs.cli.data.JscsLint)3 Test (org.junit.Test)3 ExecutionException (com.intellij.execution.ExecutionException)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)2 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 JscsProjectComponent (com.jscs.JscsProjectComponent)1