Posted 19 years ago
by Thomas Goff
Currently, the code snippets do not correctly support multiple levels of folders. This can be seen by modifying the C# snippets folder structure in your sample application. The shipped structure is as follows:
Snippets\C#\for.snippet
Snippets\C#\switch.snippet
Snippets\C#\Sample Child Folder\while.snippet
If you update it to the following structure, then the code snippets will not property load:
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\for.snippet
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\switch.snippet
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\while.snippet
Using Reflector, I was able to determine that the issue is in the CodeSnippetFolder.Refresh method. Specifically, the if-statement, in the for-loop that iterates over the sub-folders, will only add “Sample Child Folder 1” to it’s list of valid folders if it has actual snippet files. This if-statement should also add the “Sample Child Folder 1” if it has sub-folders that have actual snippet files.
Therefore, this:Should be:
Snippets\C#\for.snippet
Snippets\C#\switch.snippet
Snippets\C#\Sample Child Folder\while.snippet
If you update it to the following structure, then the code snippets will not property load:
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\for.snippet
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\switch.snippet
Snippets\C#\Sample Child Folder 1\Sample Child Folder 2\while.snippet
Using Reflector, I was able to determine that the issue is in the CodeSnippetFolder.Refresh method. Specifically, the if-statement, in the for-loop that iterates over the sub-folders, will only add “Sample Child Folder 1” to it’s list of valid folders if it has actual snippet files. This if-statement should also add the “Sample Child Folder 1” if it has sub-folders that have actual snippet files.
Therefore, this:
if (folder1.CodeSnippets.Count > 0)
if (folder1.CodeSnippets.Count > 0 || this.ChildFolders.Count > 0)