Skip to content

Commit

Permalink
Fix impl of segment boundary regex
Browse files Browse the repository at this point in the history
  • Loading branch information
zm-cttae committed Mar 10, 2023
1 parent 0ee86d9 commit 1141b71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vs/editor/common/services/getIconClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { FileKind } from 'vs/platform/files/common/files';

const fileIconDirectoryRegex = /(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;
const fileIconWildcardChainRegex = /\*(?:\.\*)+/;
const segmentBoundary = new BackwardsCompatibleRegExp('_|-|(?<=\\p{Ll})(?=\\p{Lu})', 'u');

export function getIconClasses(modelService: IModelService, languageService: ILanguageService, resource: uri | undefined, fileKind?: FileKind): string[] {

Expand Down Expand Up @@ -137,7 +138,8 @@ function pushGlobIconClassesForName(name: string, classes: string[], segments: s
const extname = name.substring(dotIndex);
const basename = name.substring(0, dotIndex);

const separator = new BackwardsCompatibleRegExp('_|-|(?<=\\p{Ll})(?=\\p{Lu})', 'u').exec(basename)?.[0];
const boundary = segmentBoundary.get();
const separator = boundary.exec(basename)?.[0];

if (separator) {
// Prefix basename glob e.g. `test_*.py`
Expand Down

0 comments on commit 1141b71

Please sign in to comment.