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

Added autocomplete for \documentclass. #731

Merged
merged 4 commits into from
Nov 6, 2018

Conversation

HannahSchellekens
Copy link
Member

@HannahSchellekens HannahSchellekens commented Oct 17, 2018

Resolves #725. Branched from refactor-texifyutil (see PR #726).

Additions

  • Added autocompletion for classes:
    • With default classes: article, IEEEtran, proc, report, book, slides, memoir, letter, beamer.
    • With custom classes defined with \ProvideClass in the source folders (not in the whole project). So you can have a mycls.cls in your (re)source folders with \ProvideClass{mycls} and it will show up in the autocomplete.

Fixes

  • Fixed IndexCommandsUtilBase modifying the input commands incorrectly: the \ prefix check was accidentally reversed.

Screenshots

image

@HannahSchellekens HannahSchellekens added the enhancement New feature or (non bug related) change to the program. label Oct 17, 2018
@HannahSchellekens HannahSchellekens added this to the b0.6.2 milestone Oct 17, 2018
@HannahSchellekens HannahSchellekens self-assigned this Oct 17, 2018
@HannahSchellekens HannahSchellekens changed the title 726 documentclass autocomplete Added autocomplete for \documentclass. Oct 17, 2018
@PHPirates
Copy link
Collaborator

On my side this PR definitely breaks something, i.e. when I check out PR #726 the refactored code works fine, but when I check this out then I get many errors, and the 'Project' view is broken.

java.lang.NoClassDefFoundError: Could not initialize class nl.rubensten.texifyidea.TexifyIcons
	at nl.rubensten.texifyidea.modules.LatexModuleType.getNodeIcon(LatexModuleType.kt:26)
	at com.intellij.openapi.module.ModuleType.getIcon(ModuleType.java:39)
	at com.intellij.psi.impl.JavaDirectoryIconProvider.getIcon(JavaDirectoryIconProvider.java:46)
	at com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode.setupIcon(PsiDirectoryNode.java:171)
	at com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode.updateImpl(PsiDirectoryNode.java:118)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.lambda$update$0(AbstractPsiBasedNode.java:151)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:915)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.update(AbstractPsiBasedNode.java:126)
	at com.intellij.ide.util.treeView.PresentableNodeDescriptor.getUpdatedPresentation(PresentableNodeDescriptor.java:88)
	at com.intellij.ide.util.treeView.PresentableNodeDescriptor.update(PresentableNodeDescriptor.java:41)
	at com.intellij.ui.tree.StructureTreeModel$Node.update(StructureTreeModel.java:280)
	at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:262)
	at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:256)
	at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:235)
	at com.intellij.ui.tree.StructureTreeModel.getNode(StructureTreeModel.java:139)
	at com.intellij.ui.tree.StructureTreeModel.isLeaf(StructureTreeModel.java:175)
	at com.intellij.ui.tree.AsyncTreeModel$CmdGetRoot.getNode(AsyncTreeModel.java:473)
	at com.intellij.ui.tree.AsyncTreeModel$ObsolescentCommand.get(AsyncTreeModel.java:442)
	at com.intellij.ui.tree.AsyncTreeModel$ObsolescentCommand.get(AsyncTreeModel.java:408)
	at com.intellij.util.concurrency.Command$Processor.lambda$process$1(Command.java:48)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1151)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:70)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:123)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:70)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:91)
	at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:121)
	at com.intellij.util.concurrency.Invoker.lambda$invokeLater$0(Invoker.java:77)
	at com.intellij.util.concurrency.Invoker$BackgroundThread.lambda$offer$0(Invoker.java:260)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:226)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$100(BoundedTaskExecutor.java:26)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2$1.run(BoundedTaskExecutor.java:199)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:229)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:193)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

update failed for AnAction(com.intellij.execution.actions.RunConfigurationsComboBoxAction) with ID=RunConfiguration

