ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-julia

by sublimelsp ST4

Julia support for Sublime's LSP plugin using LanguageServer.jl

Details

Installs

  • Total 825
  • Win 320
  • Mac 237
  • Linux 268
Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13
Windows 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 2 8 0 2 2 5 1 0 2 1 0 0 2 2 2 0 0 4 1 0 0 3 0 0 0 1 1 0 1 0 0
Mac 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 2 0 1 0 0 0 0 0 2 1 1 0 3 3 0 1 1 0 1 0 1 10
Linux 0 0 1 2 2 0 1 2 0 1 1 0 0 1 0 0 1 0 1 0 0 2 2 0 0 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1

Readme

Source
raw.​githubusercontent.​com

LSP-julia

License

A plugin for the LSP client in Sublime Text with support for the Julia language server.

Requirements & Installation

  • Julia must be installed on your machine. If the julia executable is not in your PATH, you need to provide the full path to the executable in the LSP-julia package settings.
  • The Julia package from Package Control should be installed for syntax highlighting and allows the language server to start for Julia source files.
  • Install the LSP package and LSP-julia from Package Control. When a Julia file is opened for the first time after installing this package, the language server will automatically be installed via the Julia package manager (this can take 1-2 minutes).
  • Optionally install the Terminus package from Package Control for a simple Julia REPL integration and some functionality to run code (see below).

Features

Most of the standard LSP features like auto-completion, documentation on hover, or goto definition are supported by the Julia language server. Some features like diagnostics require that a folder was opened in Sublime Text, and will not work in single file mode.

LSP-julia provides additional commands which are available from the command palette:

Command label Key binding Description
LSP-julia: Change Current Environment none Select the Julia project environment you are working in. The packages from this environment are used by the language server to provide autocomplete suggestions and for diagnostics/linting. Dependent on the number of packages, it might take a while for the server to do a package indexing process in the background, after switching to a different environment.
LSP-julia: Documentation none Search the Julia documentation and open the results in a tab. You can also right-click on a word in a Julia file and select “Show Documentation” from the context menu to open the corresponding documentation page.
LSP-julia: Open Julia REPL in Panel1 none Open a Julia REPL, started in the directory of the active file, or focus if already running.
LSP-julia: Open Julia REPL in Tab1 none Same as above, just use a normal tab instead of the bottom panel for the REPL.
LSP-julia: Select Code Block none Select the function or code block at the current cursor position. For multiple active cursors, only the topmost cursor position is taken into account.
LSP-julia: Run Code Block1 Alt+Enter If text is selected, run it in a Julia REPL. Otherwise, run the code block containing the current cursor position and move curser to the next block.
LSP-julia: Run Code Cell1 Alt+Shift+Enter If text is selected, run it in a Julia REPL. Otherwise, run the code cell containing the current cursor position and move curser to the next cell. Code cells are signalized with a specially formatted comment at the start of a line: ##, #%% or # %%.
LSP-julia: Run Testitem none Show a quick panel with all available @testitems in Julia files (see description below).

Commands marked with a 1 are only available if you have the Terminus package installed.

To add or adjust key bindings for the commands, edit the .sublime-keymap file for your OS in your Packages/User folder. For an example refer to the Default.sublime-keymap file in this repository, and for the command names from this package see LSP-julia.sublime-commands.

Run individual test items

LSP-julia has a custom feature, similar to the Julia extension for VS Code, which allows to run individual testsets from a Julia package directly from the editor UI.

For this to work, the tests must be contained within a @testitem block, which is basically a replacement for @testset. For an example see the screenshot below or read the detailed description at https://github.com/julia-vscode/TestItemRunner.jl#writing-tests.

Note The @testitem has an isolated scope. The package to be tested is loaded implicitly through using. To access unexported symbols, either export them or call them by prepending the module name. (i.e. MyPackage.foo())

A @testitem can be run via the “Run Test” link shown in an annotation on the righthand side of the editor, or via the “LSP-julia: Run Testitem” command from the command palette. Possible test failures or errors will be shown as annotations at the position in the code where they occured.

Note The @testitem feature only works in project environments, i.e. you must have opened a folder in the sidebar which contains a Project.toml file with a name and uuid field.

To completely disable this feature, you can toggle off the following entry in the LSP-julia.sublime-settings file:

{
  "initializationOptions": {
    "julialangTestItemIdentification": false
  }
}

Testitem preview