Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Environment variables and multi-input arguments (VOID_PLUGINS, VOID_NUGET_REPOSITORIES, etc.) were parsed with inconsistent delimiter handling—some using simple Split(',', ';'), others using regex for escaped delimiters.

Changes

  • Added StringExtensions.SplitByDelimiters() in src/Api/Extensions/

    • Default delimiters: ,, ;, \n
    • Optional escape character support (e.g., \; for literal semicolons)
    • Compiled regex for escaped delimiter performance
    • Auto-trims and removes empty entries by default
  • Refactored PluginService.cs

    - return args.Split(',', ';');
    + return args.SplitByDelimiters();
  • Refactored NuGetDependencyResolver.cs

    - UnescapedSemicolonRegex().Split(env ?? "").Select(repo => repo.Replace(@"\;", ";"))
    + (env ?? "").SplitByDelimiters([';'], escapeCharacter: '\\')
    • Removed UnescapedSemicolonRegex() partial method
    • Removed partial keyword from class
  • Added 16 unit tests covering default/custom delimiters, escape handling, trimming, and real-world scenarios

Example Usage

// Simple case (default delimiters: , ; \n)
"a,b;c".SplitByDelimiters()  // ["a", "b", "c"]

// With escaped delimiters
@"url1\;extra;url2".SplitByDelimiters([';'], escapeCharacter: '\\')  // ["url1;extra", "url2"]
Original prompt

VOID_PLUGINS
VOID_NUGET_REPOSITORIES

These env vars and may be some other code like for parsing program arguments are using multi inputs that are split with delimiters like ';' or any another.

I'd like you to find all places in code where this logic applies and dedicate that logic into same place so all places reuse it same way. Maybe just extension method that splits the string by delimiters. Default delimiters should include ,; and \n or \r\n


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 11, 2026 00:13
Created centralized extension method for delimited string parsing with escape character support.

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
- Removed unused System.Text.RegularExpressions import from NuGetDependencyResolver
- Added RegexOptions.Compiled for better performance in StringExtensions

Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor code for parsing program arguments with delimiters refactor(api): ♻️ consolidate delimited string parsing into reusable extension Feb 11, 2026
Copilot AI requested a review from caunt February 11, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants