Pick a suitable folder location to download the Odin language server for example:
c:\Utilities\LSP
Use the following command line to clone the git repository:
git clone https://github.com/DanielGavin/ols.git
This clone should result in the following output:
C:\Utilities\LSP>git clone https://github.com/DanielGavin/ols.git
Cloning into 'ols'...
remote: Enumerating objects: 9651, done.
remote: Counting objects: 100% (612/612), done.
remote: Compressing objects: 100% (148/148), done.
remote: Total 9651 (delta 495), reused 466 (delta 464), pack-reused 9039 (from 4)
Receiving objects: 100% (9651/9651), 3.44 MiB | 1.38 MiB/s, done.
Resolving deltas: 100% (6532/6532), done.
The clone should also have created the following folder:
c:\Utilities\LSP\ols
Building the Language Server
With the download complete, build the language server using the following commands from inside the newly created folder:
cd c:\Utilities\LSP\ols
build.bat
Running these commands should result in the following output:
C:\Utilities\LSP\ols>build.bat
Total Time - 11120.022 ms - 100.00%
initialization - 8.877 ms - 0.07%
parse files - 80.598 ms - 0.72%
type check - 121.484 ms - 1.09%
LLVM API Code Gen - 10816.113 ms - 97.26%
msvc-link - 92.946 ms - 0.83%
With the build complete, the following executable should also have been created:
Directory of C:\Utilities\LSP\ols
26/12/2024 08:34 PM 1,524,224 ols.exe
Note this folder location and executable details, as these details will be needed in the configuration steps that follow.
Configuration
Start Zeus and use the
Options, Document Types menu to edit the Odin document type and in the Language Server configuration panel apply the following configuration settings:
Program Type: Executable
Program: C:\Utilities\LSP\ols\ols.exe
Directory: $wdd
NOTE: The executable details used are the same as the details noted from the earlier steps of the configuration process.
The $wdd value used for the directory is a Zeus tag that will evaluate to the workspace drive and directory. This means the language server will start in that workspace folder if a workspace is open.
This completed setup is shown below:
More details below describe how to configure the Odin language server found
here.
Using the Language Server
To test the configuration, create a simple test.odin
file and fire off an auto-complete request:
In addition to code completion, code navigation, function signatures and document hover should also work.
IMPORTANT: If the auto complete does not fire, try closing all files and then re-opening an odin file, while language server errors can be viewed using the Language Server, Language Server, Display Server Output menu.
Released: 3rd January 2025