DanielGavin / ols

Language server for Odin
MIT License
382 stars 58 forks source link

On save server exits in Helix editor #311

Closed mitjafelicijan closed 1 week ago

mitjafelicijan commented 4 months ago

I have installed ols and when I start editing a file (which compiles and works properly) the server crashes and I get a notification in the editor Language server exited.

Below are the logs from Helix editor.

46918  -02-20T11:58:35.204 helix_lsp::transport [ERROR] ols err <- "/home/runner/work/ols/ols/src/server/requests.odin(1175:59) Index 0 is out of range 0..<0\n"
1  -02-20T11:58:35.347 helix_lsp::transport [ERROR] ols err: <- StreamClosed

I am using Fedora 39.

Is there anything else I paste here?

Thanks

DanielGavin commented 4 months ago

It looks like you need ols.json in your project. Helix doesn't make a project workspace without it. That apparently causes the server to crash.

mitjafelicijan commented 4 months ago

That worked like a charm. Thank you.

LSP formatting works. Also works if there are errors in the code. I also get snippet recommendations. But I am not getting autocomplete suggestion when I type let's say fmt..

Am I still missing something?

This is my ols.json I have in the project.

{
  "collections": [
    {
      "name": "core",
      "path": "~/Applications/odin/core"
    },
    {
      "name": "vendor",
      "path": "~/Applications/odin/vendor"
    }
  ],
  "thread_pool_count": 4,
  "enable_semantic_tokens": false,
  "enable_document_symbols": true,
  "enable_hover": true,
  "enable_format": true,
  "enable_snippets": true,
  "formatter": {
    "tabs": false,
    "characters": 90
  }
}
DanielGavin commented 4 months ago

There seems to be a bug in ~. Try with absolute path. You can potentially also remove the collections, if the odin is in path, it should be able to find them without collections.