Sublime Forum

Do you use interactive build? If so, this may be for you

#1

The following has been developed for de Julia REPL, but it would also work with minor changes for Python, for instance.

The build file JuliaREPL.sublime-build

{ // This build system simply opens a new interactive Julia REPL 
    // 2023 Petr Krysl
    // Depends on AbbreviatedStackTraces
    "target": "terminus_open",
    "auto_close": false,
    "title": "Julia REPL",
    "shell_cmd": "julia -t4", // Assume that PATH is set before invoking the editor
    "cwd": "${file_path:${folder}}",
    "selector": "source.julia",
    "focus": true,
    "file_regex": "^\\s*[@][\\s\\S.*]*\\s(\\S.+.jl):([0-9]+)\\s*"
}

The Terminus Settings

{
    // a list of available shells to execute
    // the shell marked as "default" will be the default shell
    "shell_configs": [
        {
            "name": "Git bash",
            "cmd": "bash.exe",
            "env": {},
            "enable": true,
            "default": true,
            "platforms": ["windows"],
        },
    ],
    "unix_term": "xterm-256color",
    "unix_lang": "en_US.UTF-8",
    "min_columns": 128, 
    "view_settings": {
        "font_face": "JetBrains mono",
        },
}

This works for the following error lines:

@ Main.sphere_mode_examples C:\Users\pkonl\Documents\00WIP\FinEtoolsAcoustics.jl\examples\modal\sphere_mode_examples.jl:72 
@ C:\Users\pkonl\Documents\00WIP\FinEtoolsAcoustics.jl\examples\modal\sphere_mode_examples.jl:72

Note the minimum-columns setting: this sets the Terminus to a width that prevents wrapping. Wrapping would ruin the matching of the regex.

Go-to-error then works with typing F4, with the cursor placed above the error message.

1 Like

#2

@PetrKrysl The code for the Julia-REPL is really helpful. I’m new to ST and want to use it for Julia development.

Up to now I’ve installed the LSP-package, Julia-package and the Julia-LSP. Syntax highlighting etc. works very well with this setting.

But I’ve problems running some code snippets within the REPL. I can open the Julia-REPL with the help of your code for the JuliaREPL-build. Then I would like to send and execute code blocks to the REPL.

LSP-julia offers the commands “Run Code Block” or “Run Code Cell” for this purpose. But with many code cells they don’t work as expected. E.g. an array definition as follows

a = [
 34,
 56,
 78
]

doesn’t lead to a new array a with the listed values. Instead the closing ] enters package mode and the REPL get’s messed up.

I would like to have something that just sends a code cell to the REPL without doing such weird things. Do have a hint on how to do that? Would the SendCode-Package be helpful in this context?

0 Likes

#3

I’m afraid I don’t use ST anymore. My advice atm is to switch to VS Code. It is more powerful, and rapidly improving.

0 Likes