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

Backend: Shared Live Templates for common structures #2463

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

Thunderblade73
Copy link
Contributor

@Thunderblade73 Thunderblade73 commented Sep 4, 2024

What

I have made few live templates for myself that make it quicker to write feature. So I thought might as well share them so others can as well benefit from them. Intellji does not support sharing live templates for a project nativly, that's why this plugin is needed (for convience, since you still could copy paste it into your ide settings): Live Templates Sharing.

Examples for live templates:

  • && -> § (Needs a tab use at the end, so && can still be written as normal)
  • Templates for all config elements, they are better than copy and pasting elements since the autofill as much as possible (for example: ConfigPosition does add the ConfigLink with correct class and you only have to add field name (and it even makes suggestion on them to make it easier)
  • Also some small convienece functions for feature classes them self, eg: quick event consumers, config refernce and a simple enabled fun

The importing via the plugin is not tested since I have the templates on all machines (due to settings sync)

Changelog Technical Details

  • Added common live templates. - Thunderblade73
    • These can be automatically imported via the plugin "Live Templates Sharing".

@hannibal002 hannibal002 added this to the Version 0.27 milestone Sep 7, 2024
@jani270 jani270 added the Soon This Pull Request will be merged within the next couple of betas label Sep 9, 2024
@hannibal002
Copy link
Owner

Auto-importing worked for me fine!
image

But I have gotten an IntelliJ error after using the IntelliJ action "Import Project Live Template". So I'm not sure if the successful import happened despite the error or if this happened independently of me executing this action.

Stack Trace
java.lang.Throwable: com.tseyler.livetemplates.sharing.LiveTemplatesSharingService <clinit> requests com.tseyler.livetemplates.sharing.LiveTemplatesSharingService instance. Class initialization must not depend on services. Consider using instance of the service on-demand instead.
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.intellij.serviceContainer.ComponentManagerImplKt.checkOutsideClassInitializer(ComponentManagerImpl.kt:1588)
at com.intellij.serviceContainer.ComponentManagerImplKt.getOrCreateInstanceBlocking(ComponentManagerImpl.kt:1557)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:746)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:690)
at com.tseyler.livetemplates.sharing.LiveTemplatesSharingService.<clinit>(LiveTemplatesSharingService.kt:14)
at com.tseyler.livetemplates.sharing.ImportProjectLiveTemplates.actionPerformed(ImportProjectLiveTemplates.kt:16)
at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.kt:345)
at com.intellij.ide.actions.GotoActionAction.lambda$performActionImpl$4(GotoActionAction.java:87)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.performWithActionCallbacks(ActionManagerImpl.kt:1175)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.kt:362)
at com.intellij.ide.actions.GotoActionAction.performActionImpl(GotoActionAction.java:86)
at com.intellij.ide.actions.GotoActionAction.lambda$performAction$2(GotoActionAction.java:66)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:229)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runIntendedWriteActionOnCurrentThread$lambda$1(AnyThreadWriteThreadingSupport.kt:184)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:84)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runIntendedWriteActionOnCurrentThread(AnyThreadWriteThreadingSupport.kt:183)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:836)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:424)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWithImplicitRead(AnyThreadWriteThreadingSupport.kt:122)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1162)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:78)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:119)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:696)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$16(IdeEventQueue.kt:590)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWithoutImplicitRead(AnyThreadWriteThreadingSupport.kt:117)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:590)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:73)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1$1.compute(IdeEventQueue.kt:357)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1$1.compute(IdeEventQueue.kt:356)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.invoke(IdeEventQueue.kt:356)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.invoke(IdeEventQueue.kt:351)
at com.intellij.ide.IdeEventQueueKt$performActivity$runnableWithWIL$1.invoke$lambda$0(IdeEventQueue.kt:1035)
at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:84)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:910)
at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
at com.intellij.ide.IdeEventQueueKt$performActivity$runnableWithWIL$1.invoke(IdeEventQueue.kt:1035)
at com.intellij.ide.IdeEventQueueKt$performActivity$runnableWithWIL$1.invoke(IdeEventQueue.kt:1035)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1036)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1036)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$10(IdeEventQueue.kt:351)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:397)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

@hannibal002 hannibal002 merged commit 91dee90 into hannibal002:beta Sep 23, 2024
5 checks passed
@github-actions github-actions bot removed the Soon This Pull Request will be merged within the next couple of betas label Sep 23, 2024
@hannibal002 hannibal002 changed the title Internal: Shared Live Templates for common structures Backend: Shared Live Templates for common structures Sep 25, 2024
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

Successfully merging this pull request may close these issues.

3 participants