File tree Expand file tree Collapse file tree 5 files changed +11
-14
lines changed Expand file tree Collapse file tree 5 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 558558 If a variable is declared in an EEx tag then it is actually missing its declaration and cannot be resolved, so ignore its usage.
559559* [ #3043 ] ( https://github.com/KronicDeth/intellij-elixir/pull/3043 ) - [ @KronicDeth ] ( https://github.com/KronicDeth )
560560 * Check if module is disposed when write action is run for ` syncLibraries ` .
561+ * [ #3044 ] ( https://github.com/KronicDeth/intellij-elixir/pull/3044 ) - [ @KronicDeth ] ( https://github.com/KronicDeth )
562+ * Only use Elixir SDK for ` mix format ` if it has an Erlang SDK.
561563
562564## v14.0.0
563565
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ <h1>v14.0.1</h1>
1616 If a variable is declared in an EEx tag then it is actually missing its declaration and cannot be resolved, so ignore its usage.
1717 </ li >
1818 < li > Check if module is disposed when write action is run for < code > syncLibraries</ code > .</ li >
19+ < li > Only use Elixir SDK for < code > mix format</ code > if it has an Erlang SDK.</ li >
1920 </ ul >
2021 </ li >
2122</ ul >
Original file line number Diff line number Diff line change @@ -31,9 +31,13 @@ object Elixir {
3131 }
3232
3333 fun elixirSdkToEnsuredErlangSdk (elixirSdk : Sdk ): Sdk =
34- elixirSdk.sdkAdditionalData?. let { it as SdkAdditionalData }?.ensureErlangSdk( )
34+ elixirSdkToErlangSdk(elixirSdk )
3535 ? : throw MissingErlangSdk (elixirSdk)
3636
37+ fun elixirSdkHasErlangSdk (elixirSdk : Sdk ): Boolean = elixirSdkToErlangSdk(elixirSdk) != null
38+ fun elixirSdkToErlangSdk (elixirSdk : Sdk ): Sdk ? =
39+ elixirSdk.sdkAdditionalData?.let { it as SdkAdditionalData }?.erlangSdk
40+
3741 /* *
3842 * Adds `-pa ebinDirectory` for those in the `elixirSdk` that aren't in the `erlangSdk`
3943 */
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import com.intellij.openapi.roots.ProjectRootManager
1212import com.intellij.openapi.util.TextRange
1313import com.intellij.psi.PsiFile
1414import com.intellij.psi.codeStyle.ExternalFormatProcessor
15+ import org.elixir_lang.Elixir.elixirSdkHasErlangSdk
1516import org.elixir_lang.Mix
1617import org.elixir_lang.code_style.CodeStyleSettings
1718import org.elixir_lang.psi.ElixirFile
@@ -42,7 +43,7 @@ class MixFormatExternalFormatProcessor : ExternalFormatProcessor {
4243
4344 application.executeOnPooledThread {
4445 workingDirectory(source)?.let { workingDirectory ->
45- mostSpecificSdk(source)?.let { sdk ->
46+ mostSpecificSdk(source)?.takeIf (::elixirSdkHasErlangSdk)?. let { sdk ->
4647 format(workingDirectory, sdk, document.text)?.let { formattedText ->
4748 application.invokeLater {
4849 if (source.isValid) {
@@ -94,7 +95,7 @@ class MixFormatExternalFormatProcessor : ExternalFormatProcessor {
9495 commandLine
9596 } catch (fileNotFoundException: FileNotFoundException ) {
9697 LOGGER .info(fileNotFoundException)
97-
98+
9899 null
99100 }
100101
Original file line number Diff line number Diff line change @@ -88,15 +88,4 @@ public Sdk getErlangSdk() {
8888 public void setErlangSdk (@ Nullable Sdk erlangSdk ) {
8989 this .erlangSdk = erlangSdk ;
9090 }
91-
92- @ NotNull
93- public Sdk ensureErlangSdk () throws MissingErlangSdk {
94- Sdk erlangSdk = getErlangSdk ();
95-
96- if (erlangSdk == null ) {
97- throw new MissingErlangSdk (elixirSdk );
98- }
99-
100- return erlangSdk ;
101- }
10291}
You can’t perform that action at this time.
0 commit comments