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.
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).
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.
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?
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:
Oh, wow, after specifying the path and restarting it’s working great! Congrats!
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.
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).
It seems when using %Q[] with string interpolation it breaks the syntax highlighting pretty bad. I know this is probably a challenge because there are quite a few kinds of delimiters that can be used with this style of string creation, as well as having to deal with the interpolation, hence the bounty.
I’m currently on 0.4.0 version of the extension on Crystal 0.35.1.
It seems that matches against free variables in macros (stuff like %foo) but it conflicts with the string syntax that also starts with %Q. So here I exclude those specific patterns from matching the “free variable” rule.
@asterite Dang and here I thought it would take some time because there was a similar bug on the issues unsolved for months. Looks good, verified and tested.