use of com.jetbrains.python.documentation.PyDocumentationSettings in project intellij-community by JetBrains.
the class PyQuickDocTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
// the provider is stateless, can be reused, as in real life
myProvider = new PythonDocumentationProvider();
final PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
myFormat = documentationSettings.getFormat();
documentationSettings.setFormat(DocStringFormat.PLAIN);
}
use of com.jetbrains.python.documentation.PyDocumentationSettings in project intellij-community by JetBrains.
the class PySmartEnterTest method testDocRest.
public void testDocRest() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
boolean oldStubOnEnter = codeInsightSettings.JAVADOC_STUB_ON_ENTER;
codeInsightSettings.JAVADOC_STUB_ON_ENTER = true;
PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
documentationSettings.setFormat(DocStringFormat.REST);
try {
doTest();
} finally {
documentationSettings.setFormat(DocStringFormat.PLAIN);
codeInsightSettings.JAVADOC_STUB_ON_ENTER = oldStubOnEnter;
}
}
use of com.jetbrains.python.documentation.PyDocumentationSettings in project intellij-community by JetBrains.
the class PythonCompletionTest method testEpydocTags.
public void testEpydocTags() {
final PyDocumentationSettings settings = PyDocumentationSettings.getInstance(myFixture.getModule());
settings.setFormat(DocStringFormat.EPYTEXT);
try {
myFixture.configureByFile("epydocTags.py");
myFixture.completeBasic();
final List<String> lookupElementStrings = myFixture.getLookupElementStrings();
assertNotNull(lookupElementStrings);
assertTrue(lookupElementStrings.contains("@param"));
} finally {
settings.setFormat(DocStringFormat.PLAIN);
}
}
use of com.jetbrains.python.documentation.PyDocumentationSettings in project intellij-community by JetBrains.
the class PythonCompletionTest method testIdentifiersInPlainDocstring.
public void testIdentifiersInPlainDocstring() {
final PyDocumentationSettings settings = PyDocumentationSettings.getInstance(myFixture.getModule());
settings.setFormat(DocStringFormat.PLAIN);
myFixture.configureByFile("identifiersInPlainDocstring.py");
final LookupElement[] elements = myFixture.completeBasic();
assertNotNull(elements);
assertContainsElements(Lists.newArrayList(elements), LookupElementBuilder.create("bar").withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE));
}
use of com.jetbrains.python.documentation.PyDocumentationSettings in project intellij-community by JetBrains.
the class DocStringUtil method getConfiguredDocStringFormat.
/**
* @param anchor PSI element that will be used to retrieve docstring format from the containing file or the project module
* @return docstring format configured for file or module containing given anchor PSI element
* @see PyDocumentationSettings#getFormatForFile(PsiFile)
*/
@Nullable
public static DocStringFormat getConfiguredDocStringFormat(@NotNull PsiElement anchor) {
final Module module = getModuleForElement(anchor);
if (module == null) {
return null;
}
final PyDocumentationSettings settings = PyDocumentationSettings.getInstance(module);
return settings.getFormatForFile(anchor.getContainingFile());
}
Aggregations