Giter Club home page Giter Club logo

Comments (11)

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

I have a branch that works quite well. It's interfacing with Helix perfectly (and REALLY fast compared to the old cairo-format from cairo-lang).

It needs some cleanup but I can polish it up and submit the PR once this issue is approved.

from cairo.

spapinistarkware avatar spapinistarkware commented on June 3, 2024

Sounds legit, would love to get a PR.
And also tips on how to integrate with Helix :)

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

Sure will submit the PR soon. For Helix integration, I simply added this to my languages.toml (located at ~/.config/helix/languages.toml):

[[language]]
name = "cairo"
formatter = { command = "formatter_cli" , args = ["-"] }

It really is ⚡ blazing ⚡ fast ⚡ lol.

This works because Helix simply sends the entire buffer to the formatter command via stdin.

from cairo.

spapinistarkware avatar spapinistarkware commented on June 3, 2024

Can it integrate with langserver?

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

Oh Helix has native support for LSP and it supports formatting through the LSP as long as the server supports it.

Though somehow I haven't successfully used the Cairo LSP for really anything at all, but I'll investigate on that front a bit and submit a separate issue.

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

I have a branch ready now, but I'm wondering how we should deal with the formatter CI issue. Should I just add an .cairofmtignore to crates/parser/test_data/cairo_files/ to just exclude everything there?

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

Btw the formatter code was pretty tightly coupled with the file system, so I had to do some refactoring here and there or else I would have a lot of code duplications. I ended up almost rewriting the whole cli.rs file... I hope you don't mind.

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

Update on the LSP issue: I'm trying the language server again with the current main head and it seems to work for me this time. Hover and going to definition work just fine. Not sure what I got wrong last time so I guess we're good.

However, formatting through the LSP doesn't seem to work. From Helix logs I can clearly see the response for the textDocument/formatting request, but the editor doesn't seem to do anything about it. Helix works fine with formatting through LSP for other languages like rust-analyzer, so I doubt there's something wrong with the Cairo LSP implementation. Will dig deeper and submit the issue.

Note that making formatting work through LSP doesn't supersede this issue.

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

For the follow-up on the LSP formatting issue: #1141

from cairo.

spapinistarkware avatar spapinistarkware commented on June 3, 2024

Do you get semantic higlighting?

from cairo.

xJonathanLEI avatar xJonathanLEI commented on June 3, 2024

@spapinistarkware Helix seems to rely solely on treesitter for syntax highlighting so I can't tell. I haven't tried using the Cairo LSP with neovim tho.

from cairo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.