mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diagnostics for EA-64904
This commit is contained in:
@@ -30,6 +30,8 @@ import com.intellij.openapi.command.CommandAdapter;
|
||||
import com.intellij.openapi.command.CommandEvent;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Attachment;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
@@ -58,6 +60,7 @@ import java.util.Set;
|
||||
* @author Dennis.Ushakov
|
||||
*/
|
||||
public class XmlTagNameSynchronizer extends CommandAdapter implements ApplicationComponent {
|
||||
private static final Logger LOG = Logger.getInstance(XmlTagNameSynchronizer.class);
|
||||
private static final Set<String> SUPPORTED_LANGUAGES = ContainerUtil.set(HTMLLanguage.INSTANCE.getID(),
|
||||
XMLLanguage.INSTANCE.getID(),
|
||||
XHTMLLanguage.INSTANCE.getID(),
|
||||
@@ -265,12 +268,17 @@ public class XmlTagNameSynchronizer extends CommandAdapter implements Applicatio
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
for (int i = offset - 1; i >= Math.max(0, offset - 50); i--) {
|
||||
final char c = sequence.charAt(i);
|
||||
if (c == '<' || (c == '/' && i > 0 && sequence.charAt(i - 1) == '<')) {
|
||||
start = i + 1;
|
||||
break;
|
||||
try {
|
||||
final char c = sequence.charAt(i);
|
||||
if (c == '<' || (c == '/' && i > 0 && sequence.charAt(i - 1) == '<')) {
|
||||
start = i + 1;
|
||||
break;
|
||||
}
|
||||
if (!XmlUtil.isValidTagNameChar(c)) break;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
LOG.error("incorrect offset:" + i + ", initial: " + offset, new Attachment("document.txt", sequence.toString()));
|
||||
return null;
|
||||
}
|
||||
if (!XmlUtil.isValidTagNameChar(c)) break;
|
||||
}
|
||||
if (start < 0) return null;
|
||||
for (int i = offset; i < Math.min(document.getTextLength(), offset + 50); i++) {
|
||||
|
||||
Reference in New Issue
Block a user