-
Notifications
You must be signed in to change notification settings - Fork 22
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
More flexible design for generator #14
Comments
Looks much better than just concatenating strings :)
But I was wondering if you need your simplified model at all. I think you can run your transformers on Roslyn Syntax Tree directly. Just structure it better than before :) |
The current design certainly leaves a lot to be desired, and was thrown together as a proof of concept to gauge whether or not others would be interested in this project. It appears they are, so I agree we should rethink the design. I think it's a good idea to use a simplified model instead of running the transformers on Roslyn's syntax tree. One of my long term goals for this project is to support languages beyond C# and VB .Net. If we can define a simple model, then the only language-dependent functionality would be the creation of this model. We could use the HTML and search transformers on any model, regardless of the underlying language. |
Thank you for your inputs @MarcinJuraszek and @JoshVarty
ParentPath(Edit): Parent(Edit): |
@JoshVarty Right, I forgot about that. Simplified model is definitely better if you're planning to get support for languages beyond Roslyn project. @yannisgu I link the Parent approach. It seems to be much more flexible. However, I don't like the name. `IFileSystemObject' suggests it's file system related structure. When actually it's Solution/Project-only relationship. For aspx and aspx.cs files there is no File System structure, they both live in the same folder. VS shows the relationship because it's aware of it. Also, if you're planning on moving forward with other languages, you should remember that for some languages (e.g. F#) order of files/folders in project/solution is important. Adding it to the model now seems like a good idea. |
I just can't find a good name 😞 IProjectObject, but not every language has a project system? Or IItem seems a bit too general? Anyone have a good name? To handle order we probably need a property Childern |
What sort of relationship are you trying to establish between aspx and aspx.cs files with the same name? |
@yannisgu & @MarcinJuraszek I agree with the high level design. It will take advantages of single responsibility principle. The various transformers may execute asynchronously if HTML transformer finished and directs the web user to the html site for the project. It will be huge for testability. @JoshVarty I think Document <-> Document, because these two files are logically connected. Similarly, .cs, .xaml.cs, and underlying .g.cs are partial classes that live in documents that have a relationship. I think that it is in scope of Document to handle logical connection, while proposed IToBeDetermined would handle physical location. Toughts? |
You're right. Now that I think about it, the relationship would need to be established if we were to properly display the files in the treeview. (That is display the backing .cs and .g.cs. files as children of their corresponding document the same way Visual Studio's Solution Explorer does) |
I like option a. |
@yannisgu I prefer approach A. One final note: TokenLink should probably be renamed to SymbolLink as we're not actually linking to a single token. |
Ok so go for IProjectItem. @AmadeusW hmm don't get that.. In which situation the version with which you created the model don't match the version in which you are consuming it? |
@yannisgu ah, is the model a transient structure that exists solely for a short period of time between user selects a github repo and we finish processing it? |
Yep, that's what I thought. So, how to proceed here? This change will probably break everything, so maybe all PRs should be closed first? |
Based off the design discussed in #14
After implementing the inital design, I think only one question remains. How should the SymbolLink (formerly TokenLink) represent the referenced type? If we use fully qualified name, the HTML transformer will need to know where every type is defined (ie. the document and line number, so it can build the correct link).This seems like something that would be beyond the scope of the HTML transformer. Maybe we include: Fully qualified name, containing document (or document path) and line number? |
See: #14 (comment)
The linking should be done by the HtmlTransformer. In fact the HtmlTransformer know about the whole model since it transforms the entire model. The code to find the correct document/line should not be to extensive with LINQ. |
Ok, I'm a little concerned about performance, but we can see once we've gotten there. I've started rewriting the DocumentWalker to generate the DocumentModels. One more question: How should we represent trivia? Should we have a Leading and Trailing trivia field for each token? |
Based off the design discussed in #14
Just a reminder: @JoshVarty remember to support folders which are in the repo but come before the .sln file. Currently they are not in the model, and we don't account for them (but we should) |
What are the opinions on the first three transformers? I've created a base abstract class AbstractWorkspaceVisitor that all transformers inherit from. It takes care of visiting the projects and folders properly. Based on their needs transformers may override: This allows transformers to process only the pieces of the WorkspaceModel that they're interested in. (ie. A search index transformer likely does not need to visit Folders when building its index.) If everyone is roughly satisfied with this approach, I'll go ahead and close this Issue. Also, I think @MarcinJuraszek was right about immutability. There's no needs for a lot of the WorkspaceModel items to have setters. However, I'll create a separate issue for that. |
Wow, I think I missed all the work that was happening in the workspaceModel branch ... Great job guys! I'll take a look into all of this tonight. |
When implementing the PR #13 I realized that the current design is not that flexible. We should discuss about some enhancements in the design 😄
Problems of the current design I see (personal opinion):
Proposed high-level design
Thoughts?
The text was updated successfully, but these errors were encountered: