Skip to content

Commit 96f6c83

Browse files
Updated meta updater with scopes (#3024)
1 parent 73c4cbe commit 96f6c83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+425
-13
lines changed

packages/common/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export * from "./util/itertools";
104104
export * from "./util/Notifier";
105105
export * from "./util/object";
106106
export * from "./util/omitByDeep";
107+
export * from "./util/prettifyLanguageName";
107108
export * from "./util/range";
108109
export * from "./util/regex";
109110
export * from "./util/selectionsEqual";
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { capitalize } from "./stringUtils";
2+
3+
export function prettifyLanguageName(name: string): string {
4+
switch (name) {
5+
case "cpp":
6+
return "C++";
7+
case "csharp":
8+
return "C#";
9+
case "javascript":
10+
return "JavaScript";
11+
case "typescript":
12+
return "TypeScript";
13+
case "javascriptreact":
14+
return "JavaScript React";
15+
case "typescriptreact":
16+
return "TypeScript React";
17+
case "jsonl":
18+
return "JSON lines (JSONL)";
19+
case "jsonc":
20+
return "JSON with comments (JSONC)";
21+
case "scm":
22+
return "Tree sitter query (SCM)";
23+
case "css":
24+
case "scss":
25+
case "json":
26+
case "php":
27+
case "html":
28+
case "xml":
29+
return name.toUpperCase();
30+
default:
31+
return capitalize(name);
32+
}
33+
}

packages/common/src/util/serializeScopeType.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { capitalize } from "lodash-es";
12
import type {
23
ScopeType,
34
ScopeTypeType,
45
SimpleScopeTypeType,
56
} from "../types/command/PartialTargetDescriptor.types";
7+
import { camelCaseToAllDown } from "./stringUtils";
68

79
export function serializeScopeType(
810
scopeType: SimpleScopeTypeType | ScopeType,
@@ -12,3 +14,9 @@ export function serializeScopeType(
1214
}
1315
return scopeType.type;
1416
}
17+
18+
export function prettifyScopeType(
19+
scopeType: SimpleScopeTypeType | ScopeType,
20+
): string {
21+
return capitalize(camelCaseToAllDown(serializeScopeType(scopeType)));
22+
}
Lines changed: 3 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 9 additions & 0 deletions
Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)