Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/de/netnexus/CamelCasePlugin/CamelCaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class CamelCaseConfig implements PersistentStateComponent<CamelCaseConfig
public String[] model = {
"kebab-case",
"SNAKE_CASE",
"CamelCase",
"PascalCase",
"camelCase",
"snake_case",
"space case",
"Camel Case",};
"Space Case",};
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default model includes "PascalCase" / "Space Case", but Conversion.transform() still uses internal identifiers "CamelCase" / "Camel Case". When defaults are used, this mismatch breaks getNext() lookups and can prevent the conversion cycle from progressing correctly. Please align the identifiers (and ideally accept the old identifiers too for backward compatibility with existing saved configs).

Suggested change
"Space Case",};
"Space Case",
// Legacy internal identifiers for backward compatibility
"CamelCase",
"Camel Case",};

Copilot uses AI. Check for mistakes.


CamelCaseConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private Pair<Boolean, T> beforeWriteAction(Editor editor) {
}

private String runWithoutConfig(String text) {
String[] conversionList = {"kebab-case", "SNAKE_CASE", "CamelCase", "camelCase", "snake_case", "space case", "Camel Case"};
String[] conversionList = {"kebab-case", "SNAKE_CASE", "PascalCase", "camelCase", "snake_case", "space case", "Space Case"};
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conversionList now contains "PascalCase" and "Space Case", but Conversion.transform() compares against internal identifiers "CamelCase" / "Camel Case" (see Conversion.java constants). With the current mismatch, getNext()/next.equals(...) checks will not match and conversions can loop until the iteration cap. Please align the strings (either update Conversion constants/logic to the new names, or keep the old identifiers here, ideally with backward-compatible aliases).

Suggested change
String[] conversionList = {"kebab-case", "SNAKE_CASE", "PascalCase", "camelCase", "snake_case", "space case", "Space Case"};
String[] conversionList = {"kebab-case", "SNAKE_CASE", "CamelCase", "camelCase", "snake_case", "space case", "Camel Case", "PascalCase", "Space Case"};

Copilot uses AI. Check for mistakes.
return Conversion.transform(text, true, // pascal case with space
true, // space case
true, // kebab case
Expand Down
2 changes: 1 addition & 1 deletion src/de/netnexus/CamelCasePlugin/Conversion.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static String transform(String text,
}
}
}
if (iterations++ > 20) {
if (iterations++ > 49) {
repeat = false;
}
Comment on lines +134 to 136
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The iteration guard iterations++ > 49 is off by one due to postfix increment, so the loop can run more than 49 iterations (and the effective cap is unclear). Consider comparing before incrementing (e.g., increment then check >= maxIterations) and/or deriving maxIterations from conversionList.length * conversionList.length instead of hard-coding 49.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

text = newText;
Expand Down
Loading