Preferred IDE?

What does a typical Crystal ide setup look like?

I got crystal installed on macos from brew, and have vscode plugin installed, but I can’t do something as standard as “go to definition”

Is this just the state of things right now?

2 Likes

I use vsc with the Crystal extension, and it can be paired up with crystal-ameba which will lint your code. The vsc code extension for Crystal has received a lot of work and improvements, they are working on a new release as you can see here: New release? · Issue #174 · crystal-lang-tools/vscode-crystal-lang (github.com)

3 Likes

I just use Sublime text with the Crystal plugin. No LSP or anything but provides highlighting and formats on save. I think it’s also somewhat smart and provides autocompletion based on matches of previously used words. Can also sometimes hover over methods and stuff and can click to go to its definition, but not 100% on what determines if that works or not.

4 Likes

Thanks I’ll try seeing if that new release works. I see it does mention goto definition in the notes.

When learning a new language its super useful to go to definition on the standard libs.

Could also consider keeping a tap open to Crystal 1.9.2, then can use that when you need info on a particular type/method.

I use Emacs, no LSP or anything, just syntax highlighting and some basic completion based on “I typed this before in one of the open buffers”. I absolutely love it this way, for both Crystal and other languages. Then I tab over to a terminal and run crystal/shards/make/rake myself.

I use vim, syntax highlighting, at one point I had LSP kind of working, but it’s currently broken, and I have not suffered enough to try to fix it.

For those additional features you’ll probably have to set a “mainFile” in your VS Code workspace settings, just an FYI. There are also features you can enable in the settings for the extensions but some people ran into memory issues using them.

I use Neovim with the LSP running, but I just use it as an addition when it makes sense, otherwise I treat it as no LSP. And I use the Crystal vim plugin for formatting on demand.

Me too.

1 Like

I want to say, this probably the easiest way to get the document for now.

@vvilliamperez

You don’t want to use LSP plugins for this purpose, AFAIK, no core member interested in working on this, but it almost impossible to get a go/rust LSP experience if not touch the language itself.

Check this inactive issue, a year ago, it was almost the only hope of the LSP, but soon, it lose activity again.

You should accept Crystal no LSP support for a long time anyway.

Well, it’s 2023, and my PHP language server can’t either. I use ripgrep a lot.

I’ve installed a extension to https://devdocs.io/ in Emacs, so that takes care of the core stuff.

I use vscodium, a vscode clone without the telemetry

1 Like