The Crystal Programming Language Forum

Autocomplete

I’d love Crystal, but I’m super discouraged the state and handling of tooling.

None of the VSC plugins - Crystal Language, Crystal IDE, Crystal - seem to be working (at all, for anyone) even after configuring them with scry, which also has its own problems. Neither are they maintained.

It’s somewhat understandable, since it’s an OS project, but none of this is mentioned anywhere and neither is it apparent on account of the gifs showing autocomplete working fine. So it wasted days of my - and I imagine many others’ - time.

Please at least mention this on the main page, but more importantly, if any of the plugin authors read this - please don’t mislead people.

I believe everyone has the best intentions, but it takes 2 minutes to update the README and without that, literally the only thing that happens is that you’ve wasted an incredible amount of people’s time (especially if you add together the amount of hours of individual people).

A negative of open source. Projects may become stale and developers can’t maintain them.

Best bet for this case is, be the open beta for those projects and report the issues on their repo. That’s what I’ve been doing on Github for over half a decade.

@faustinoaq might be able to help on what’s going on with the the VSC plugin

I personally think there should be a dedicated IDE/editor for Crystal. Similar to how ZeroBraneStudio is for Love2D/Lua. That is officially supported and cross-platform

Thanks @girng!

Hmm, making a (good) IDE seems like an art in and of itself and requires a lot of thought and resources. I would be wary of the result if the Crystal team undertook such a big task.

Why do you think a stand-alone IDE would be beneficial?

In the case of Crystal, making a good IDE is a bit impossible.

I wouldn’t want that anyway, but @girng would like to see it happen.

If you are asking for autocomplete, you are not going to find it in Crystal. Not soon, and probably never. But I might be wrong, of course.

:open_mouth:
Why do you think that? We may be talking about different things. I was referring to the autocomplete syntax popups like in the gif here and the same for methods on classes. Apparently, it’s been working before.

It seems to be the first item on the Scry roadmap.

I’ve said it a thousand times by now, but Crystal doesn’t know how a method works

I wasn’t here for the other 999, so no need to hold that against me.

Tooling is 50% of the development experience, so I think this would be pretty important to mention on the main site. That way, people have realistic expectations and don’t invest a lot of time before they realise something like that is not only missing, but is unlikely to happen. (Especially, since Crystal is trying to be very developer friendly.) You also won’t have to explain it so many times again.

Anyway, I do appreciate the explanation.

Got it, thanks!

Once you learn Ruby you know what methods you have in array, hash, etc

Hmm. I may be a dummy, but even to this day I use the autocomplete to help me after nearly 10 years of iOS development. iOS has like a hundred first-party libs and autocomplete helps a ton. Both in terms of productivity, but most importantly in terms of discoverability. If I forget what method Array is using to divvy up its content, I can write .slice or .splice or .split and quickly find what I’m looking for. That’s especially useful, because I use a bunch of different languages and they all use different method names for these things.

Plus, being able to write 'Fiber.' and the IDE showing me the options is such a reassuring experience. That, coupled with the compiler running and checking constantly means that I write correct code from line to line and I’m not greeted with a pile of errors when I hit run.

Nobody in the core team or in the Crystal organization is working on these tools.

Yeah, I know that. This still seemed like the best place to ask, because those tools have not been updated in years and I wasn’t sure if anyone would respond. I was hoping the forum was frequented more. Plus, I think this is still worth mentioning on the Crystal main page, especially if it’s a technical limitation. I think people coming from statically typed languages expect autocomplete and need to know this.

I’m not sure what kind of problems you’re experiencing. But the Crystal Language extension with VS Code works fine for me.

@straight-shoota
Thanks for the heads up!
I’d love to know what I need to do to make it work!

Attempt 1
So I enable the Crystal Language plugin, reload VSC and try the first example in the GIF on the plugin’s GitHub page, namely:

items = [] of Int32

I get no autocomplete, hint or anything.

Attempt 2
I clone and build scry from source, then copy the scry executable to my project folder. At this point the project folder only contains two files, a testproject.cr file and the scry executable. No folder structure.

I go to the plugin’s settings page and set the Crystal-lang: Server setting to
/Users/zolo/Desktop/testproject/scry, then reload VSC.

Upon returning, after selecting testproject.cr, scry seems to fire up, but fails with this error. (It tries to generate some cache files, but fails due to a path issue)

Is there anything in this that stands out to you that could be the problem?
Can you share your project config and how it is set up? Maybe that’s the issue for me.
Do I need to set the Crystal-lang: Compiler setting in the plugin?


macOS 10.15.3
VSC: 1.47.3
Crystal 0.35.1 (2020-06-19)
LLVM: 10.0.0
Default target: x86_64-apple-macosx