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

Esy Support #239

Merged
merged 13 commits into from
May 6, 2020
Merged

Esy Support #239

merged 13 commits into from
May 6, 2020

Conversation

JohnPucciarelli
Copy link
Collaborator

@JohnPucciarelli JohnPucciarelli commented May 1, 2020

⚠️ Large PR Ahead ⚠️

Currently, the esy panel and commands are really just reusing the dune panel and calling dune commands within the esy sandbox environment.

This PR introduces EsyCompiler and a rewrite of EsyProcess, so that esy no longer relies on any dune component.

Notable Changes:

ORCompilerManager::getCompiler(VirtualFile editorFile)
This method first checks that a file is compilable (.ml, .mli, .re, .rei) and then traverses up the file-system, looking for a a project configuration file (dune, bsconfig.json, package.json) to determine what type of compiler should be invoked to process the file.

Esy Separated from Dune Facet
Esy has been removed from the dune facet configuration. Esy detection is now based on the presence of an esy package.json.

CompilerAction::doAction
This method was broken up into 2 private methods for clarity. One that attempts to compile the active file, if the active file is supported by the compilers. And another that compiles the directory if no active file is present or the active file is unsupported.

Remaining Tasks:

I would like to regression test this branch. Unfortunately, this will have to be done mostly manually. Any regressions will get a test created to prevent it in the future.

src/com/reason/Compiler.java Outdated Show resolved Hide resolved
@giraud
Copy link
Owner

giraud commented May 5, 2020

got

java.lang.Throwable: It's prohibited to access index during event dispatching
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.intellij.openapi.project.NoAccessDuringPsiEvents.checkCallContext(NoAccessDuringPsiEvents.java:39)
	at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:737)
	at com.intellij.util.indexing.FileBasedIndexImpl.processExceptions(FileBasedIndexImpl.java:908)
	at com.intellij.util.indexing.FileBasedIndexImpl.processValueIterator(FileBasedIndexImpl.java:984)
	at com.intellij.util.indexing.FileBasedIndexImpl.processValuesInScope(FileBasedIndexImpl.java:955)
	at com.intellij.util.indexing.FileBasedIndexImpl.processValues(FileBasedIndexImpl.java:852)
	at com.intellij.psi.search.FileNameIndexServiceImpl.getVirtualFilesByName(FileNameIndexServiceImpl.java:27)
	at com.intellij.psi.search.FilenameIndex.getVirtualFilesByName(FilenameIndex.java:51)
	at com.reason.ide.ORProjectManager.findFilesInProject(ORProjectManager.java:97)
	at com.reason.ide.ORProjectManager.lambda$findFilesInProject$1(ORProjectManager.java:90)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.reason.ide.ORProjectManager.findFilesInProject(ORProjectManager.java:92)
	at com.reason.ide.ORProjectManager.findDuneConfigurationFiles(ORProjectManager.java:63)
	at com.reason.ide.ORProjectManager.mapToParents(ORProjectManager.java:120)
	at com.reason.ide.ORProjectManager.findDuneContentRoots(ORProjectManager.java:81)
	at com.reason.ide.ORProjectManager.findFirstDuneContentRoot(ORProjectManager.java:106)
	at com.reason.dune.DuneProcess.getGeneralCommandLine(DuneProcess.java:111)
	at com.reason.dune.DuneProcess.recreate(DuneProcess.java:69)
	at com.reason.dune.DuneCompiler.run(DuneCompiler.java:97)
	at com.reason.dune.DuneCompiler.runDefault(DuneCompiler.java:90)
	at com.reason.ide.ORFileEditorListener$ORPropertyChangeListener.propertyChange(ORFileEditorListener.java:131)
	at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
	at com.intellij.openapi.fileEditor.impl.text.TextEditorImpl.firePropertyChange(TextEditorImpl.java:185)
	at com.intellij.openapi.fileEditor.impl.text.TextEditorComponent.updateModifiedProperty(TextEditorComponent.java:182)
	at com.intellij.openapi.fileEditor.impl.text.TextEditorComponent$MyVirtualFileListener.contentsChanged(TextEditorComponent.java:315)
	at com.intellij.openapi.vfs.newvfs.VirtualFileFilteringListener.contentsChanged(VirtualFileFilteringListener.java:55)
	at jdk.internal.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:130)
	at com.intellij.util.EventDispatcher.access$000(EventDispatcher.java:24)
	at com.intellij.util.EventDispatcher$1.invoke(EventDispatcher.java:88)
	at com.sun.proxy.$Proxy30.contentsChanged(Unknown Source)
	at com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter.fireAfter(BulkVirtualFileListenerAdapter.java:51)
	at com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter.after(BulkVirtualFileListenerAdapter.java:42)
	at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:513)
	at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:142)
	at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:438)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:398)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:388)
	at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:372)
	at com.intellij.util.messages.impl.MessageBusImpl.lambda$createTopicHandler$1(MessageBusImpl.java:241)
	at com.sun.proxy.$Proxy106.after(Unknown Source)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl$2.close(PersistentFSImpl.java:661)
	at com.intellij.openapi.vfs.VirtualFile.setBinaryContent(VirtualFile.java:547)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualFileImpl.setBinaryContent(VirtualFileImpl.java:166)
	at com.intellij.openapi.fileEditor.impl.LoadTextUtil.write(LoadTextUtil.java:405)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$doSaveDocumentInWriteAction$4(FileDocumentManagerImpl.java:452)
	at com.intellij.pom.core.impl.PomModelImpl.guardPsiModificationsIn(PomModelImpl.java:371)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.doSaveDocumentInWriteAction(FileDocumentManagerImpl.java:441)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$doSaveDocument$2(FileDocumentManagerImpl.java:403)
	at com.intellij.openapi.application.WriteAction.run(WriteAction.java:98)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.doSaveDocument(FileDocumentManagerImpl.java:403)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:323)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:301)
	at com.intellij.ide.actions.SaveAllAction.actionPerformed(SaveAllAction.kt:20)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:266)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:283)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:602)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:655)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:193)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:654)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:517)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:472)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:221)
	at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:828)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:773)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

@giraud giraud merged commit 9d4176b into master May 6, 2020
@giraud giraud deleted the pooch/esy-process branch May 6, 2020 11:45
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.

2 participants