-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
mix format
external formatter to be disabled
While I disagree with using a non-community-standard style, some users prefer it and having the settings allows the internal formatter settings to remain working. 1. Preferences 2. Editor > Code Style > Elixir 3. Click the `mix format` tab 4. Expand the General group 4. Uncheck "Format files with `mix format`".
- Loading branch information
1 parent
02f937e
commit 45fd95e
Showing
10 changed files
with
214 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/org/elixir_lang/formatter/settings/ElixirCodeStyleMainPanel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.elixir_lang.formatter.settings | ||
|
||
import com.intellij.application.options.TabbedLanguageCodeStylePanel | ||
import com.intellij.psi.codeStyle.CodeStyleSettings | ||
import org.elixir_lang.ElixirLanguage | ||
|
||
class ElixirCodeStyleMainPanel(currentSettings: CodeStyleSettings?, baseSettings: CodeStyleSettings) : | ||
TabbedLanguageCodeStylePanel(ElixirLanguage, currentSettings, baseSettings) { | ||
|
||
override fun initTabs(settings: CodeStyleSettings?) { | ||
addTab(MixFormatPanel(settings)) | ||
addIndentOptionsTab(settings) | ||
addSpacesTab(settings) | ||
addWrappingAndBracesTab(settings) | ||
// DO NOT have Blank Lines tab | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.elixir_lang.formatter.settings | ||
|
||
import com.intellij.application.options.codeStyle.OptionTreeWithPreviewPanel | ||
import com.intellij.lang.Language | ||
import com.intellij.openapi.fileTypes.FileType | ||
import com.intellij.openapi.util.NlsContexts.TabTitle | ||
import com.intellij.psi.codeStyle.CodeStyleSettings | ||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider | ||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType | ||
import org.elixir_lang.ElixirFileType | ||
import org.elixir_lang.ElixirLanguage | ||
|
||
// Based on [JavaDocFormattingPanel](https://github.com/JetBrains/intellij-community/blob/f3f09fc61977c612ac83ccba2233d0708745e12a/java/java-impl/src/com/intellij/application/options/JavaDocFormattingPanel.java) | ||
class MixFormatPanel(settings: CodeStyleSettings?) : OptionTreeWithPreviewPanel(settings) { | ||
init { | ||
init() | ||
} | ||
|
||
override fun getSettingsType(): SettingsType = SettingsType.LANGUAGE_SPECIFIC | ||
|
||
override fun initTables() { | ||
initCustomOptions("General") | ||
} | ||
|
||
override fun getRightMargin(): Int = 47 | ||
|
||
override fun getPreviewText(): String = LanguageCodeStyleSettingsProvider.forLanguage(ElixirLanguage)!! | ||
.getCodeSample(SettingsType.LANGUAGE_SPECIFIC)!! | ||
|
||
override fun getFileType(): FileType = ElixirFileType.INSTANCE | ||
|
||
override fun customizeSettings() { | ||
LanguageCodeStyleSettingsProvider.forLanguage(ElixirLanguage)!!.customizeSettings(this, settingsType) | ||
} | ||
|
||
override fun getTabTitle(): @TabTitle String = "mix format" | ||
override fun getDefaultLanguage(): Language = ElixirLanguage | ||
} |
Oops, something went wrong.