java.lang.NoClassDefFoundError: Could not initialize class nl.rubensten.texifyidea.TexifyIcons
	at nl.rubensten.texifyidea.run.BibtexRunConfigurationType.getIcon(BibtexRunConfigurationType.kt:15)
	at com.intellij.execution.configurations.ConfigurationFactory.getIcon(ConfigurationFactory.java:97)
	at com.intellij.execution.configurations.RunConfigurationBase.getIcon(RunConfigurationBase.java:96)
	at com.intellij.execution.impl.TimedIconCache.get(TimedIconCache.kt:39)
	at com.intellij.execution.impl.RunManagerImpl.getConfigurationIcon(RunManagerImpl.kt:841)
	at com.intellij.execution.RunManagerEx.getConfigurationIcon(RunManagerEx.java:57)
	at com.intellij.execution.actions.RunConfigurationsComboBoxAction.setConfigurationIcon(RunConfigurationsComboBoxAction.java:105)
	at com.intellij.execution.actions.RunConfigurationsComboBoxAction.updatePresentation(RunConfigurationsComboBoxAction.java:88)
	at com.intellij.execution.actions.RunConfigurationsComboBoxAction.update(RunConfigurationsComboBoxAction.java:59)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:136)
	at com.intellij.openapi.actionSystem.impl.Utils.doUpdate(Utils.java:256)
	at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:199)
	at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:225)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActionsImpl(ActionToolbarImpl.java:1100)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.access$000(ActionToolbarImpl.java:53)
	at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl$2.updateActionsImpl(ActionToolbarImpl.java:175)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater$MyUpdateRunnable.run(ToolbarUpdater.java:186)
	at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3078)
	at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:183)
	at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:190)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater.updateActions(ToolbarUpdater.java:108)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater.access$400(ToolbarUpdater.java:40)
	at com.intellij.openapi.actionSystem.impl.ToolbarUpdater$MyTimerListener.run(ToolbarUpdater.java:158)
	at com.intellij.openapi.actionSystem.impl.WeakTimerListener.run(WeakTimerListener.java:54)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.runListenerAction(ActionManagerImpl.java:1421)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.notifyListeners(ActionManagerImpl.java:1411)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.actionPerformed(ActionManagerImpl.java:1395)
	at javax.swing.Timer.fireActionPerformed(Timer.java:313)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:722)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

java.lang.NoClassDefFoundError: Could not initialize class nl.rubensten.texifyidea.TexifyIcons
	at nl.rubensten.texifyidea.file.LatexFileType.getIcon(LatexFileType.kt:18)
	at com.intellij.psi.impl.ElementBase.getBaseIcon(ElementBase.java:132)
	at com.intellij.psi.impl.ElementBase.computeBaseIcon(ElementBase.java:115)
	at com.intellij.psi.impl.ElementBase.lambda$computeIcon$1(ElementBase.java:93)
	at com.intellij.util.AstLoadingFilter.disableTreeLoading(AstLoadingFilter.java:126)
	at com.intellij.util.AstLoadingFilter.disableTreeLoading(AstLoadingFilter.java:115)
	at com.intellij.psi.impl.ElementBase.computeIcon(ElementBase.java:93)
	at com.intellij.psi.impl.ElementBase.getIcon(ElementBase.java:74)
	at com.intellij.ide.navigationToolbar.NavBarPresentation.lambda$getIcon$0(NavBarPresentation.java:79)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:945)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57)
	at com.intellij.ide.navigationToolbar.NavBarPresentation.getIcon(NavBarPresentation.java:79)
	at com.intellij.ide.navigationToolbar.NavBarItem.<init>(NavBarItem.java:52)
	at com.intellij.ide.navigationToolbar.NavBarUpdateQueue.rebuildUi(NavBarUpdateQueue.java:191)
	at com.intellij.ide.navigationToolbar.NavBarUpdateQueue$2.after(NavBarUpdateQueue.java:179)
	at com.intellij.ide.navigationToolbar.NavBarUpdateQueue$AfterModelUpdate.run(NavBarUpdateQueue.java:283)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:3099)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:288)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:405)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:330)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:371)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:722)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

@HannahSchellekens
Copy link
Member Author

Sorry to ping you @stenwessel :)

@HannahSchellekens HannahSchellekens merged commit b905339 into master Nov 6, 2018
@HannahSchellekens HannahSchellekens deleted the 726-documentclass-autocomplete branch November 6, 2018 21:55
@PHPirates
Copy link
Collaborator

@RubenSchellekens I still have the same errors, which are now also in master. Are you sure it's working for you? I tested on three different Windows systems (2x7 and 8.1) and all three had the same problems.

@HannahSchellekens
Copy link
Member Author

HannahSchellekens commented Nov 7, 2018

Yup. Works fine for me.

* Copyright (c) 2018 Ruben Schellekens
*/
public static final Icon DOT_CLASS = IconLoader.getIcon(
"/nl/rubensten/texifyidea/icons/dot-cls.png"
Copy link
Collaborator

@PHPirates PHPirates Nov 7, 2018

Choose a reason for hiding this comment

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

@RubenSchellekens Did you push this file? I can't find it anywhere, and especially not in the place it should be. It may be the reason why the plugin is broken for me (actually it's broken on any system but yours).

@HannahSchellekens
Copy link
Member Author

Indeed... Forgot to add the icon to git. Just did it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or (non bug related) change to the program.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentclass autocomplete
2 participants