Skip to content

SortGroup entry with MatchRegex not working #14

@achobanov

Description

@achobanov

Overview

I want my usings in the following order:

  1. System
  2. Microsoft
  3. 3rd Party packages
  4. My own namespaces
  5. using static namespaces

To achieve this I created 5 groups, 4 of which are trivial, because they are simply StatsWith and constant value. However in order to place all 3rd party package usings I tried to use a regex, which does not match any of the other groups.

When I used the hotkey to format the usings the 3rd party ones were ordered last, When I opened the settings again I was intrigued to see that my group rule is completely gone. So I tested it:

  1. Create a new rule, chose MatchRegex and pass in ^[^.]+?(using (?!System)(?!Microsoft)(?!Interactive\.)(?!static)[A-Z]{1}.*)$ as Value
  2. Save settings
  3. Use format hotkey
  4. Open settings again

The newly created rule is gone.

This does not happen for all regex values. For example the rule did not go away with .+?using AutoMapper;.

Sample namespaces I tested with:

    using Microsoft.AspNetCore.Mvc;
    using AutoMapper;
    using Interactive.Servers.Controllers;
    using Interactive.Servers.Extensions;
    using Microsoft.Extensions.Logging;
    using Interactive.Servers.Lms.Models;
    using System.Threading.Tasks;
    using Interactive.Servers.Lms.Models.Exams;
    using Interactive.Services.Lms.Business;
    using static Interactive.Servers.ServerConstants;
    using Interactive.Services.Mapping;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions