Quellcode durchsuchen

FilteredSolutionsExtension: add tools to manage sources in AI. add getting_started.txt

Dalibor Votruba vor 1 Jahr
Ursprung
Commit
cdcf219170

+ 1 - 0
.gitignore

@@ -36,3 +36,4 @@ packages/
 *.xsb
 *.pjb
 *.nupkg
+.srcout/

+ 194 - 0
FilteredSolutionsExtension/FilteredSolutionsExtension/Assets/getting_started.txt

@@ -0,0 +1,194 @@
+# Getting Started with Filtered Solutions Extension
+
+## Overview
+
+The Filtered Solutions Extension for Visual Studio 2022 is a productivity tool that automatically presents a project filter dialog when opening solutions with multiple projects. This allows you to work with only the projects you need, improving performance and reducing clutter.
+
+## Key Features
+
+✅ **Automatic filtering dialog** when opening multi-project solutions  
+✅ **Smart dependency management** - automatically selects/deselects dependent projects  
+✅ **Pattern-based filtering** with wildcard support (`*Test*`, `Core*`, etc.)  
+✅ **Bulk selection operations** (Select All, Clear All, Select Tests)  
+✅ **Tree view display** showing project dependencies  
+✅ **Safe operation** - original solutions remain untouched  
+✅ **Manual filtering** for already opened solutions  
+
+## Installation
+
+1. **Build the extension** or get the pre-built `.vsix` file
+2. **Double-click** the `.vsix` file to install
+3. **Restart Visual Studio 2022** if prompted
+4. The extension is now active and ready to use
+
+## How to Use
+
+### Automatic Filtering (Recommended)
+
+1. **Open a solution** using `File → Open → Project/Solution`
+2. **Filter dialog appears** automatically for solutions with 2+ projects
+3. **Select projects** you want to work with using checkboxes
+4. **Dependencies are auto-selected** when you check a project
+5. **Click "Create Filtered Solution"** to generate and open filtered solution
+6. **Or click "Open All Projects"** to continue with the full solution
+
+### Manual Filtering
+
+1. **Open any solution** normally in Visual Studio
+2. **Go to File menu** → "Filter Solution Projects..."
+3. **Use the same dialog** to filter the currently opened solution
+4. **Generate filtered solution** as needed
+
+### Dialog Controls
+
+#### Project Selection
+- **Checkboxes**: Click to select/deselect individual projects
+- **Auto-dependencies**: Dependencies are automatically selected when you check a project
+- **Auto-dependents**: Dependents are automatically deselected when you uncheck a project
+
+#### Bulk Operations
+- **Select All**: Checks all projects in the solution
+- **Clear All**: Unchecks all projects
+- **Select Tests**: Automatically selects projects containing "Test" in their name
+
+#### Filtering
+- **Filter Pattern box**: Enter wildcard patterns to filter the project list
+- **Examples**:
+  - `*Test*` - Shows projects containing "Test"
+  - `Core*` - Shows projects starting with "Core"
+  - `*.Data` - Shows projects ending with ".Data"
+  - `Web*` - Shows projects starting with "Web"
+- **Clear button**: Removes the current filter
+
+#### Tree View Features
+- **Expand All/Collapse All**: Control dependency tree visibility
+- **Project icons**: Visual indicators for different project types
+- **Tooltips**: Hover for detailed project information
+- **Selection counter**: Shows "X of Y projects selected"
+
+## Understanding Dependencies
+
+The extension automatically manages project dependencies:
+
+- **When you CHECK a project**: All its dependencies are automatically checked
+- **When you UNCHECK a project**: All projects that depend on it are automatically unchecked
+- **Dependency tree**: Shows which projects reference others in a hierarchical view
+- **Smart selection**: Ensures your filtered solution will compile successfully
+
+## Examples
+
+### Example 1: Working with Tests Only
+1. Open your main solution
+2. In the filter pattern, type: `*Test*`
+3. Click "Select Tests" button
+4. All test projects and their dependencies will be selected
+5. Click "Create Filtered Solution"
+
+### Example 2: Core Projects Only
+1. Open your solution
+2. Use pattern: `*Core*` or `*Infrastructure*`
+3. Manually check any additional projects you need
+4. Dependencies are auto-selected
+5. Generate the filtered solution
+
+### Example 3: Web Projects
+1. Filter with: `*Web*` or `*API*`
+2. Add any shared libraries you need
+3. The extension ensures all dependencies are included
+4. Work with a clean web-focused solution
+
+## File Management
+
+### Where Filtered Solutions Are Stored
+- **Location**: System temp directory under `FilteredSolutions` folder
+- **Naming**: `OriginalName_filtered.sln`
+- **Safety**: Original solutions are never modified
+
+### Custom Save Location
+- Use **"Save As..."** button in the dialog
+- Choose your preferred location
+- Useful for creating permanent filtered solutions
+
+## Tips and Best Practices
+
+### Performance Tips
+- **Start small**: Begin with just the projects you're actively working on
+- **Use patterns**: Leverage filtering to quickly find relevant projects
+- **Test projects**: Use "Select Tests" for focused testing sessions
+
+### Workflow Suggestions
+- **Feature work**: Filter to feature-specific projects + dependencies
+- **Bug fixing**: Filter to affected projects only
+- **Code review**: Filter to changed projects for easier navigation
+- **Performance testing**: Create minimal solutions for faster builds
+
+### Dependency Management
+- **Trust auto-selection**: The extension correctly identifies dependencies
+- **Check the tree**: Use Expand All to verify dependency relationships
+- **Selection count**: Watch the counter to avoid over-selection
+
+## Troubleshooting
+
+### Dialog Doesn't Appear
+- **Check project count**: Dialog only appears for solutions with 2+ projects
+- **Verify installation**: Go to Extensions → Manage Extensions
+- **Already filtered**: Dialog skips already filtered solutions
+
+### Dependencies Not Working
+- **Check project references**: Ensure projects have proper references in .csproj files
+- **Solution dependencies**: Some dependencies are defined at solution level
+- **Manual selection**: You can always manually select additional projects
+
+### Filtered Solution Won't Open
+- **Check paths**: Ensure all project files exist and are accessible
+- **Dependencies**: Verify all required dependencies are included
+- **Error messages**: Check Visual Studio output window for details
+
+### Performance Issues
+- **Large solutions**: Parsing 100+ projects may take time
+- **Network drives**: Local solutions perform better
+- **Clean temp**: Clear temp folder if accumulating many filtered solutions
+
+## Advanced Features
+
+### Pattern Matching
+- **Case insensitive**: Patterns work regardless of case
+- **Multiple patterns**: Use the filter iteratively to refine selection
+- **Regex-like**: Uses wildcard patterns converted to regex internally
+
+### Dependency Tree
+- **Visual hierarchy**: See which projects depend on others
+- **Expand/collapse**: Control detail level
+- **Tooltips**: Rich information about each project
+
+### Settings (Future)
+The extension includes infrastructure for future configuration options:
+- Auto-show preferences
+- Remembered selections per solution
+- Default filter patterns
+- Custom project type handling
+
+## Getting Help
+
+### Debug Information
+- **Output window**: Check Visual Studio Output → General pane
+- **Log files**: Extension logs to temp directory
+- **Error dialogs**: Extension shows clear error messages
+
+### Common Issues
+- **Missing projects**: Usually indicates dependency resolution issues
+- **Build errors**: May need to manually include additional shared projects
+- **Path issues**: Ensure project files haven't been moved since solution creation
+
+## Version Information
+
+- **Current version**: 1.0.0
+- **Visual Studio**: 2022 (17.0+)
+- **Target Framework**: .NET Framework 4.7.2
+- **License**: CC0 1.0 Universal (Public Domain)
+
+---
+
+**Happy coding with cleaner, focused solutions!** 🚀
+
+The Filtered Solutions Extension helps you stay productive by working with just the projects you need, while ensuring all dependencies are properly included.

+ 8 - 0
FilteredSolutionsExtension/FilteredSolutionsExtension/FilteredSolutionsExtension.csproj

@@ -105,10 +105,18 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <IncludeInVSIX>true</IncludeInVSIX>
     </Content>
+    <Content Include="Assets\getting_started.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <IncludeInVSIX>true</IncludeInVSIX>
+    </Content>
     <Content Include="Assets\licence.txt">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <IncludeInVSIX>true</IncludeInVSIX>
     </Content>
+    <Content Include="Assets\screenshot.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <IncludeInVSIX>true</IncludeInVSIX>
+    </Content>
     <Content Include="Menus.vsct" />
     <Content Include="Assets\releasenote.txt">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+ 71 - 31
FilteredSolutionsExtension/FilteredSolutionsExtension/directory_structure.txt

@@ -1,31 +1,71 @@
-Properties
-+ AssemblyInfo.cs
-Resources
-+ FilterSolutionsCommand.png
-bo_strong_key_pair.snk
-DebugHelper.cs
-directory_structure.txt
-ErrorHandler.cs
-ExtensionSettings.cs
-FileUtils.cs
-FilteredSolutionGenerator.cs
-FilteredSolutionsExtension.csproj
-FilteredSolutionsExtension.csproj.user
-FilteredSolutionsExtensionPackage.cs
-fse_icon.ico
-licence.txt
-ManualFilterCommand.cs
-Menus.vsct
-ProjectFilterDialog.xaml
-ProjectFilterDialog.xaml.cs
-ProjectInfo.cs
-ProjectNode.cs
-ProjectTreeItem.cs
-readme.md
-releasenote.txt
-Resources
-SolutionEventsHandler.cs
-SolutionOpeningInterceptor.cs
-SolutionParser.cs
-source.extension.vsixmanifest
-StringToVisibilityConverter.cs
+Project Directory Structure 
+Generated on: 03.06.2025 16:48:46,87 
+Root: d:\Projects\quadarax\qdr.app\qdr.app.tools\FilteredSolutionsExtension\FilteredSolutionsExtension 
+ 
+directory_structure.txt 
+FilteredSolutionsExtension.csproj 
+FilteredSolutionsExtensionPackage.cs 
+gen_dirstruct.cmd 
+gen_srcout.cmd 
+Menus.vsct 
+source.extension.vsixmanifest 
+.srcout/ 
+  AssemblyInfo.cs 
+  DebugHelper.cs 
+  directory_structure.txt 
+  ErrorHandler.cs 
+  ExtensionSettings.cs 
+  FileUtils.cs 
+  FilteredSolutionGenerator.cs 
+  FilteredSolutionsExtension.csproj 
+  FilteredSolutionsExtensionPackage.cs 
+  gen_dirstruct.cmd 
+  gen_srcout.cmd 
+  licence.txt 
+  ManualFilterCommand.cs 
+  Menus.vsct 
+  ProjectFilterDialog.xaml 
+  ProjectFilterDialog.xaml.cs 
+  ProjectInfo.cs 
+  ProjectNode.cs 
+  ProjectTreeItem.cs 
+  readme.md 
+  releasenote.txt 
+  SolutionEventsHandler.cs 
+  SolutionOpeningInterceptor.cs 
+  SolutionParser.cs 
+  source.extension.vsixmanifest 
+  StringToVisibilityConverter.cs 
+Assets/ 
+  bo_strong_key_pair.snk 
+  fse_icon.ico 
+  getting_started.txt 
+  licence.txt 
+  readme.md 
+  releasenote.txt 
+  screenshot.png 
+Commands/ 
+  ManualFilterCommand.cs 
+Converters/ 
+  StringToVisibilityConverter.cs 
+Handlers/ 
+  ErrorHandler.cs 
+  SolutionEventsHandler.cs 
+  SolutionOpeningInterceptor.cs 
+Helpers/ 
+  DebugHelper.cs 
+  ExtensionSettings.cs 
+  FileUtils.cs 
+  FilteredSolutionGenerator.cs 
+  SolutionParser.cs 
+Models/ 
+  ProjectInfo.cs 
+  ProjectNode.cs 
+  ProjectTreeItem.cs 
+Properties/ 
+  AssemblyInfo.cs 
+Resources/ 
+  FilterSolutionsCommand.png 
+Views/ 
+  ProjectFilterDialog.xaml 
+  ProjectFilterDialog.xaml.cs 

+ 73 - 0
FilteredSolutionsExtension/FilteredSolutionsExtension/gen_dirstruct.cmd

@@ -0,0 +1,73 @@
+@echo off
+setlocal enabledelayedexpansion
+
+rem Generate directory structure file for Visual Studio extension project
+rem Excludes: .vs, bin, obj directories and *.user files
+
+set OUTPUT_FILE=directory_structure.txt
+set CURRENT_DIR=%CD%
+
+echo Generating directory structure...
+echo Project Directory Structure > "%OUTPUT_FILE%"
+echo Generated on: %DATE% %TIME% >> "%OUTPUT_FILE%"
+echo Root: %CURRENT_DIR% >> "%OUTPUT_FILE%"
+echo. >> "%OUTPUT_FILE%"
+
+rem Function to process directory recursively
+call :ProcessDirectory "." ""
+
+echo.
+echo Directory structure generated successfully in: %OUTPUT_FILE%
+pause
+goto :eof
+
+:ProcessDirectory
+set "dir_path=%~1"
+set "indent=%~2"
+
+rem Get directory name for display
+for %%F in ("%dir_path%") do set "dir_name=%%~nxF"
+
+rem Skip excluded directories
+if /i "%dir_name%"==".vs" goto :eof
+if /i "%dir_name%"=="bin" goto :eof
+if /i "%dir_name%"=="obj" goto :eof
+if /i "%dir_name%"=="packages" goto :eof
+if /i "%dir_name%"==".git" goto :eof
+if /i "%dir_name%"=="node_modules" goto :eof
+
+rem Print current directory (except root)
+if not "%dir_path%"=="." (
+    echo %indent%%dir_name%/ >> "%OUTPUT_FILE%"
+    set "new_indent=%indent%  "
+) else (
+    set "new_indent="
+)
+
+rem Process files in current directory
+for %%F in ("%dir_path%\*") do (
+    set "file_name=%%~nxF"
+    set "file_ext=%%~xF"
+    
+    rem Skip user-specific and temporary files
+    if /i not "!file_ext!"==".user" (
+        if /i not "!file_ext!"==".suo" (
+            if /i not "!file_ext!"==".cache" (
+                if /i not "!file_name!"==".gitignore" (
+                    if /i not "!file_name!"=="Thumbs.db" (
+                        if /i not "!file_name!"=="Desktop.ini" (
+                            echo %new_indent%!file_name! >> "%OUTPUT_FILE%"
+                        )
+                    )
+                )
+            )
+        )
+    )
+)
+
+rem Process subdirectories
+for /d %%D in ("%dir_path%\*") do (
+    call :ProcessDirectory "%%D" "%new_indent%"
+)
+
+goto :eof

