Skip to content

Commit 8543660

Browse files
Migrate Cursorless formatter names to community (#2819)
Co-authored-by: Phil Cohen <[email protected]>
1 parent 0c94137 commit 8543660

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/cursorless-vscode/src/migrateSnippets.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,30 @@ function parseVariables(
141141
wrapperPhrases: phrase ? [phrase] : undefined,
142142
wrapperScope: variable.wrapperScopeType,
143143
insertionFormatters: variable.formatter
144-
? [variable.formatter]
144+
? getFormatter(variable.formatter)
145145
: undefined,
146146
// SKIP: variable.description
147147
};
148148
},
149149
);
150150
}
151151

152+
// Convert Cursorless formatters to Talon community formatters
153+
function getFormatter(formatter: string): string[] {
154+
switch (formatter) {
155+
case "camelCase":
156+
return ["PRIVATE_CAMEL_CASE"];
157+
case "pascalCase":
158+
return ["PUBLIC_CAMEL_CASE"];
159+
case "snakeCase":
160+
return ["SNAKE_CASE"];
161+
case "upperSnakeCase":
162+
return ["ALL_CAPS", "SNAKE_CASE"];
163+
default:
164+
return [formatter];
165+
}
166+
}
167+
152168
async function openResultDocument(
153169
result: Result,
154170
sourceDirectory: string,

0 commit comments

Comments
 (0)