The Crystal Programming Language Forum

Maintenance of vscode plugin

As probably many vscode users, I use faustinoaq.crystal-lang. The source code is located at https://github.com/crystal-lang-tools/vscode-crystal-lang .

There are collaborators on that project and organization that had already accepted PR and tagged releases. Yet those were not published at faustinoaq.crystal-lang.

I think it would be important to have an organization vscode publisher that can be shared among maintainers of the repo (and probably automate some aspects). I’ve already reserved the crystal-lang-tools publisher name in https://marketplace.visualstudio.com/.

The work done by faustino and others has been great, since I switched to vscode I’ve been using this plugin. I would not like for it to become unmaintained.

Although I am owner of the github organization, I have not been actively involved in it. I’ve tried to reach faustino by email to organize future efforts to accomplish this.

cc: @Acciaiodigitale @faustinoaq

15 Likes

Faustino says to me that have problem accessing the marketplace account so he cannot add me for releasing new version of the plugin. IMHO the better thing to do, is to fork and create a repository at least for vscode that is mantained by the core organization (like VSCode for Go or Sublime Text for Elixir).

If you can send me your’s and faustino emails of the marketplace I can add you to the crystal-lang-tools publisher.

Is there a channel where vscode plugin conversation happens?

Why do you think is best to fork the source code repo instead of migrating to an orrganization publisher using the same repo?

acciaiodigitale [at] gmail [com] is mine
IDK Faustino email

Also please put me again in crystal-lang-tools (I leave when I see I cannot do all is needed but this change all)

If someone of the core team is in the organization is good to leave the repos under the organization and having an organization publisher.

Today I finally created the crystal-lang-tools updated version of the Crystal Language plugin for VSCode.

The version is v0.5.0 to give continuity to the work of @faustinoaq.

Anyone that want to help with this (or other editors plugins) is more than welcome!!

My next step are a template for submitting issue and close all too old issue and seeing what remain to start working on assuring no big issue are present.
After that I prepare a new test suite and move CI/CD to Github Actions for release a v.1.0.0 at the same time of Crystal Language

Thank you so much for working on this! I’m excited to see proper scry support, mine crashes ALOT, so I just turned it off. Let me know if you need a tester, I have crystal installed on WSL, Ubuntu, and I remote from my Windows machine to my Ubuntu through VSCode’s remote SSH feature, so there’s a lot of ground to cover for potentially bugs between the three options.

Can you please try the new 0.6.1 and eventually Crystalline instead of Scry

Can the other extension be removed? It has the most downloads so it shows up first.

I’m pretty sure the extension is great!

That said, how can I use it? I just installed the extension, I have crystalline in the path (do I have to manually run it?). I used crystal init to create an app called crystal_test. I put this into src/crystal_test.cr:

class Foo
  def foo
    1
  end
end

f = Foo.new
f.

I hit ctrl+space to trigger autocompletion but I only get completions for the words that appear in the file, unrelated to the plugin. I also tried with arrays and some other types.

Am I missing some configuration? Is there an activity log I can see to debug the plugin?

Hey @asterite, thanks for trying it out :smile:!

No need to run it manually, it should be monitored by the VSCode extension after adding the absolute path of the binary to the Server option in the configuration (and restart the editor). There is a screenshot of the configuration option which may be more clear to follow here.

Personally I use the workspace configuration, which creates a .vscode/settings.json file containing:

{
  "crystal-lang.server": "/my/path/to/crystalline"
}

For instance with your example after configuring the plugin I get this (ignore the orange warning, it comes from ameba):

Yes there are (INFO level by default - debug is very noisy), you can acess them by pressing CMD+SHIFT+P then type “dev logs”.

Also keep in mind that this is a work in progress, I’m committing on a daily basis to improve several aspects of the program.

Oh, wow, after specifying the path and restarting it’s working great! Congrats! :clap:

When I specify a method with type restrictions, when it’s not called then I don’t get autocompletion for the argument. For example if I have an argument arg : String then I don’t get autocompletion. Let me know if you’d like to work together on making this work.

What I mean with the above is, when triggering a completion inside a method, we can check if the method args are fully typed. If that’s the case we can simulate a call to that method with those types to get semantic information. Then go-to-definition and autocompletion should work, and it should also be relatively fast to do.

Of course it won’t work if some args are not typed, but maybe it’s good because people will feel inclined to type their methods :-)

Or, with an untyped argument we could introduce a new type in the compiler (or, well, the compiler used in the server) that means “untyped”. Any method called on an untyped method succeeds and returns “untyped”. But searching a method on a know type with an untyped argument could actually match all methods with that name, and succeed. That way if calling a method like string.gsub(untyped, untyped) we would know for sure that the return type is String, even though we don’t know the argument types.

Anyway… just some ideas to make the plugin work even better.

I’m really impressed by how it works right now.

No need to reply, though. If I have time I’ll try to make it work first and see if I can send a PR.

1 Like

Thanks a bunch, that means a lot :smile:!

These are great ideas!

I was also thinking about a permissive parser that would produce a partial AST instead of raising (because right now a single syntax error will stop the world).

Yeah, I saw that “permissive” flag in the code but I’m not sure I understand how it’s currently used.

I think the way other IDEs work is, you create a parser that could produce incomplete/broken ASTs, but you also tell it the line and column where the cursor are at. That way when the parser reaches that point it knows “okay, here comes the broken part” and handles that.

With languages like Ruby and Crystal I feel this is needed because a newline after a dot is valid but it might also be the case that the expression is incomplete. For example:

foo.|
x = 1

(the | is the cursor)

The parser could say “I know the cursor is right after the dot so I’m doing to end the expression right here, assuming it’s a call without a method name”, instead of parsing that as “foo.x = 1” (which is valid, but probably not the expected AST if autocompletion is asked at that point).