Coder Social home page Coder Social logo

dprint-intellij's Introduction

dprint

CI Homebrew

Monorepo for dprint—a pluggable and configurable code formatting platform.

Links

Plugins

Notes

This repo is under active early development.

  1. The interface between the CLI and plugins might change often. You may need to keep updating to the latest version of both the CLI and plugins (the CLI will let you know what to do).
    • An upgrade path will be outlined in the release notes when this occurs.
  2. I do a lot of this development in my spare time. Please consider sponsoring if you are a commercial company using this.

dprint-intellij's People

Contributors

actions-user avatar dsherret avatar github-actions[bot] avatar ryan-rushton avatar upsuper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dprint-intellij's Issues

Cache whether a file is formattable

Since we are using the editor service to check whether a file is formattable in the new external formatting service we should cache the output so we only need to hit dprint once. That method is not supposed to be blocking and the fact we are communicating with the editor service is not something we should do but we do need to do it at least once.

In this we will also need to add an action so people can clear the cache if they are changing their config.

Exceptions occurred on invoking the intention 'Expand shorthand property' on a copy of the file.

Hi guys,

not quite sure how to reproduce it yet, but that's what I found in IDE Internal Error logs:

Exceptions occurred on invoking the intention 'Expand shorthand property' on a copy of the file.

