-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declaration files from Rhai engine metadata #35
Comments
That would require serializing to JSON and back internally. I can probably just make a function that outputs |
However, many developers will register different function and structure types in their own engines, which requires recompiling |
True. The LSP can take such JSON export and get list of all registered functions. |
This sounds perfect, much better than my original idea of embedding the LSP. As far as I see, it should be trivial to generate declaration files from the given metadata, which the LSP already understands. I'm not yet familiar with the internals, how much effort would it be to include doc comments in this metadata as well? Also initially I didn't want to touch the engine itself, but it will be inevitable if we want to get the best experience out of the LSP. |
It would require the |
Yes, we don't need to parse the document as the data source, because Metadata already has enough information to provide to the LSP. |
Come to think of it... Rhai automatically extracts doc-comments that are put on top of plugin functions into the JSON metadata. This means that it is possible for the LSP to pick up the comments and potentially display it to the user as popup info. Right now there are no doc-comments for the Rhai standard library, but maybe I should start adding them! |
Great, that's very convenient then. To sum this up a bit, we might need or have:
No need to hurry. I still have exams, and a project deadline on 24th, I can only continue work on the LSP after. |
Script-defined function parameters are always
You still get a signature with parameter types, but not the actual name of the parameters. So the signature will be something like |
Dear all, if you'd pull from the latest dev repo, you'll find that |
When do we expect the feature to load metadata files? With this, all the errors will go away and the LSP is actually usable! BTW, there are a number of "standard" functions that should be automatically recognized because they are built-in. They are counted as reserved keywords:
|
I'll work on this after I fixed the current bugs :)
Are these included in any of the generated metadata? If not, definition files will have to be hand-written. |
Unfortunately no... But I can write them for you. It is better to have free-form docs for these, as they can be special. For example, the |
We can use
engine.gen_fn_metadata_to_json
, generate the function and data type structure, and importlsp
as the function and structure type registered by the extension developer.json::
,automatically completeload
ordump
.The text was updated successfully, but these errors were encountered: