Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellij plugin v1.4 - The contents aren't fixed Crash #95

Open
sndpl opened this issue Sep 19, 2024 · 10 comments
Open

Intellij plugin v1.4 - The contents aren't fixed Crash #95

sndpl opened this issue Sep 19, 2024 · 10 comments

Comments

@sndpl
Copy link

sndpl commented Sep 19, 2024

When pressing save it reports the following error:

java.lang.Throwable: Failed to run Biome check with (format, safefixes) for file index.ts - stdin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × The contents aren't fixed. Use the `--fix` flag to fix them.
  


	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.applyChanges(BiomeCheckRunner.kt:91)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner.access$applyChanges(BiomeCheckRunner.kt:20)
	at com.github.biomejs.intellijbiome.actions.BiomeCheckRunner$formatDocuments$1$1.run(BiomeCheckRunner.kt:58)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:249)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:249)
	at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:501)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:97)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:92)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:464)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Using biome 1.9

@biomejs biomejs deleted a comment Sep 19, 2024
@biomejs biomejs deleted a comment Sep 19, 2024
@arananegra
Copy link

I'm also having this exact problem with Webstorm. It seems that the file is being formatted, but maybe it's the fallback IDE formatting.

@viktor-yunenko
Copy link

viktor-yunenko commented Sep 23, 2024

In my case I fixed the issue by removing formatter.include array from my biome.config. Adding src/ dir to it also worked. This wasn't necessary before, as I have src/ in the config's files.include.

biome.json working:

{
  // ...
  "formatter": {
    "enabled": true
  },
  "files": {
    "include": [
      "graphql/",
      "src/"
    ]
  }
}

biome.json that stopped working:

{
  // ...
  "formatter": {
    "enabled": true,
    "include": [
      "graphql/",
      // adding "src/" here also worked
    ]
  },
  "files": {
    "include": [
      "graphql/",
      "src/"
    ]
  }
}

npx biome rage --config-path=biome.json --formatter was helpful in debugging.

I can't remember why I added graphql/ to formatter.include before though.

@arananegra
Copy link

In my case I fixed the issue by removing formatter.include array from my biome.config. Adding src/ dir to it also worked. This wasn't necessary before, as I have src/ in the config's files.include.

biome.json working:

{
  // ...
  "formatter": {
    "enabled": true
  },
  "files": {
    "include": [
      "graphql/",
      "src/"
    ]
  }
}

biome.json that stopped working:

{
  // ...
  "formatter": {
    "enabled": true,
    "include": [
      "graphql/",
      // adding "src/" here also worked
    ]
  },
  "files": {
    "include": [
      "graphql/",
      "src/"
    ]
  }
}

npx biome rage --config-path=biome.json --formatter was helpful in debugging.

I can't remember why I added graphql/ to formatter.include before though.

I've barely touched my config since it was generated by biome from my eslint/prettier config.

This is my current biome.json.