java.lang.Throwable: Control-flow exceptions (e.g. this class com.intellij.model.SideEffectGuard$SideEffectNotAllowedException) should never be logged. Instead, these should have been rethrown or, if not possible, caught and ignored
	at com.intellij.openapi.diagnostic.Logger.ensureNotControlFlow(Logger.java:298)
	at com.intellij.idea.IdeaLogger.doLogError(IdeaLogger.java:151)
	at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:142)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:232)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.tryCreateDiffContent(IntentionPreviewComputable.kt:67)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.call(IntentionPreviewComputable.kt:39)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.call(IntentionPreviewComputable.kt:34)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:746)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:778)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:573)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:537)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1086)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:71)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:63)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:109)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:68)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:190)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:591)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:666)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:622)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:590)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:177)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:68)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:106)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:71)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:537)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:444)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: com.intellij.model.SideEffectGuard$SideEffectNotAllowedException: Side effect not allowed: INVOKE_LATER
	at com.intellij.model.SideEffectGuard.checkSideEffectAllowed(SideEffectGuard.java:34)
	at com.intellij.openapi.application.impl.LaterInvocator.invokeLater(LaterInvocator.java:80)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:338)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:327)
	at com.intellij.util.concurrency.QueueProcessor.startProcessing(QueueProcessor.java:225)
	at com.intellij.util.concurrency.QueueProcessor.doAdd(QueueProcessor.java:157)
	at com.intellij.util.concurrency.QueueProcessor.add(QueueProcessor.java:137)
	at com.intellij.openapi.progress.BackgroundTaskQueue.run(BackgroundTaskQueue.java:78)
	at com.intellij.openapi.progress.BackgroundTaskQueue.run(BackgroundTaskQueue.java:60)
	at com.dprint.services.editorservice.EditorServiceManager.createTaskWithTimeout(EditorServiceManager.kt:196)
	at com.dprint.services.editorservice.EditorServiceManager.createTaskWithTimeout(EditorServiceManager.kt:155)
	at com.dprint.services.editorservice.EditorServiceManager.primeCanFormatCache(EditorServiceManager.kt:142)
	at com.dprint.services.editorservice.EditorServiceManager.canFormatCached(EditorServiceManager.kt:128)
	at com.dprint.formatter.DprintExternalFormatter.canFormat(DprintExternalFormatter.kt:55)
	at com.intellij.formatting.service.FormattingServiceUtil.lambda$findService$0(FormattingServiceUtil.java:28)
	at com.intellij.util.containers.ContainerUtil.find(ContainerUtil.java:756)
	at com.intellij.util.containers.ContainerUtil.find(ContainerUtil.java:740)
	at com.intellij.formatting.service.FormattingServiceUtil.findService(FormattingServiceUtil.java:26)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect$ReformatRangesAction.execute(PostprocessReformattingAspect.java:774)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$doPostponedFormattingInner$7(PostprocessReformattingAspect.java:386)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.runWithDocCommentFormattingDisabled(CodeStyleManagerImpl.java:647)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.doPostponedFormattingInner(PostprocessReformattingAspect.java:385)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$doPostponedFormatting$5(PostprocessReformattingAspect.java:263)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$disablePostprocessFormattingInside$1(PostprocessReformattingAspect.java:122)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:130)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:121)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$doPostponedFormatting$6(PostprocessReformattingAspect.java:263)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:226)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:666)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:622)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:234)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:99)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:234)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:225)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.doPostponedFormatting(PostprocessReformattingAspect.java:261)
	at com.intellij.psi.impl.PsiDocumentManagerImpl.doPostponedOperationsAndUnblockDocument(PsiDocumentManagerImpl.java:161)
	at com.intellij.lang.javascript.refactoring.FormatFixer.fixFormat(FormatFixer.java:130)
	at com.intellij.lang.javascript.inspections.ES6ShorthandObjectPropertyInspection.transformProperty(ES6ShorthandObjectPropertyInspection.java:320)
	at com.intellij.lang.javascript.inspections.ES6ShorthandObjectPropertyInspection$ExpandShorthandQuickFix.invoke(ES6ShorthandObjectPropertyInspection.java:234)
	at com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:100)
	at com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:90)
	at com.intellij.codeInspection.LocalQuickFixOnPsiElement.applyFix(LocalQuickFixOnPsiElement.java:22)
	at com.intellij.codeInspection.LocalQuickFix.generatePreview(LocalQuickFix.java:99)
	at com.intellij.codeInspection.ex.QuickFixWrapper.generatePreview(QuickFixWrapper.java:135)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.generatePreview(IntentionActionWithTextCaching.java:241)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda-3$lambda-2(IntentionPreviewComputable.kt:146)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.lambda$postponeFormattingInside$2(PostprocessReformattingAspect.java:140)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:148)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:139)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda-3(IntentionPreviewComputable.kt:146)
	at com.intellij.codeInsight.intention.preview.IntentionPreviewUtils.previewSession(IntentionPreviewUtils.java:94)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview(IntentionPreviewComputable.kt:144)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.generatePreview(IntentionPreviewComputable.kt:103)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.tryCreateDiffContent$lambda-1(IntentionPreviewComputable.kt:61)
	at com.intellij.model.SideEffectGuard.computeWithAllowedSideEffects(SideEffectGuard.java:25)
	at com.intellij.model.SideEffectGuard.computeWithoutSideEffects(SideEffectGuard.java:18)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.tryCreateDiffContent(IntentionPreviewComputable.kt:61)
	... 31 more

It looks like dprint auto reformat on save is not working on WSL

Hello,

I'm using the latest version of the plugin and when I'm on WSL, the autosave is not working.
But it's working good on my Mac.

Configuration files seems to be here, but I'm not sure how to get log from the daemon.

hexa-node/.idea on  main [!?] on   (eu-central-1)
❯ bat dprintProjectConfig.xml
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: dprintProjectConfig.xml
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ <?xml version="1.0" encoding="UTF-8"?>
   2   │ <project version="4">
   3   │   <component name="DprintProjectConfiguration">
   4   │     <option name="enabled" value="true" />
   5   │   </component>
   6   │ </project>
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────

hexa-node/.idea on  main [!?] on   (eu-central-1)
❯ bat dprintUserConfig.xml
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: dprintUserConfig.xml
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ <?xml version="1.0" encoding="UTF-8"?>
   2   │ <project version="4">
   3   │   <component name="DprintUserConfiguration">
   4   │     <option name="runOnSave" value="true" />
   5   │   </component>
   6   │ </project>
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────

hexa-node/.idea on  main [!?] on   (eu-central-1)
❯

Could you look at it a bit?
Regards

Need more detailed usage instructions and plugin description

Thank you for submitting your plugin.

Please provide a more detailed plugin description and usage instructions. You can update it in the plugin.xml file and upload it to the Marketplace again.

We are looking forward to approving your plugin.

EditorServiceV4 locking up when two checks run concurrently.

It looks like the concurrent check issues are back potentially due to the heavily threaded nature of the plugin now.

Note the two can format checks in succession. I had to kill intellij to recover from this.

2022-05-24 17:08:30,663 [11324594]   INFO - #c.d.l.OnSaveListener - Running save action on /path-to-my-file.tsx
2022-05-24 17:08:30,669 [11324600]   INFO - #c.d.s.e.v.EditorServiceV4 - Checking if /path-to-my-file.tsx can be formatted.
2022-05-24 17:09:36,272 [11390203]   INFO - #c.d.s.e.v.EditorServiceV4 - Checking if /path-to-my-file.tsx can be formatted.
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:09:42,007 [11395938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.accessibilityHitTest(CAccessibility.java:407)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:09:44,008 [11397939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getAccessibleRole(CAccessibility.java:251)
2022-05-24 17:09:52,007 [11405938]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:09:52,007 [11405938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:09:52,007 [11405938]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:09:52,008 [11405939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:09:52,008 [11405939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:09:52,008 [11405939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.accessibilityHitTest(CAccessibility.java:407)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:09:54,002 [11407933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getAccessibleRole(CAccessibility.java:251)
2022-05-24 17:09:59,002 [11412933]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:09:59,003 [11412934]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:09:59,003 [11412934]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:09:59,003 [11412934]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:09:59,003 [11412934]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:09:59,003 [11412934]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.accessibilityHitTest(CAccessibility.java:407)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:01,005 [11414936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getAccessibleRole(CAccessibility.java:251)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:10,006 [11423937]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.accessibilityHitTest(CAccessibility.java:407)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:12,002 [11425933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getAccessibleRole(CAccessibility.java:251)
2022-05-24 17:10:15,001 [11428932]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:15,002 [11428933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:15,002 [11428933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:15,002 [11428933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:15,002 [11428933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:15,002 [11428933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.accessibilityHitTest(CAccessibility.java:407)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:17,002 [11430933]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getAccessibleRole(CAccessibility.java:251)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:23,008 [11436939]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getFocusOwner(CAccessibility.java:568)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - java.lang.Throwable: Invocation timed out (1sec)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:818)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:664)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:114)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.invokeAndWait(CAccessibility.java:108)
2022-05-24 17:10:25,005 [11438936]   INFO - STDERR - 	at java.desktop/sun.lwawt.macosx.CAccessibility.getFocusOwner(CAccessibility.java:568)
2022-05-24 17:10:39,170 [      3]   INFO - #c.i.i.StartupUtil - ------------------------------------------------------ IDE STARTED ------------------------------------------------------

Typescript imports appending to end of previous line rather than new line

Not sure if this is a configuration or plugin issue, but thought I'd log it just in case:

When I auto complete an import in a TypeScript file with dprint turned on it imports it to the end of the preceeding import, which breaks due to having semicolons set to never.

This causes a scenario the formatter cannot process / recover from.

Example

image

image

Executable error on Windows

I get a string of IDE errors when trying to use the plugin with WebStorm/PhpStorm on Windows.

I may be pointing the plugin at the incorrect executable, but so far I've tried the following:

  • node_modules/dprint/dprint.exe
  • node_modules/dprint/bin.js
  • node_modules/dprint/node_modules/.bin/dprint
  • node_modules/dprint/node_modules/.bin/dprint.CMD
  • node_modules/dprint/node_modules/.bin/dprint.ps1

Errors


Dprint config error
Unable to retrieve a valid dprint executable path.

Dprint config error
Could not find a dprint executable

Dprint config error
The configured dprint executable is invalid

Context

  • Installed via Node
  • Windows 11
  • PNPM (Local package manager)
  • Volta (Node version manager)

Additional Troubleshooting

I have removed all Node copies and installed via scoop as per the documentation instructions, and get this IDE error:
(note: I also got this error when using the .exe via Node)


java.nio.BufferUnderflowException
	at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:651)
	at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:402)
	at com.dprint.services.DprintService.readInt(DprintService.kt:202)
	at com.dprint.services.DprintService.canFormat(DprintService.kt:263)
	at com.dprint.services.FormatterService$format$1.invoke(FormatterService.kt:63)
	at com.dprint.services.FormatterService$format$1.invoke(FormatterService.kt:45)
	at com.dprint.services.FormatterService$executeUnderProgress$task$1.run(FormatterService.kt:143)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)


The plugin doesn't work when using the reformat action, pressing "Reload" fails with an error

Hi! I'm using the 0.3.5 version.

I have dprint enabled in the WebStorm settings, but it doesn't work when I trigger the "Reformat code" action (Cmd+Alt+L). It doesn't show any errors, it just does nothing when I press the hotkey combination.

If I enable "Run dprint formatter on save" though, it does reformat my code on save.

Also, I noticed this issue when pressing the reload button (maybe I should've created a separate one for it, but I guess I'll just leave it here for now):

Failed to read stdout of the editor service

java.nio.BufferUnderflowException
	at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:651)
	at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:402)
	at com.dprint.services.editorservice.EditorProcess.readInt(EditorProcess.kt:147)
	at com.dprint.services.editorservice.v5.StdoutListener.handleStdout(StdoutListener.kt:34)
	at com.dprint.services.editorservice.v5.StdoutListener.run(StdoutListener.kt:22)
	at com.dprint.services.editorservice.v5.EditorServiceV5$createStdoutListener$1.invoke(EditorServiceV5.kt:33)
	at com.dprint.services.editorservice.v5.EditorServiceV5$createStdoutListener$1.invoke(EditorServiceV5.kt:32)
	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

I hope this helps, but let me know if there are any logs or debug info I can fetch as well.

Thank you for maintaining this project!

Let user choose between project and user config

I am in the process of making the plugin more configurable in the spirit of dprint being highly configurable. I think it would be best if we also let the user choose between "user" and "project" config for settings. That way a user can have full control over what is checked into their VCS and what isn't.

Does not work in Rider

I haven't managed to get the dprint plugin to work in Rider. It works in IDEA without any problems.

In Rider, unlike in IDEA, I have to specify the dprint executable manually. That's fine.

When I change a file by introducing some unwanted whitespace changes and then save, I get:

2023 08 28 08:01:51:  Initialising editor service
2023 08 28 08:01:52:  Received editor info: {"schemaVersion":5,"cliVersion":"0.40.2","configSchemaUrl":"https://dprint.dev/schemas/v0.json","plugins":[]}

2023 08 28 08:01:52:  Received schema version 5
2023 08 28 08:01:52:  Initializing EditorServiceV5
2023 08 28 08:01:52:  Clearing message 16
2023 08 28 08:01:52:  Clearing message 17
2023 08 28 08:01:52:  Clearing message 14
2023 08 28 08:01:52:  Starting editor service with executable C:\kod\Customer\Product\node_modules\dprint\dprint.exe, config C:\kod\Customer\Product\dprint.json and working directory C:\kod\Customer\Product.
2023 08 28 08:01:52:  Priming can format cache for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:52:  Checking if C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs can be formatted.
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugin-cache-manifest.json
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating directory: C:\Users\perro\AppData\Local\dprint\cache\locks
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\kod\Customer\Product\dprint.json
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-typescript\0.86.2-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-json\0.17.4-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Reading file: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-vue\0.5.0-4.0.0-x86_64
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Checking path exists: C:\Users\perro\AppData\Local\dprint\cache\plugins\dprint-plugin-roslyn\0.16.0\x86_64\dprint-plugin-roslyn.exe
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-typescript
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-vue
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Creating instance of dprint-plugin-roslyn
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-json in 6ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-typescript in 8ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Created instance of dprint-plugin-roslyn in 76ms
2023 08 28 08:01:52:  Dprint daemon 49540: [VERBOSE] Checking can format: C:\kod\Customer\Product\src\Suite\Model.Product\Model\Item\Item.Nullable.cs
2023 08 28 08:01:52:  C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs can be formatted
2023 08 28 08:01:58:  Running save action on C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs.
2023 08 28 08:01:58:  Running save action on C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs.
2023 08 28 08:01:58:  Creating formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Created formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs with id 19
2023 08 28 08:01:58:  Dprint daemon 49540: [VERBOSE] Host formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs - File length: 1582 - Plugins: [dprint-plugin-roslyn] - Range: None
2023 08 28 08:01:58:  Creating formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs
2023 08 28 08:01:58:  Created formatting task for C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs with id 20
2023 08 28 08:01:58:  Dprint daemon 49540: [VERBOSE] Host formatting C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs - File length: 1582 - Plugins: [dprint-plugin-roslyn] - Range: None
2023 08 28 08:01:58:  Successfully formatted C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs

Note how it says "Successfully formatted C:/kod/Customer/Product/src/Suite/Model.Product/Model/Item/Item.Nullable.cs". However, the file does not change at all.

If I run npx dprint fmt src/Suite/Model.Product/Model/Item/Item.Nullable.cs, the file gets formatted.

This is my dprint config:

{
  "lineWidth": 120,
  "indentWidth": 4,
  "useTabs": false,
  "newLineKind": "auto",
  "typescript": {
    "semiColons": "asi",
    "quoteProps": "consistent",
    "parameters.trailingCommas": "never",
    "arguments.trailingCommas": "never",
    "exportDeclaration.trailingCommas": "never",
    "typeLiteral.separatorKind.singleLine": "comma"
  },
  "json": {
    "lineWidth": 80
  },
  "vue": {
  },
  "roslyn": {
    "csharp.spaceAfterCast": true,
    "csharp.wrappingKeepStatementsOnSingleLine": false
  },
  "includes": [
    ...other paths...,
    "**/src/Suite/Model.Product/**/*.cs"
  ],
  "excludes": [
    ...other paths...,
    "**/obj/**",
    "**/bin/**"
  ],
  "plugins": [
    "https://plugins.dprint.dev/typescript-0.86.2.wasm",
    "https://plugins.dprint.dev/json-0.17.4.wasm",
    "https://plugins.dprint.dev/malobre/vue-v0.5.0.wasm",
    "https://plugins.dprint.dev/roslyn-0.16.0.json@a508b0823fa356a33b43fc071e1cebe4a9c9ded12ca2f84c46ba67e2a3f13487"
  ]
}

I'm using Rider 2023.1.1, Build #RD-231.8770.54.

"Dprint cannot format no path" log spam

I happened to look at the Dprint logs in IntelliJ today (I was debugging a config issue), and noticed that this message is spammed a lot. Pretty much any interaction with IntelliJ (focusing the window, moving the cursor, etc.) triggers a cluster of these.

This code seems to be responsible for logging it, unfortunately it's not actually clear what "no path" is if it's not a valid virtual file. There is a comment above this code that indicates that scratch files (and possibly other types of files?) are ignored, so maybe it's one of these?

Is this anything to be concerned about from a performance point of view? I'm not even sure whether this is logged if the dprint logging window is not active, so maybe just a question for my own curiosity.

2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.