Skip to content

Commit 611302f

Browse files
Migrate Cursorless formatter names to community
1 parent 0c94137 commit 611302f

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

packages/cursorless-vscode/src/migrateSnippets.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,32 @@ function parseVariables(
140140
name,
141141
wrapperPhrases: phrase ? [phrase] : undefined,
142142
wrapperScope: variable.wrapperScopeType,
143-
insertionFormatters: variable.formatter
144-
? [variable.formatter]
145-
: undefined,
143+
insertionFormatters: getFormatter(variable.formatter),
146144
// SKIP: variable.description
147145
};
148146
},
149147
);
150148
}
151149

150+
// Convert Cursorless formatters to Talon community formatters
151+
function getFormatter(formatter?: string): string[] | undefined {
152+
if (!formatter) {
153+
return undefined;
154+
}
155+
switch (formatter) {
156+
case "camelCase":
157+
return ["PRIVATE_CAMEL_CASE"];
158+
case "pascalCase":
159+
return ["PUBLIC_CAMEL_CASE"];
160+
case "snakeCase":
161+
return ["SNAKE_CASE"];
162+
case "upperSnakeCase":
163+
return ["ALL_CAPS", "SNAKE_CASE"];
164+
default:
165+
return [formatter];
166+
}
167+
}
168+
152169
async function openResultDocument(
153170
result: Result,
154171
sourceDirectory: string,

0 commit comments

Comments
 (0)