{
	"$schema": "https://biomejs.dev/schemas/1.9.1/schema.json",
	"vcs": {
		"enabled": true,
		"clientKind": "git",
		"useIgnoreFile": false,
		"defaultBranch": "origin/develop"
	},
	"files": {
		"ignoreUnknown": false,
		"ignore": []
	},
	"formatter": {
		"enabled": true,
		"useEditorconfig": true,
		"formatWithErrors": false,
		"indentStyle": "tab",
		"indentWidth": 2,
		"lineEnding": "lf",
		"lineWidth": 120,
		"attributePosition": "auto",
		"bracketSpacing": true
	},
	"organizeImports": {
		"enabled": true
	},
	"linter": {
		"enabled": true,
		"rules": {
			"recommended": false,
			"a11y": {
				"noBlankTarget": "error"
			},
			"complexity": {
				"noBannedTypes": "error",
				"noExtraBooleanCast": "error",
				"noMultipleSpacesInRegularExpressionLiterals": "error",
				"noUselessCatch": "error",
				"noUselessThisAlias": "error",
				"noUselessTypeConstraint": "error",
				"noWith": "error",
				"useArrowFunction": "off"
			},
			"correctness": {
				"noChildrenProp": "error",
				"noConstAssign": "error",
				"noConstantCondition": "error",
				"noEmptyCharacterClassInRegex": "error",
				"noEmptyPattern": "error",
				"noGlobalObjectCalls": "error",
				"noInnerDeclarations": "error",
				"noInvalidConstructorSuper": "error",
				"noNewSymbol": "error",
				"noNonoctalDecimalEscape": "error",
				"noPrecisionLoss": "error",
				"noSelfAssign": "error",
				"noSetterReturn": "error",
				"noSwitchDeclarations": "error",
				"noUndeclaredVariables": "error",
				"noUnreachable": "error",
				"noUnreachableSuper": "error",
				"noUnsafeFinally": "error",
				"noUnsafeOptionalChaining": "error",
				"noUnusedLabels": "error",
				"noUnusedVariables": "warn",
				"useArrayLiterals": "off",
				"useHookAtTopLevel": "error",
				"useIsNan": "error",
				"useJsxKeyInIterable": "error",
				"useValidForDirection": "error",
				"useYield": "error"
			},
			"security": {
				"noDangerouslySetInnerHtmlWithChildren": "error"
			},
			"style": {
				"noInferrableTypes": "error",
				"noNamespace": "error",
				"noNonNullAssertion": "warn",
				"useAsConstAssertion": "error",
				"useBlockStatements": "off"
			},
			"suspicious": {
				"noAssignInExpressions": "error",
				"noAsyncPromiseExecutor": "error",
				"noCatchAssign": "error",
				"noClassAssign": "error",
				"noCommentText": "error",
				"noCompareNegZero": "error",
				"noControlCharactersInRegex": "error",
				"noDebugger": "error",
				"noDuplicateCase": "error",
				"noDuplicateClassMembers": "error",
				"noDuplicateJsxProps": "error",
				"noDuplicateObjectKeys": "error",
				"noDuplicateParameters": "error",
				"noEmptyBlockStatements": "error",
				"noEmptyInterface": "error",
				"noExplicitAny": "error",
				"noExtraNonNullAssertion": "error",
				"noFallthroughSwitchClause": "error",
				"noFunctionAssign": "error",
				"noGlobalAssign": "error",
				"noImportAssign": "error",
				"noMisleadingCharacterClass": "error",
				"noMisleadingInstantiator": "error",
				"noPrototypeBuiltins": "error",
				"noRedeclare": "error",
				"noShadowRestrictedNames": "error",
				"noSparseArray": "error",
				"noUnsafeNegation": "error",
				"useGetterReturn": "error",
				"useNamespaceKeyword": "error",
				"useValidTypeof": "error"
			}
		},
		"ignore": [
			"**/*.scss",
			"**/node_modules",
			"**/.idea",
			"**/.vscode",
			"**/dist",
			"**/.DS_Store",
			"**/coverage",
			"**/videos",
			"cypress/screenshots",
			"**/dist-dev",
			"**/dist-pre-pro",
			"**/dist-pro",
			"**/dist-local",
			"**/ssl",
			"**/.swc"
		]
	},
	"javascript": {
		"formatter": {
			"jsxQuoteStyle": "double",
			"quoteProperties": "asNeeded",
			"trailingCommas": "all",
			"semicolons": "always",
			"arrowParentheses": "always",
			"bracketSameLine": false,
			"quoteStyle": "single",
			"attributePosition": "auto",
			"bracketSpacing": true
		}
	},
	"overrides": [
		{
			"include": ["*.spec.tsx"],
			"linter": {
				"rules": {
					"correctness": {
						"noUnusedVariables": "off"
					},
					"suspicious": {
						"noEmptyBlockStatements": "off"
					}
				}
			}
		},
		{
			"include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
			"linter": {
				"rules": {
					"correctness": {
						"noConstAssign": "off",
						"noGlobalObjectCalls": "off",
						"noInvalidConstructorSuper": "off",
						"noNewSymbol": "off",
						"noSetterReturn": "off",
						"noUndeclaredVariables": "off",
						"noUnreachable": "off",
						"noUnreachableSuper": "off"
					},
					"style": {
						"noArguments": "error",
						"noVar": "error",
						"useConst": "error"
					},
					"suspicious": {
						"noDuplicateClassMembers": "off",
						"noDuplicateObjectKeys": "off",
						"noDuplicateParameters": "off",
						"noFunctionAssign": "off",
						"noImportAssign": "off",
						"noRedeclare": "off",
						"noUnsafeNegation": "off",
						"useGetterReturn": "off",
						"useValidTypeof": "off"
					}
				}
			}
		}
	]
}

I have some "include" rules, but those are outside formatter

@sitole
Copy link

sitole commented Sep 23, 2024

This commit is causing issue (326675a#diff-1d281df78e3ab6c45cfa052c53e58bd1d824404f01fc9673c94104cecd0b9e96R101) looks like --write argument works find in WebStorm / PHPStorm but in Intellij (2.0.2) causes error.

Just for curiosity, version 1.4 is available in JetBrains store, but there is no official release for 1.4 and last version here is 1.3, would be nice to make it right.

Thanks for you work!

@arananegra
Copy link

This commit is causing issue (326675a#diff-1d281df78e3ab6c45cfa052c53e58bd1d824404f01fc9673c94104cecd0b9e96R101) looks like --write argument works find in WebStorm / PHPStorm but in Intellij (2.0.2) causes error.

Just for curiosity, version 1.4 is available in JetBrains store, but there is no official release for 1.4 and last version here is 1.3, would be nice to make it right.

Thanks for you work!

FYI, I've been experiencing this issue on Webstorm

@conioX
Copy link

conioX commented Sep 24, 2024

This commit is causing issue (326675a#diff-1d281df78e3ab6c45cfa052c53e58bd1d824404f01fc9673c94104cecd0b9e96R101) looks like --write argument works find in WebStorm / PHPStorm but in Intellij (2.0.2) causes error.
Just for curiosity, version 1.4 is available in JetBrains store, but there is no official release for 1.4 and last version here is 1.3, would be nice to make it right.
Thanks for you work!

FYI, I've been experiencing this issue on Webstorm

same with me webstorm 2024.2.2

@sndpl
Copy link
Author

sndpl commented Sep 24, 2024

@sitole it's not the --write argument, I made a new plugin with the --apply argument then i get:

  ! The argument --apply is deprecated, it will be removed in the next major release. Use --write instead.
  

stdin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × The contents aren't fixed. Use the `--fix` flag to fix them.

The fix was done because the --apply did generate warning and the plugin handles this as an error and "crashes". It would be nicer if the plugin first checks the version of biome and then use the correct arguments so the plugin keeps working for people who are using an older biome version.

@sndpl
Copy link
Author

sndpl commented Sep 25, 2024

@bc-m I updated my local branch with your change and created a new plugin (that also logs the arguments), but I still get the error:

2024-09-25 11:47:26,966 [9657843]   INFO - #com.github.biomejs.intellijbiome.BiomeStdinRunner - Check flags: [--formatter-enabled=true, --write, --skip-errors]
2024-09-25 11:47:27,008 [9657885] SEVERE - #com.github.biomejs.intellijbiome.actions.BiomeCheckRunner - Failed to run Biome check with (format, safefixes) for file orderPaymentAuthorizedSQSEvent.ts - stdin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × The contents aren't fixed. Use the `--fix` flag to fix them.

I asked in discord if somebody can explain what this error means since the proposed --fix flag is an alias for the --write flag. The biome rust code didn't give any clues for my case (just a simple typescript file with code).

@bc-m
Copy link
Contributor

bc-m commented Oct 1, 2024

This issue is fixed with biome cli 1.9.3: biomejs/biome#4102

@sndpl
Copy link
Author

sndpl commented Oct 1, 2024

Thanks for the link @bc-m ! So think we can close this issue then, since it's a biome cli issue and not this plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants