Skip to content

Commit 037b685

Browse files
committed
Custom formatting of display name
Signed-off-by: Tyler <[email protected]>
1 parent 6102cd4 commit 037b685

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

package.build.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,21 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
280280
+ "non-directional, like Kakoune.",
281281
],
282282
},
283+
activeModeDisplayTextTransform: {
284+
"enum": [
285+
"as-is",
286+
"uppercase",
287+
"lowercase",
288+
289+
],
290+
"default": "as-is",
291+
"description": "Controls how the active mode is formatted in the status bar.",
292+
"enumDescriptions": [
293+
"Display the name with its original formatting.",
294+
"Convert the name to uppercase.",
295+
"Convert the name to lowercase.",
296+
],
297+
},
283298
decorations: {
284299
...selectionDecorationType,
285300
type: ["array", "object", "null"],

package.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/state/editors.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as vscode from "vscode";
22

3-
import type { Extension } from "./extension";
4-
import type { Mode } from "./modes";
53
import { command, commands, Context, Positions, SelectionBehavior, Selections } from "../api";
64
import { extensionName } from "../utils/constants";
75
import { assert } from "../utils/errors";
6+
import type { Extension } from "./extension";
7+
import type { Mode } from "./modes";
88

99
/**
1010
* Dance-specific state related to a single `vscode.TextEditor`.
@@ -254,6 +254,19 @@ export class PerEditorState implements vscode.Disposable {
254254
}
255255
}
256256

257+
private _formatDisplayName(modeName: string) {
258+
switch (vscode.workspace.getConfiguration(extensionName)
259+
.get<string>("activeModeDisplayTextTransform")) {
260+
case "uppercase":
261+
return modeName.toUpperCase();
262+
case "lowercase":
263+
return modeName.toLowerCase();
264+
case "as-is":
265+
default:
266+
return modeName;
267+
}
268+
}
269+
257270
/**
258271
* Called when `vscode.window.onDidChangeActiveTextEditor` is triggered with
259272
* another editor.

0 commit comments

Comments
 (0)