Skip to content

Commit

Permalink
change scalafmt default maxColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Mar 20, 2024
1 parent f03ba56 commit e5db0c3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sources/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,25 @@ const getBoolFromStorageOr = (key, defaultValue) => {
return getFromStorageOr(key, defaultValue, (a) => a === "true");
};

const screenWidth = Math.max(
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth,
document.documentElement.clientWidth,
);

let defaultMaxColumn = 50;
if (screenWidth >= 1500) {
defaultMaxColumn = 80;
} else if (screenWidth >= 1400) {
defaultMaxColumn = 70;
} else if (screenWidth >= 1300) {
defaultMaxColumn = 60;
}

const defaultScalafmtConfig = `
maxColumn = 50
maxColumn = ${defaultMaxColumn}
runner.dialect = "Scala3"
align.preset = "none"
continuationIndent.defnSite = 2
Expand Down

0 comments on commit e5db0c3

Please sign in to comment.