ericglau / cairo-ls

Cairo Language Server

Home Page:https://marketplace.visualstudio.com/items?itemName=ericglau.cairo-ls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to set cairo-ls settings in Helix IDE

Eikix opened this issue · comments

Hey:)!

I've been trying to set up cairo-ls in Helix. Opened a PR for getting the lsp up and running on Helix: #46.
Nonetheless, it appears I can't pass the settings to my config.

I try to pass in sourceDir, venvCommand, etc. For some reason, the LSP does not recognize them. Would you have an idea for how to set these settings in other environments as VSCode?

Sorry for the late response. From the thread above, it looks like some settings are being passed through to the language server, but you have additional source files in certain folders that are not recognized during compilation. Is that correct?

The language server also has a cairoPath setting that takes an array of strings representing additional locations to search for cairo files.

Can you try something like this?

config = { <the other settings that you currently have>, cairoPath = [ "your additional path" ] }

Hi:)!

I tried this:

[[language]]
config = { cairoPath = [
  "/Users/eliastazartes/code/theodo/kakarot/src",
  "/Users/eliastazartes/code/theodo/kakarot",
  "/Users/eliastazartes/code/theodo/kakarot/tests",
"tests",
"lib"
], sourceDir = "src", venvCommand = "source ~/cairo_venv/bin/activate", nileUseVenv = false, useVenv = true, nileVenvCommand = "source ~/cairo_venv/bin/activate" }
name = "cairo"
scope = "source.cairo"
injection-regex = "cairo"
file-types = ["cairo"]
indent = { tab-width = 2, unit = "  " }
comment-token = "#"
language-server = { command = "cairols.sh" }

And it does not work:
image

But it appears the language server can't read this config somehow.
I'm trying to pass the arguments in my bash script, but it still does not work.

node ~/code/lsp/node_modules/cairo-ls/out/server.js --stdio --sourceDir="src" --venvCommand="source ~/cairo_venv/bin/activate" --nileUseVenv=false --useVenv=true --nileVenvCommand="" --cairoPath="['/Users/eliastazartes/code/theodo/kakarot/src', '/Users/eliastazartes/code/theodo/kakarot','/Users/eliastazartes/code/theodo/kakarot/tests']"

I couldn't get the config working either. Will need to look into it further.

If you really need it for now, you could just edit the defaults in the source code and then build it by following https://github.com/ericglau/cairo-ls/blob/main/CONTRIBUTING.md -- only need the first 3 steps:

Run npm install in this folder (main repo). This installs all necessary npm modules in both the client and server folder
Open VS Code on this folder (main repo).
Press Ctrl+Shift+B (Command+Shift+B on Mac) to compile the client and server.

then you can find server/out/server.js and edit your cairols.sh to point to that.