I have worked through the first two sessions today and I must say: I love these videos.
Having a knowledgable and measured host is lovely, having that host be exceedingly likable and considerate is divine.
I’ve been trudging through the Programming Crystal book these past few days, though stumbling upon these videos has accelerated the progress of my learning in a most appealing manner.
Contextual autocompletion is provided by VS directly - nothing too fancy.
If you are looking for more advanced autocompletion / go-to-definition type of features, then you’ll have to install scry and have the VS Crystal plugin point to it’s executable.
I’m currently experimenting with the VS plugin + scry integration. It works fairly well with the standard library, but can get a bit confused with your application’s code, in my experience.
Hi @lbarasti I’m happy you are enjoying VSCode , this extension still requires a lot of work, although, scry can be a way to get more features and fix some issues. We still need to figure out a better way to detach crystal tools from compiler itself and use them inside scry via Language Server Protocol
@faustinoaq I was planning to extract parser info as a JSON. I was planning to modify ToSVisitor to make it as toJsonVisitor, so we can dump parser info as JSON. You can perfectly access Crystal parser classes from your cade as in this example:
require "compiler/crystal/syntax"
module Crast
VERSION = "0.1.0"
source = File.read(ARGV[0]).strip
ast = Crystal::Parser.parse(source);
pp ast
end
so if I can properly implement JSON AST dumper and cache it somewhere (and invalidate cache if that file was modified) it will help tremendously.
@lbarasti Can you please share more about linking the plugin to scry?
I’m using VSC with the plugin as well.
I put the scry executable in “/usr/local/bin” on macOS Catalina, so the path I’ve entered in the plugin’s settings is “/usr/local/bin/scry”.
Scry successfully starts up, but then generates a folder structure like “Users/zolo/.cache/…” in project the working directory instead of creating its files in the actual Users/zolo/.cache/… folder on my machine. After that, it promptly throws a “File too long” error.