-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add option to merge tree nodes with only one child #257
Add option to merge tree nodes with only one child #257
Conversation
Refactored a little in the process.
Hey @GeorchW and thanks for the PR. Would you mind sharing a screenshot of how the different treeModes will look? |
Heh, I've catched some bugs while trying to demonstrate :-D - Additionally, I've modified the settings update mechanism such that the view is refreshed when changing settings. This is the old This is the old And this is the added behaviour, which can be selected through |
I've also replaced the parsing logic for test names. The old system relied on splitting on regular expressions, which does not allow for any context-free grammar occurring in the name and is generally less readable/debuggable. The new parsing code should also handle cases like |
Hey @GeorchW! I really like the merged look, like you say it seems like a good compromise with the best of both worlds. However I have some concern regarding the rework of the parsing logic. While you have a valid point regarding reg exp in general I'm not sure that the code that replaces it in this case is more readable and easier to understand. Is it possible to not include that change in this PR? Either way I think it's helpful to have a separate PR with changing of the parsing logic and keep this one focused on the code needed for the merged behavior. Makes sense? |
About the parsing logic... I didn't touch it for no reason. More concretely:
I was first under the impression that I had regressed from the old behaviour since nested classes did not work while nested classes were included in the test projects, but I've just looked it up and it turns out that nested classes were not supported all along; they were displayed in nodes like I see that this code might be more of a fit for a separate PR though. In particular, I can see that I should probably make the parsing code more clean, for example through:
I do think that the additional features justify some additional complexity. If you think the same way, I'll make a separate PR for that. (If you don't, then I'll just throw this code out.) |
Ah yea, moving the functionality to a separate file would improve things. Ideally I'd like to add some focused test on just this functionality, somewhat similar to what we have in https://github.com/formulahendry/vscode-dotnet-test-explorer/blob/master/test/problems.test.ts. This would also server as a great place for you to demonstrate the difference cases of discovered test names and how they should be split up in their parts. That would make the whole thing much easier as well from a maintainence perspective. If you would be OK with doing that work I don't think the need to split this into two different PR is all that necessary so you can do whatever is most convenient for you. Sound ok? |
Sounds great! Tbh I thought about adding some tests, too, but was a little too lazy. It's good that you are strict on that part :-) - Since I'll already be doing that, I think I'll also write some tests for the tree generation (at least something like "no test is swallowed in either mode"). I think I'll get something done on the weekend. EDIT: TODO:
|
Okay, this should be it! @stefanforsberg The tests might be a little verbose, but that's the price you pay for strict unit-tests (without dependencies) I guess. |
Amazing work @GeorchW, thanks a lot! =) I'll take a closer look later today and/or over the weekend! |
I didn't like how namespaces containing only one element (e.g.
Company.Project.Test
) spawned a new tree node for each level. I've added a behaviour where the namespaces behave like folders in VSCode: If there's only one subfolder, it will be shown in the same line.The option
useTreeView
has consequently been replaced by a similar optiontreeMode
which can be set to"flat"
(the old behaviour forfalse
),"full"
(the old behaviour fortrue
) and"merged"
(the new behaviour), which is the default.Also refactored a little in the process.