当前位置: 首页>>代码示例>>Java>>正文


Java CodeStyleSettings.getRightMargin方法代码示例

本文整理汇总了Java中com.intellij.psi.codeStyle.CodeStyleSettings.getRightMargin方法的典型用法代码示例。如果您正苦于以下问题:Java CodeStyleSettings.getRightMargin方法的具体用法?Java CodeStyleSettings.getRightMargin怎么用?Java CodeStyleSettings.getRightMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.codeStyle.CodeStyleSettings的用法示例。


在下文中一共展示了CodeStyleSettings.getRightMargin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResultExceedsRightMargin

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void testResultExceedsRightMargin() {
  final CodeStyleSettings settings = getCodeStyleSettings();
  final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(PythonLanguage.getInstance());

  final int oldRightMargin = settings.getRightMargin(PythonLanguage.getInstance());
  final boolean oldWrapLongLines = commonSettings.WRAP_LONG_LINES;

  settings.setRightMargin(PythonLanguage.getInstance(), 80);
  commonSettings.WRAP_LONG_LINES = true;
  try {
    doTest();
  }
  finally {
    commonSettings.WRAP_LONG_LINES = oldWrapLongLines;
    settings.setRightMargin(PythonLanguage.getInstance(), oldRightMargin);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyInlineLocalTest.java

示例2: isBelowRightMargin

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
protected boolean isBelowRightMargin(Project project, int lineLength) {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
  return lineLength <= settings.getRightMargin(JavaLanguage.INSTANCE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JavaFoldingBuilder.java

示例3: collectInformation

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public State collectInformation(@NotNull PsiFile file) {
  VirtualFile vFile = file.getVirtualFile();
  if (vFile == null || vFile.getFileType() != PythonFileType.INSTANCE) {
    return null;
  }
  Sdk sdk = PythonSdkType.findLocalCPython(ModuleUtilCore.findModuleForPsiElement(file));
  if (sdk == null) {
    if (!myReportedMissingInterpreter) {
      myReportedMissingInterpreter = true;
      reportMissingInterpreter();
    }
    return null;
  }
  final String homePath = sdk.getHomePath();
  if (homePath == null) {
    if (!myReportedMissingInterpreter) {
      myReportedMissingInterpreter = true;
      LOG.info("Could not find home path for interpreter " + homePath);
    }
    return null;
  }
  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(file.getProject()).getInspectionProfile();
  final HighlightDisplayKey key = HighlightDisplayKey.find(PyPep8Inspection.INSPECTION_SHORT_NAME);
  if (!profile.isToolEnabled(key)) {
    return null;
  }
  final PyPep8Inspection inspection = (PyPep8Inspection)profile.getUnwrappedTool(PyPep8Inspection.KEY.toString(), file);
  final CodeStyleSettings currentSettings = CodeStyleSettingsManager.getInstance(file.getProject()).getCurrentSettings();

  final List<String> ignoredErrors = Lists.newArrayList(inspection.ignoredErrors);
  if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_AFTER_NUMBER_SIGN) {
    ignoredErrors.add("E262"); // Block comment should start with a space
    ignoredErrors.add("E265"); // Inline comment should start with a space
  }

  if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_BEFORE_NUMBER_SIGN) {
    ignoredErrors.add("E261"); // At least two spaces before inline comment
  }

  final int margin = currentSettings.getRightMargin(file.getLanguage());
  return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:Pep8ExternalAnnotator.java


注:本文中的com.intellij.psi.codeStyle.CodeStyleSettings.getRightMargin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。