-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
161 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/org/ice1000/julia/lang/execution/julia-console-filter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.ice1000.julia.lang.execution | ||
|
||
import com.intellij.execution.filters.* | ||
import com.intellij.openapi.project.Project | ||
import org.ice1000.julia.lang.JULIA_ERROR_FILE_LOCATION_REGEX | ||
import org.ice1000.julia.lang.JULIA_STACK_FRAME_LOCATION_REGEX | ||
import org.ice1000.julia.lang.module.projectSdk | ||
import java.util.regex.Pattern | ||
|
||
/* | ||
Stack trace example: | ||
[1] include_from_node1(::String) at ./loading.jl:576 | ||
... | ||
while loading /home/ice1000/git-repos/big-projects/cov/cov-plugin-test/src/a.jl, in expression starting on line 8 | ||
*/ | ||
class JuliaConsoleFilter(private val project: Project) : Filter { | ||
private val sdkHomeCache = project.projectSdk?.homePath | ||
|
||
private companion object PatternHolder { | ||
private val STACK_FRAME_LOCATION = Pattern.compile(JULIA_STACK_FRAME_LOCATION_REGEX) | ||
private val ERROR_FILE_LOCATION = Pattern.compile(JULIA_ERROR_FILE_LOCATION_REGEX) | ||
} | ||
|
||
override fun applyFilter(line: String, entireLength: Int): Filter.Result? { | ||
val startPoint = entireLength - line.length | ||
if (line.startsWith('[')) { | ||
val matcher = STACK_FRAME_LOCATION.matcher(line) | ||
if (matcher.find()) { | ||
val (path, lineNumber) = matcher.group().drop(3).split(':') // "at ".length | ||
// val sdkHome = sdkHomeCache ?: return null | ||
val resultFile = project.baseDir.fileSystem.findFileByPath(path) ?: return null | ||
return Filter.Result( | ||
startPoint + matcher.start(), | ||
startPoint + matcher.end(), | ||
OpenFileHyperlinkInfo(project, resultFile, lineNumber.toInt())) | ||
} | ||
} else { | ||
val matcher = ERROR_FILE_LOCATION.matcher(line) | ||
if (matcher.find()) { | ||
val resultFile = project.baseDir.fileSystem.findFileByPath(matcher.group()) ?: return null | ||
val lineNumber = line.split(' ').lastOrNull()?.toInt() ?: return null | ||
return Filter.Result( | ||
startPoint + matcher.start(), | ||
startPoint + matcher.end(), | ||
OpenFileHyperlinkInfo(project, resultFile, lineNumber)) | ||
} | ||
} | ||
return null | ||
} | ||
} | ||
|
||
class JuliaConsoleFilterProvider : ConsoleFilterProvider { | ||
override fun getDefaultFilters(project: Project) = arrayOf(JuliaConsoleFilter(project)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 49 additions & 50 deletions
99
src/org/ice1000/julia/lang/module/JuliaSetupSdkWizardStep.form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.ice1000.julia.lang.module.JuliaSetupSdkWizardStep"> | ||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<xy x="20" y="20" width="1444" height="400"/> | ||
</constraints> | ||
<properties/> | ||
<border type="empty" title-resource-bundle="org/ice1000/julia/lang/julia-bundle" title-key="julia.modules.sdk.title"/> | ||
<children> | ||
<component id="5e1f8" class="javax.swing.JLabel"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text resource-bundle="org/ice1000/julia/lang/julia-bundle" key="julia.modules.sdk.selection.combobox-label"/> | ||
</properties> | ||
</component> | ||
<component id="ced4e" class="com.intellij.ui.components.labels.LinkLabel" binding="juliaWebsite"> | ||
<constraints> | ||
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<icon value="icons/julia.png"/> | ||
<text value="https://julialang.org/downloads/" noi18n="true"/> | ||
</properties> | ||
</component> | ||
<vspacer id="ccd6f"> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</vspacer> | ||
<component id="4568f" class="javax.swing.JLabel" binding="usefulText"> | ||
<constraints> | ||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<horizontalAlignment value="2"/> | ||
<text resource-bundle="org/ice1000/julia/lang/julia-bundle" key="julia.modules.sdk.selection.help"/> | ||
</properties> | ||
</component> | ||
<component id="b6b0e" class="org.ice1000.julia.lang.module.JuliaSdkComboBox" binding="comboBox"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties/> | ||
</component> | ||
</children> | ||
</grid> | ||
</form> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.ice1000.julia.lang.module.JuliaSetupSdkWizardStep"> | ||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> | ||
<margin top="0" left="0" bottom="0" right="0"/> | ||
<constraints> | ||
<xy x="20" y="20" width="648" height="400"/> | ||
</constraints> | ||
<properties/> | ||
<border type="empty" title-resource-bundle="org/ice1000/julia/lang/julia-bundle" title-key="julia.modules.sdk.title"/> | ||
<children> | ||
<component id="5e1f8" class="javax.swing.JLabel"> | ||
<constraints> | ||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<text resource-bundle="org/ice1000/julia/lang/julia-bundle" key="julia.modules.sdk.selection.combobox-label"/> | ||
</properties> | ||
</component> | ||
<component id="ced4e" class="com.intellij.ui.components.labels.LinkLabel" binding="juliaWebsite"> | ||
<constraints> | ||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<icon value="icons/julia.png"/> | ||
<text value="https://julialang.org/downloads/" noi18n="true"/> | ||
</properties> | ||
</component> | ||
<component id="4568f" class="javax.swing.JLabel" binding="usefulText"> | ||
<constraints> | ||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
<properties> | ||
<horizontalAlignment value="2"/> | ||
<text resource-bundle="org/ice1000/julia/lang/julia-bundle" key="julia.modules.sdk.selection.help"/> | ||
</properties> | ||
</component> | ||
<component id="b6b0e" class="org.ice1000.julia.lang.module.JuliaSdkComboBox" binding="comboBox"> | ||
<constraints> | ||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</component> | ||
<vspacer id="ccd6f"> | ||
<constraints> | ||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | ||
</constraints> | ||
</vspacer> | ||
</children> | ||
</grid> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters