mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-14977 PyCharm is not obeying my file specific code style for HTML
Django Templates do not have HTML as base language anymore. Instead, they use DjangoTemplateFormatter.getTemplateDataLanguage() which is much better. Indents are provided via EP DjangoFileIndentOptionsProvider.
This commit is contained in:
+2
-3
@@ -14,10 +14,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
public abstract class PythonTemplateLanguage extends Language implements TemplateLanguage {
|
||||
|
||||
|
||||
protected PythonTemplateLanguage(@Nullable final Language baseLanguage,
|
||||
@NotNull @NonNls final String ID,
|
||||
protected PythonTemplateLanguage(@NotNull @NonNls final String ID,
|
||||
@NotNull @NonNls final String... mimeTypes) {
|
||||
super(baseLanguage, ID, mimeTypes);
|
||||
super(null, ID, mimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -105,12 +105,7 @@ public class PyEditingTest extends PyTestCase {
|
||||
private void doTestBackspace(final String fileName, final LogicalPosition pos) {
|
||||
myFixture.configureByFile("/editing/" + fileName + ".before.py");
|
||||
myFixture.getEditor().getCaretModel().moveToLogicalPosition(pos);
|
||||
CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_BACKSPACE);
|
||||
}
|
||||
}, "", null);
|
||||
pressButton(IdeActions.ACTION_EDITOR_BACKSPACE);
|
||||
myFixture.checkResultByFile("/editing/" + fileName + ".after.py", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,7 @@ public class PyIndentTest extends PyTestCase {
|
||||
final String name = getTestName(false);
|
||||
|
||||
myFixture.configureByText(name + ".py", before);
|
||||
CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_ENTER);
|
||||
}
|
||||
}, "", null);
|
||||
pressButton(IdeActions.ACTION_EDITOR_ENTER);
|
||||
String s = myFixture.getFile().getText();
|
||||
myFixture.checkResult(after);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.find.findUsages.CustomUsageSearcher;
|
||||
import com.intellij.find.findUsages.FindUsagesOptions;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -356,5 +357,21 @@ public abstract class PyTestCase extends UsefulTestCase {
|
||||
final Joiner joiner = Joiner.on("\n");
|
||||
Assert.assertEquals(message, joiner.join(new TreeSet<String>(actual)), joiner.join(new TreeSet<String>(expected)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clicks certain button in document on caret position
|
||||
*
|
||||
* @param action what button to click (const from {@link IdeActions}) (btw, there should be some way to express it using annotations)
|
||||
* @see IdeActions
|
||||
*/
|
||||
protected final void pressButton(@NotNull final String action) {
|
||||
CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myFixture.performEditorAction(action);
|
||||
}
|
||||
}, "", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user