+ 172 - 0
FilteredSolutionsExtension/FilteredSolutionsExtension/gen_srcout.cmd

@@ -0,0 +1,172 @@
+@echo off
+setlocal enabledelayedexpansion
+
+echo ====================================
+echo Visual Studio Solution Files Copier
+echo ====================================
+echo.
+
+REM Get the current directory
+set "SOURCE_DIR=%CD%"
+set "TARGET_DIR=%SOURCE_DIR%\.srcout"
+
+echo Source Directory: %SOURCE_DIR%
+echo Target Directory: %TARGET_DIR%
+echo.
+
+REM Clear and create target directory
+if exist "%TARGET_DIR%" (
+    echo Clearing existing .srcout directory...
+    rmdir /s /q "%TARGET_DIR%" 2>nul
+    if exist "%TARGET_DIR%" (
+        echo Warning: Could not completely clear .srcout directory
+        timeout /t 2 >nul
+    )
+)
+
+echo Creating .srcout directory...
+mkdir "%TARGET_DIR%" 2>nul
+if not exist "%TARGET_DIR%" (
+    echo Error: Could not create .srcout directory
+    pause
+    exit /b 1
+)
+
+echo.
+echo Copying files to .srcout root directory...
+
+REM Initialize counters
+set "COPIED_COUNT=0"
+set "SKIPPED_COUNT=0"
+
+REM Function to copy files recursively, flattening directory structure
+call :CopyFilesFlat "%SOURCE_DIR%"
+
+echo.
+echo Copy operation completed!
+echo Files copied: %COPIED_COUNT%
+echo Files skipped: %SKIPPED_COUNT%
+
+goto :ContinueScript
+
+:CopyFilesFlat
+setlocal
+set "CURRENT_DIR=%~1"
+
+REM Process files in current directory
+for %%f in ("%CURRENT_DIR%\*") do (
+    if not "%%~nxf"=="" (
+        call :CopyFile "%%f"
+    )
+)
+
+REM Process subdirectories (excluding blacklisted ones)
+for /d %%d in ("%CURRENT_DIR%\*") do (
+    set "DIR_NAME=%%~nxd"
+    set "SKIP_DIR=0"
+    
+    REM Check if directory should be excluded
+    if /i "!DIR_NAME!"==".vs" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"=="bin" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"=="obj" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"=="packages" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"=="TestResults" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"==".git" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"==".srcout" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"=="node_modules" set "SKIP_DIR=1"
+    if /i "!DIR_NAME!"==".nuget" set "SKIP_DIR=1"
+    
+    if "!SKIP_DIR!"=="0" (
+        call :CopyFilesFlat "%%d"
+    )
+)
+endlocal
+goto :eof
+
+:CopyFile
+setlocal
+set "SOURCE_FILE=%~1"
+set "FILE_NAME=%~nx1"
+set "FILE_EXT=%~x1"
+set "SKIP_FILE=0"
+
+REM Check if file should be excluded
+if /i "%FILE_EXT%"==".user" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".suo" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".cache" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".tmp" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".temp" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".log" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".pdb" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".exe" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".dll" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".png" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".jpg" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".gif" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".ico" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".snk" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".vspscc" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".vssscc" set "SKIP_FILE=1"
+if /i "%FILE_EXT%"==".scc" set "SKIP_FILE=1"
+if /i "%FILE_NAME%"==".DS_Store" set "SKIP_FILE=1"
+if /i "%FILE_NAME%"=="Thumbs.db" set "SKIP_FILE=1"
+if /i "%FILE_NAME%"=="desktop.ini" set "SKIP_FILE=1"
+
+if "%SKIP_FILE%"=="0" (
+    REM Handle duplicate filenames by adding a counter
+    set "TARGET_FILE=%TARGET_DIR%\%FILE_NAME%"
+    set "COUNTER=1"
+    
+    :CheckDuplicate
+    if exist "!TARGET_FILE!" (
+        set "BASE_NAME=%~n1"
+        set "TARGET_FILE=%TARGET_DIR%\!BASE_NAME!_!COUNTER!%FILE_EXT%"
+        set /a "COUNTER+=1"
+        goto :CheckDuplicate
+    )
+    
+    copy "%SOURCE_FILE%" "!TARGET_FILE!" >nul 2>&1
+    if !ERRORLEVEL! EQU 0 (
+        set /a "COPIED_COUNT+=1"
+        echo Copied: %FILE_NAME%
+    ) else (
+        echo Failed to copy: %FILE_NAME%
+    )
+) else (
+    set /a "SKIPPED_COUNT+=1"
+)
+endlocal
+goto :eof
+
+:ContinueScript
+
+REM Count files copied
+echo.
+echo Counting files in .srcout directory...
+set "FINAL_COUNT=0"
+for /f %%i in ('dir "%TARGET_DIR%" /b /a-d 2^>nul ^| find /c /v ""') do set "FINAL_COUNT=%%i"
+
+echo.
+echo ====================================
+echo Copy Summary:
+echo ====================================
+echo Files copied: %FINAL_COUNT%
+echo Files processed: %COPIED_COUNT%
+echo Files skipped: %SKIPPED_COUNT%
+echo Source: %SOURCE_DIR%
+echo Target: %TARGET_DIR%
+echo.
+echo All files are copied to .srcout root directory (flattened structure)
+echo Excluded directories: .vs, bin, obj, packages, TestResults, .git, .srcout, node_modules, .nuget
+echo Excluded files: *.user, *.suo, *.cache, *.tmp, *.temp, *.log, *.pdb, *.exe, *.dll, and others
+echo ====================================
+
+REM Optional: Open target directory in Explorer
+set /p "OPEN_FOLDER=Open .srcout folder in Explorer? (y/n): "
+if /i "%OPEN_FOLDER%"=="y" (
+    explorer "%TARGET_DIR%"
+)
+
+echo.
+echo Script completed. Press any key to exit...
+pause >nul

+ 3 - 0
FilteredSolutionsExtension/FilteredSolutionsExtension/source.extension.vsixmanifest

@@ -5,8 +5,11 @@
         <DisplayName>FilteredSolutionsExtension</DisplayName>
         <Description xml:space="preserve">Visual Studio extension to filter projects when opening solutions.</Description>
         <License>Assets\licence.txt</License>
+        <GettingStartedGuide>Assets\getting_started.txt</GettingStartedGuide>
         <ReleaseNotes>Assets\releasenote.txt</ReleaseNotes>
         <Icon>Assets\fse_icon.ico</Icon>
+        <PreviewImage>Assets\screenshot.png</PreviewImage>
+        <Tags>solution, filter, free</Tags>
     </Metadata>
     <Installation>
         <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">