Java Code Examples for com.intellij.psi.codeStyle.CommonCodeStyleSettings#getIndentOptions()

The following examples show how to use com.intellij.psi.codeStyle.CommonCodeStyleSettings#getIndentOptions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockIndentOptions.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public CommonCodeStyleSettings.IndentOptions getIndentOptions(@Nonnull AbstractBlockWrapper block) {
  if (!myIndentOptions.isOverrideLanguageOptions()) {
    final Language language = block.getLanguage();
    if (language != null) {
      final CommonCodeStyleSettings commonSettings = mySettings.getCommonSettings(language);
      if (commonSettings != null) {
        final CommonCodeStyleSettings.IndentOptions result = commonSettings.getIndentOptions();
        if (result != null) {
          return result;
        }
      }
    }
  }
  return myIndentOptions;
}
 
Example 2
Source File: CsvLanguageCodeStyleSettingsProvider.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
    CommonCodeStyleSettings commonSettings = new CommonCodeStyleSettings(getLanguage());
    commonSettings.initIndentOptions();
    commonSettings.getIndentOptions().TAB_SIZE = 1;
    commonSettings.getIndentOptions().INDENT_SIZE = 1;
    commonSettings.getIndentOptions().USE_TAB_CHARACTER = true;
    commonSettings.getIndentOptions().SMART_TABS = false;
    commonSettings.getIndentOptions().KEEP_INDENTS_ON_EMPTY_LINES = true;
    commonSettings.WRAP_ON_TYPING = CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue;
    commonSettings.WRAP_LONG_LINES = false;
    commonSettings.RIGHT_MARGIN = Integer.MAX_VALUE;
    return commonSettings;
}
 
Example 3
Source File: CodeStyleManager.java    From editorconfig-jetbrains with MIT License 5 votes vote down vote up
private void applyCodeStyleSettings(final List<OutPair> outPairs, final CodeStyleSettings codeStyleSettings,
                                    final VirtualFile file) {
    // Apply indent options
    final String indentSize = Utils.configValueForKey(outPairs, indentSizeKey);
    final String tabWidth = Utils.configValueForKey(outPairs, tabWidthKey);
    final String indentStyle = Utils.configValueForKey(outPairs, indentStyleKey);
    final FileType fileType = file.getFileType();
    final Language language = fileType instanceof LanguageFileType ? ((LanguageFileType)fileType).getLanguage() :
        PlainTextLanguage.INSTANCE;
    final CommonCodeStyleSettings commonSettings = codeStyleSettings.getCommonSettings(language);
    final CommonCodeStyleSettings.IndentOptions indentOptions = commonSettings.getIndentOptions();
    applyIndentOptions(indentOptions, indentSize, tabWidth, indentStyle, file.getCanonicalPath());
}