Skip to content

Commit

Permalink
Migrate Cursorless formatter names to community
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Feb 4, 2025
1 parent 0c94137 commit 611302f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions packages/cursorless-vscode/src/migrateSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,32 @@ function parseVariables(
name,
wrapperPhrases: phrase ? [phrase] : undefined,
wrapperScope: variable.wrapperScopeType,
insertionFormatters: variable.formatter
? [variable.formatter]
: undefined,
insertionFormatters: getFormatter(variable.formatter),
// SKIP: variable.description
};
},
);
}

// Convert Cursorless formatters to Talon community formatters
function getFormatter(formatter?: string): string[] | undefined {
if (!formatter) {
return undefined;
}
switch (formatter) {
case "camelCase":
return ["PRIVATE_CAMEL_CASE"];
case "pascalCase":
return ["PUBLIC_CAMEL_CASE"];
case "snakeCase":
return ["SNAKE_CASE"];
case "upperSnakeCase":
return ["ALL_CAPS", "SNAKE_CASE"];
default:
return [formatter];
}
}

async function openResultDocument(
result: Result,
sourceDirectory: string,
Expand Down

0 comments on commit 611302f

Please sign in to comment.