Rewrite of API Generation#23
Conversation
| [AttributeUsage(AttributeTargets.Method)] | ||
| public class NvimFunctionAttribute : Attribute { | ||
| public string? Name { get; set; } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Set your editor or whatever to ensure all files end with a newline.
There was a problem hiding this comment.
Ok. Is there any specific reason to do so?
| } | ||
| List<ArgumentConverter> argumentConverters = []; | ||
| if (evalParameterIndices.Count is not 0) { | ||
| argumentConverters.Add( |
There was a problem hiding this comment.
did you increase the indent to 4 spaces? it will help a lot to keep the 2-space indent. otherwise there is a huge amount of churn and it is harder to review. also, we generally just prefer 2 space indent.
There was a problem hiding this comment.
Ok. I will update all the .editorconfigs
No one is likely to pull down this PR and debug it. If you have a specific question we can try to answer it. Also, the amount of changes here makes it very hard to review. Is there any way to do this in smaller stages |
|
I had this in mind when making soooo many changes. And that's ok. I will guide you through all the points one by one. By also comparing the work of the current The general idea is that the
Then the doxygen xml is converted into C# xml tags. Similarly the api definitions into C# an NvimAPI partial class along with supported definitions. Please see the diagram bellow. flowchart TB
exe["nvim"]
xml
gen[NvimClient.APIGenerator]
gen2[NvimClient.APIGenerator]
mem["In Memory"]
gen -- Calls Nvim Exe --> exe -- Parse and Store--> mem
gen -- Calls Doxygen --> doxygen -- Uses nvim src --> xml -- Parses XML And Stores--> mem
mem --> gen2
gen2 -- Generates --> cssrc["NvimAPI.Generated.cs"]
gen2 -- Generates --> Types[".cs Nvim Types"]
gen2 -- Generates --> Events[".cs Nvim EventArgs Files"]
I will get back with additional information. |
|
So when I generate the api I get the following output: Let's make some comments and start the basic questions: Some functions receive |
|
This is currently reimplementing too much of what Roslyn already gives us. The generator now has its own hand-rolled C# syntax model: I’d strongly prefer the generator keep the Neovim-specific parts: That would remove a lot of fragile string-based code and let the compiler APIs own the C# syntax layer. It also allows us to have multiple emitter targets instead of a C# lock-in, as you'll be building an actual AST that's verifiable. |
I do not think this claim is supported by the diff. I cannot see where this PR meaningfully removes functional code. In places, it appears to do the opposite: the new generator relies heavily on mapping/transformation code over immutable-ish models. That is fine, but it directly undermines the stated rationale. The broader premise is also wrong. Functional code is not inherently unfamiliar or unmaintainable to C# developers. C# is multi-paradigm. LINQ, records, pattern matching, expression-bodied members, fluent APIs, result-style flows, and pure transformations are all mainstream C#. The added complexity from this bespoke C# emitter is not a maintainability improvement. It is a large increase in project surface area and review burden. I would strongly prefer this not be merged in its current form. If there are specific functional patterns in the existing codebase that are causing problems, they should be raised directly and addressed in small, focused PRs. |
Interesting. Thanks for raising that. Definitely would like to lean on .NET as much as possible to avoid extra code |
This pull request is a general maintenance of the project revolving around the following directions:
.editorconfigstyle.This is WIP and not yet ready for introduction to the
masterbranch. That is why I have adevelopbranch in place. The scope of the PR is to receive some honest feedback regarding the project.At the moment the generated code does not compile. This is due to incorrect type mappings between lua and C# types. due to my inexperience with neovim source code. Thus feedback is required by anyone who would like to help.