{"id":32124191,"url":"https://github.com/danielgavin/ols","last_synced_at":"2026-05-24T05:03:26.695Z","repository":{"id":38236917,"uuid":"309684963","full_name":"DanielGavin/ols","owner":"DanielGavin","description":"Language server for Odin","archived":false,"fork":false,"pushed_at":"2026-02-16T08:26:52.000Z","size":5116,"stargazers_count":884,"open_issues_count":95,"forks_count":132,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-02-16T20:49:21.382Z","etag":null,"topics":["language-server","lsp","odin"],"latest_commit_sha":null,"homepage":"","language":"Odin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielGavin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-03T12:50:03.000Z","updated_at":"2026-02-16T10:12:13.000Z","dependencies_parsed_at":"2023-10-27T11:26:32.307Z","dependency_job_id":"de76f9d6-035e-4a9d-bf33-1b13964f933d","html_url":"https://github.com/DanielGavin/ols","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/DanielGavin/ols","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielGavin%2Fols","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielGavin%2Fols/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielGavin%2Fols/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielGavin%2Fols/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielGavin","download_url":"https://codeload.github.com/DanielGavin/ols/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielGavin%2Fols/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29705523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-server","lsp","odin"],"created_at":"2025-10-20T21:46:42.227Z","updated_at":"2026-05-03T05:04:20.654Z","avatar_url":"https://github.com/DanielGavin.png","language":"Odin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ols\n\nLanguage server for Odin. This project is still in early development.\n\nNote: This project is made to be up to date with the master branch of Odin.\n\n\n\n## Table Of Contents\n\n-   [Installation](#installation)\n\t-   [Configuration](#Configuration)\n-   [Features](#features)\n-   [Clients](#clients)\n\t-   [Vs Code](#vs-code)\n\t-   [Sublime](#sublime)\n\t-   [Vim](#vim)\n\t-   [Neovim](#neovim)\n\t-   [Emacs](#emacs)\n\t-   [Helix](#helix)\n\t-   [Micro](#micro)\n\n## Installation\n\n```bash\ncd ols\n\n# for windows\n./build.bat\n# To install the odinfmt formatter\n./odinfmt.bat\n\n# for linux and macos\n./build.sh\n# To install the odinfmt formatter\n./odinfmt.sh\n```\n\nIn order for `ols` to find symbols for builtin types and procedures, the `builtin` folder in the repo needs to be located next to the `ols` binary. Alternatively you can specify the path to this folder using the `OLS_BUILTIN_FOLDER` environment variable.\n\n### Configuration\n\nIn order for the language server to index your files, it must know about your collections.\n\nTo do that you can either configure ols via an `ols.json` file (it should be located at the root of your workspace).\n\nOr you can provide the configuration via your editor of choice.\n\n\nExample of `ols.json`:\n\n```json\n{\n\t\"$schema\": \"https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json\",\n\t\"collections\": [\n\t\t{ \"name\": \"custom_collection\", \"path\": \"c:/path/to/collection\" }\n\t],\n\t\"enable_semantic_tokens\": false,\n\t\"enable_document_symbols\": true,\n\t\"enable_hover\": true,\n\t\"enable_snippets\": true,\n\t\"profile\": \"default\",\n\t\"profiles\": [\n\t\t{ \"name\": \"default\", \"checker_path\": [\"src\"], \"defines\": { \"ODIN_DEBUG\": \"false\" }},\n\t\t{ \"name\": \"linux_profile\", \"os\": \"linux\", \"checker_path\": [\"src/main.odin\"], \"defines\": { \"ODIN_DEBUG\": \"false\" }},\n\t\t{ \"name\": \"mac_profile\", \"os\": \"darwin\", \"arch\": \"arm64\", \"defines\": { \"ODIN_DEBUG\": \"false\" }},\n\t\t{ \"name\": \"windows_profile\", \"os\": \"windows\", \"checker_path\": [\"src\"], \"defines\": { \"ODIN_DEBUG\": \"false\" }}\n\t]\n}\n```\n\nOptions:\n\n- `enable_format`: Turns on formatting with `odinfmt`. _(Enabled by default)_\n\n- `enable_hover`: Enables hover feature. _(Enabled by default)_\n\n- `enable_document_symbols`: Turns on outline of all your global declarations in your document. _(Enabled by default)_\n\n- `enable_fake_methods`: Turn on fake methods completion. This is currently highly experimental.\n\n- `enable_overload_resolution`: Enable go-to-definition to resolve overloaded procedures from procedure groups based on call arguments.\n\n- `enable_references`: Turns on finding references for a symbol. _(Enabled by default)_\n\n- `enable_document_highlights`: Turns on highlighting of symbol references in file. _(Enabled by default)_\n\n- `enable_document_links`: Follow links when opening documentation. This is usually done via `\u003cctrl+click\u003e` and will open the documentation in a browser (or similar). _(Enabled by default)_\n\n- `enable_completion_matching`: Attempt to match types and pointers when passing arguments to procedures. _(Enabled by default)_\n\n- `enable_inlay_hints_params`: Turn on inlay hints for (non-default) parameters.\n\n- `enable_inlay_hints_default_params`: Turn on inlay hints for default parameters.\n\n- `enable_inlay_hints_implicit_return`: Turn on inlay hints for implicit return values.\n\n- `enable_semantic_tokens`: Turns on syntax highlighting.\n\n- `enable_snippets`: Turns on builtin snippets\n\n- `enable_procedure_snippet`: Use snippets when completing procedures—adds parenthesis after the name. _(Enabled by default)_\n\n- `enable_checker_only_saved`: Turns on only calling the checker on the package being saved. _(Enabled by default)_\n\n- `enable_checker_workspace_diagnostics`: Turns on running all workspace diagnostics using odin check. This is currently experimental and may cause problems. A better option is using the `checker_path` feature to explicity tell `ols` the projects that it should check. (experimental).\n\n- `enable_auto_import`: Automatically import packages that aren't in your import on completion.\n\n- `enable_comp_lit_signature_help`: Provide signature help for comp lits such as when instantiating structs. Will not display correctly on some editors such as vscode.\n\n- `enable_comp_lit_signature_help_use_docs`: Put signature help for comp lits in the documentation. This will allow it to be rendered nicely using markdown in editors that render the label without colour on one line.\n\n- `enable_code_action_invert_if`: Enables a code action to invert if statements.\n\n- `struct_fields_underscore_visibility`: Controls visibility of struct fields starting with `_`:\n  - `\"\"` (default): no hiding, all fields are visible\n  - `\"file\"`: hide fields when accessed from outside the declaring file \n  - `\"package\"`: hide fields when accessed from outside the declaring package\n\n- `odin_command`: Specify the location to your Odin executable, rather than relying on the environment path.\n\n- `odin_root_override`: Allows you to specify a custom `ODIN_ROOT` that `ols` will use to look for `odin` core libraries when implementing custom runtimes.\n\n- `checker_args`: Pass custom arguments to `odin check`.\n\n- `checker_skip_packages`: Paths to packages that should not be checked by `odin check` when using `enable_checker_workspace_diagnostics`.\n\n- `verbose`: Logs warnings instead of just errors.\n\n- `profile`: What profile to currently use.\n\n- `profiles`: List of different profiles that describe the environment ols is running under. This allows you to define different operating systems, architectures and defines for `ols` to use during development, easily switching between them using the `profile` configuration.\n\n### Odinfmt configurations\n\nOdinfmt reads configuration through `odinfmt.json`.\n\nExample:\n\n```json\n{\n\t\"$schema\": \"https://raw.githubusercontent.com/DanielGavin/ols/master/misc/odinfmt.schema.json\",\n\t\"character_width\": 80,\n\t\"tabs\": true,\n\t\"tabs_width\": 4\n}\n```\n\nOptions:\n\n- `character_width`: How many characters it takes before it line breaks it.\n\n- `spaces`: How many spaces is in one indentation.\n\n- `newline_limit`: The limit of newlines between statements and declarations.\n\n- `tabs`: Tabs or spaces.\n\n- `tabs_width`: How many characters one tab represents.\n\n- `convert_do`: Convert all do statements to brace blocks.\n\n- `brace_style`: Style of braces. One of `_1TBS`, `Allman`, `Stroustrup`, `K_And_R`.\n\n- `indent_cases`: Indent case statements within a switch.\n\n- `newline_style`: Line endings to use. One of `CRLF`, `LF`.\n\n- `sort_imports`: A boolean that defaults to true, which can be set to false to disable sorting imports.\n\n- `inline_single_stmt_case`: When statement in the clause contains one simple statement, it will inline the case and statement in one line.\n\n- `spaces_around_colons`: Put a space on both sides of a single colon during variable/field declaration, such as `foo : bar`\n\n- `space_single_line_blocks`: Put spaces around braces of single-line blocks: `{return 0}` =\u003e `{ return 0 }`\n\n- `align_struct_fields`: Align the types of struct fields so they all start at the same column.\n\n- `align_struct_values`: Align the values of struct fields when assigning a struct value to a variable so they all start at the same column.\n\n## Features\n\nSupport Language server features:\n\n-   Completion\n-   Go to definition\n-   Semantic tokens\n-   Document symbols\n-   Rename\n-   References\n-   Signature help\n-   Hover\n\n## Clients\n\n### VS Code\n\nInstall the extension https://marketplace.visualstudio.com/items?itemName=DanielGavin.ols\n\n### Sublime\n\nInstall the package https://github.com/sublimelsp/LSP\n\nConfiguration of the LSP:\n\n```jsonc\n{\n\t\"clients\": {\n\t\t\"odin\": {\n\t\t\t\"command\": [\n\t\t\t\t\"/path/to/ols\"\n\t\t\t],\n\t\t\t\"enabled\": false, // true for globally-enabled, but not required due to 'Enable In Project' command\n\t\t\t\"selector\": \"source.odin\",\n\t\t\t\"initializationOptions\": {\n\t\t\t\t\"collections\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"collection_a\",\n\t\t\t\t\t\t\"path\": \"/path/to/collection_a\"\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"enable_semantic_tokens\": true,\n\t\t\t\t\"enable_document_symbols\": true,\n\t\t\t\t\"enable_hover\": true,\n\t\t\t\t\"enable_snippets\": true,\n\t\t\t\t\"enable_format\": true,\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### Vim\n\nInstall [Coc](https://github.com/neoclide/coc.nvim).\n\nConfiguration of the LSP:\n\n```json\n{\n\t\"languageserver\": {\n\t\t\"odin\": {\n\t\t\t\"command\": \"ols\",\n\t\t\t\"filetypes\": [\"odin\"],\n\t\t\t\"rootPatterns\": [\"ols.json\"]\n\t\t}\n\t}\n}\n```\n\n### Neovim\n\nNeovim has a builtin support for LSP.\n\nThere is a plugin that makes the setup easier, called [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig). You can install it with your preferred package manager.\n\nA simple configuration that uses the default `ols` settings would be like this:\n\n```lua\nrequire'lspconfig'.ols.setup {}\n```\n\nAnd here is an example of a configuration with a couple of settings applied:\n\n```lua\nrequire'lspconfig'.ols.setup {\n\tinit_options = {\n\t\tchecker_args = \"-strict-style\",\n\t\tcollections = {\n\t\t\t{ name = \"shared\", path = vim.fn.expand('$HOME/odin-lib') }\n\t\t},\n\t},\n}\n```\n\n* use an explicit `cmd` for `ols` when using a custom build\n\nNeovim can run Odinfmt on save using the [conform](https://github.com/stevearc/conform.nvim) plugin. Here is a sample configuration using the [lazy.nvim](https://github.com/folke/lazy.nvim) package manager:\n\n```lua\nlocal M = {\n   \"stevearc/conform.nvim\",\n   opts = {\n      notify_on_error = false,\n      -- Odinfmt gets its configuration from odinfmt.json. It defaults\n      -- writing to stdout but needs to be told to read from stdin.\n      formatters = {\n         odinfmt = {\n            -- Change where to find the command if it isn't in your path.\n            command = \"odinfmt\",\n            args = { \"-stdin\" },\n            stdin = true,\n         },\n      },\n      -- and instruct conform to use odinfmt.\n      formatters_by_ft = {\n         odin = { \"odinfmt\" },\n      },\n   },\n}\nreturn M\n```\n\n#### LazyVim + Mason\n\nIf you use LazyVim with Mason, `cmd = { \"ols\" }` may resolve to Mason's shim instead of your custom `ols` binary. OLS already documents editor-provided configuration and `odin_command`, so when using a custom OLS build it is safer to disable Mason only for OLS and set explicit paths.\n\n```lua\nreturn {\n  {\n    \"neovim/nvim-lspconfig\",\n    opts = {\n      servers = {\n        ols = {\n          mason = false,\n          cmd = { \"/path/to/ols\" },\n          settings = {\n            odin_command = \"/path/to/odin\",\n          },\n        },\n      },\n    },\n  },\n}\n```\n\nNotes:\n\n* put `ols` inside `opts.servers`\n* keep Mason enabled for other language servers if you want\n### Emacs\n\nFor Emacs, there are two packages available for LSP; lsp-mode and eglot.\n\nThe latter is built-in, spec-compliant and favours built-in Emacs functionality and the former offers richer UI elements and automatic installation for some of the servers.\n\nIn either case, you'll also need an associated major mode.\n\nPick either of the below, the former is likely to be more stable but the latter will allow you to take advantage of tree-sitter and other packages that integrate with it.\n\nThe `use-package` statements below assume you're using a package manager like Straight or Elpaca and as such should be taken as references rather than guaranteed copy/pasteable. If you're using `package.el` or another package manager then you'll have to look into instructions for that yourself.\n\n```elisp\n;; Enable odin-mode and configure OLS as the language server\n(use-package odin-mode\n  :ensure (:host github :repo \"mattt-b/odin-mode\")\n  :mode (\"\\\\.odin\\\\'\" . odin-mode))\n\n;; Or use the WIP tree-sitter mode\n(use-package odin-ts-mode\n  :ensure (:host github :repo \"Sampie159/odin-ts-mode\")\n  :mode (\"\\\\.odin\\\\'\" . odin-ts-mode))\n```\n\nIf you are using Emacs 29 or above you can use `package-vc-install`.\n\n```elisp\n(package-vc-install\n '(odin-mode :url \"https://github.com/mattt-b/odin-mode.git\"))\n\n(package-vc-install\n '(odin-ts-mode :url \"https://github.com/Sampie159/odin-ts-mode.git\"))\n```\n\nAnd then choose either the built-in `eglot` or `lsp-mode` packages below. Both should work very similarly.\n\n#### lsp-mode\n\nAs of lsp-mode pull request [4818](https://github.com/emacs-lsp/lsp-mode/pull/4818) ols is included as a pre-configured client. You will need to install lsp-mode from source until version 9.1 has been released. Just `M-x lsp-install-server` and select ols. This will download and install the latest version of ols from the releases. Then start lsp-mode with `M-x lsp` or add hook on the below package\n\n```elisp\n;; Pull the lsp-mode package from elpa\n(use-package lsp-mode\n  :commands (lsp lsp-deferred))\n\n;; OR Pull lsp-mode from source using Straight this snippet has the install instructions for installing straight.el\n(defvar straight-use-package-by-default t)\n(defvar straight-recipes-repo-clone-depth 1)\n(defvar straight-enable-github-repos t)\n(defvar bootstrap-version)\n(let ((bootstrap-file\n       (expand-file-name\n        \"straight/repos/straight.el/bootstrap.el\"\n        (or (bound-and-true-p straight-base-dir)\n            user-emacs-directory)))\n      (bootstrap-version 7))\n  (unless (file-exists-p bootstrap-file)\n    (with-current-buffer\n        (url-retrieve-synchronously\n         \"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el\"\n         'silent 'inhibit-cookies)\n      (goto-char (point-max))\n      (eval-print-last-sexp)))\n  (load bootstrap-file nil 'nomessage))\n\n;; Configure straight.el\n(straight-use-package 'use-package)\n\n(use-package lsp-mode\n  :straight (lsp-mode :host github :repo \"emacs-lsp/lsp-mode\")\n  :commands (lsp lsp-deferred))\n\n;; Add a hook to autostart OLS\n(add-hook 'odin-mode-hook #'lsp-deferred)\n(add-hook 'odin-ts-mode-hook #'lsp-deferred) ;; If you're using the TS mode\n```\n\n#### eglot\n\n```elisp\n;; Add OLS to the list of available programs\n;; NOTE: As of Emacs 30, this is not needed.\n(with-eval-after-load 'eglot\n  (add-to-list 'eglot-server-programs '((odin-mode odin-ts-mode) . (\"ols\"))))\n\n;; Add a hook to autostart OLS\n(add-hook 'odin-mode-hook #'eglot-ensure)\n(add-hook 'odin-ts-mode-hook #'eglot-ensure) ;; If you're using the TS mode\n```\n\n### Helix\n\nHelix supports Odin and OLS by default. It is already enabled in the [default languages.toml](https://github.com/helix-editor/helix/blob/master/languages.toml). \n\nIf `ols` or `odinfmt` are not on your PATH environment variable, you can enable them like this:\n```toml\n# Optional. The default configration requires OLS in PATH env. variable. If not,\n# you can set path to the executable like so:\n# [language-server.ols]\n# command = \"path/to/executable\"\n```\n\n### Micro\n\nInstall the [LSP plugin](https://github.com/AndCake/micro-plugin-lsp)\n\nConfigure the plugin in micro's settings.json:\n\n```json\n{\n\t\"lsp.server\": \"c=clangd,go=gopls,odin=ols\"\n}\n```\n### Kate\n\nFirst, make sure you have the LSP plugin enabled. Then, you can find LSP settings for Kate in Settings -\u003e Configure Kate -\u003e LSP Client -\u003e User Server Settings.\n\nYou may have to set the folders for your Odin home path directly, like in the following example:\n```jsonc\n{\n    \"servers\": {\n        \"odin\": {\n            \"command\": [\n                \"ols\"\n            ],\n            \"filetypes\": [\n                \"odin\"\n            ],\n            \"url\": \"https://github.com/DanielGavin/ols\",\n            \"root\": \"%{Project:NativePath}\",\n            \"highlightingModeRegex\": \"^Odin$\",\n            \"initializationOptions\": {\n                \"collections\": [\n                    {\n                        \"name\": \"core\",\n                        \"path\": \"/path/to/Odin/core\"\n                    },\n                    {\n                        \"name\": \"vendor\",\n                        \"path\": \"/path/to/Odin/vendor\"\n                    },\n                    {\n                        \"name\": \"shared\",\n                        \"path\": \"/path/to/Odin/shared\"\n                    },\n                    {\n                        \"name\": \"src\", // If your project has src-collection in root folder, \n                        \"path\": \"src\"  // this will add it as a collection\n                    },\n                    {\n                        \"name\": \"collection_a\",\n                        \"path\": \"/path/to/collection_a\"\n                    }\n                ],\n                \"odin_command\": \"path/to/Odin\",\n                \"verbose\": true,\n                \"enable_document_symbols\": true,\n                \"enable_hover\": true\n            }\n        }\n    }\n}\n```\nKate can infer inlay hints on its own when enabled in LSP settings, so enabling it separately in the server config\ncan cause some weird behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgavin%2Fols","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielgavin%2Fols","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielgavin%2Fols/lists"}