intellij-elixir icon indicating copy to clipboard operation
intellij-elixir copied to clipboard

Plugin throws error over the "warn_missing" flag in mix deps, instead of silently ignoring it.

Open Storycrafter opened this issue 1 year ago • 5 comments

System

Plugin Version: 13.2.0 Application: IntelliJ IDEA Ultimate Edition (2022.2) Operating System: Windows 10 (10.0)

What I was doing

This is part of the edeliver module. The error is the plugin tripping over the "warn_missing" flag, instead of silently ignoring it.

Event

Message

Element

{:distillery, "~> 2.1.0", optional: true, warn_missing: false}

From: C:/Users/ZZZZZZZ/Projects/XXXXXXXXXXXXXXXXXXXXXX/deps_**/edeliver**_/mix.exs:39

Context

     env: []
   ]

  defp deps do
    [
      {:distillery, "~> 2.1.0", optional: true, warn_missing: false},
      {:meck, "~> 0.8.13", only: :test},
      {:earmark, "~> 1.0", only: :dev},
      {:ex_doc, "~> 0.19", only: :dev},
    ]
  end

From: C:/Users/ZZZZZZZ/Projects/XXXXXXXXXXXXXXXXXXXXXX/deps/edeliver/mix.exs:34-44

Element Class Name

org.elixir_lang.psi.impl.ElixirTupleImpl

Exception

Stacktrace

java.lang.Throwable: Don't know if Mix.Dep option `warn_missing` is important for determining location of dependency
java.lang.Throwable: Don't know if Mix.Dep option `warn_missing` is important for determining location of dependency
	at org.elixir_lang.errorreport.Logger.error(Logger.kt:45)
	at org.elixir_lang.mix.Dep$Companion.from(Dep.kt:55)
	at org.elixir_lang.mix.Deps.fromTuple(Deps.kt:61)
	at org.elixir_lang.mix.Deps.from(Deps.kt:18)
	at org.elixir_lang.mix.DepGathererKt$deps$2.invoke(DepGatherer.kt:140)
	at org.elixir_lang.mix.DepGathererKt$deps$2.invoke(DepGatherer.kt:140)
	at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
	at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:817)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808)
	at org.elixir_lang.mix.DepGathererKt.deps(DepGatherer.kt:140)
	at org.elixir_lang.mix.DepGathererKt.deps(DepGatherer.kt:42)
	at org.elixir_lang.mix.DepGathererKt.access$deps(DepGatherer.kt:1)
	at org.elixir_lang.mix.DepGatherer$visitElement$1.invoke(DepGatherer.kt:34)
	at org.elixir_lang.mix.DepGatherer$visitElement$1.invoke(DepGatherer.kt:33)
	at org.elixir_lang.mix.DepGathererKt.foldDepsDefinersWhile(DepGatherer.kt:62)
	at org.elixir_lang.mix.DepGathererKt.access$foldDepsDefinersWhile(DepGatherer.kt:1)
	at org.elixir_lang.mix.DepGatherer.visitElement(DepGatherer.kt:33)
	at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:273)
	at org.elixir_lang.psi.impl.ElixirUnmatchedUnqualifiedNoParenthesesCallImpl.accept(ElixirUnmatchedUnqualifiedNoParenthesesCallImpl.java:38)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:185)
	at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:754)
	at org.elixir_lang.mix.DepGatherer$visitFile$$inlined$runReadAction$1.compute(actions.kt:60)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:928)
	at org.elixir_lang.mix.DepGatherer.visitFile(DepGatherer.kt:142)
	at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:60)
	at org.elixir_lang.mix.watcher.Resolution$Companion$packagePsiFileToDepSet$1$1.compute(Resolution.kt:111)
	at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:39)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:227)
	at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28)
	at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
	at org.elixir_lang.mix.watcher.Resolution$Companion$packagePsiFileToDepSet$$inlined$runReadAction$1.compute(actions.kt:60)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:928)
	at org.elixir_lang.mix.watcher.Resolution$Companion.packagePsiFileToDepSet(Resolution.kt:122)
	at org.elixir_lang.mix.watcher.Resolution$Companion.packageVirtualFileToDepSet(Resolution.kt:97)
	at org.elixir_lang.mix.watcher.Resolution$Companion.rootVirtualFileToDepSet(Resolution.kt:80)
	at org.elixir_lang.mix.watcher.Resolution$Companion.resolution(Resolution.kt:38)
	at org.elixir_lang.mix.watcher.TransitiveResolution.transitiveResolution(TransitiveResolution.kt:17)
	at org.elixir_lang.mix.Watcher.syncLibraries(Watcher.kt:64)
	at org.elixir_lang.DepsWatcher.syncLibraries(DepsWatcher.kt:198)
	at org.elixir_lang.DepsWatcher.syncLibraries(DepsWatcher.kt:181)
	at org.elixir_lang.DepsWatcher.syncLibraries(DepsWatcher.kt:176)
	at org.elixir_lang.DepsWatcher$syncLibraries$2$2$1.run(DepsWatcher.kt:117)

Storycrafter avatar Sep 08 '22 20:09 Storycrafter

I'd like to work on this if possible, @KronicDeth . I haven't done Intellij plugin work before, but I'm confident I can figure it out quickly enough.

Storycrafter avatar Sep 20 '22 15:09 Storycrafter

@Storycrafter you just add "warn_missing" to this list in alphabetical order

https://github.com/KronicDeth/intellij-elixir/blob/b66c817d9755c4aa10587001f9a6115f8274c14a/src/org/elixir_lang/mix/Dep.kt#L49-L51

KronicDeth avatar Sep 20 '22 15:09 KronicDeth

Heh, yeah, that part was the easy part, I think (thanks for confirming). Now thinking about unit tests and testing is where I've got the real concern :)

Storycrafter avatar Sep 20 '22 15:09 Storycrafter

@Storycrafter I don’t write unit tests for most of the plugin. It’s too complicated or slow (during test runs) to setup. I would just manually test this in a repo with the problem and check it stopped the error in the debugger.

KronicDeth avatar Sep 20 '22 15:09 KronicDeth

I'll give it a shot and let you know how I get on.

Storycrafter avatar Sep 20 '22 16:09 Storycrafter