mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[intentions preview] ampersand escaping
GitOrigin-RevId: 5fb2f22152d2a6fdedac3bebe1ba93fb9929c4f1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9fcbaa4d7c
commit
107d6e49b5
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.daemon.impl.analysis;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
@@ -22,7 +8,6 @@ import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -45,6 +30,7 @@ public class XmlErrorQuickFixProvider implements ErrorQuickFixProvider {
|
||||
private static void registerXmlErrorQuickFix(final PsiErrorElement element, final HighlightInfo highlightInfo) {
|
||||
final String text = element.getErrorDescription();
|
||||
if (text.equals(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference"))) {
|
||||
final int textOffset = element.getTextOffset();
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, new IntentionAction() {
|
||||
@Override
|
||||
@NotNull
|
||||
@@ -66,9 +52,8 @@ public class XmlErrorQuickFixProvider implements ErrorQuickFixProvider {
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
PsiFile topLevelFile = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
|
||||
Document document = PsiDocumentManager.getInstance(project).getDocument(topLevelFile);
|
||||
Document document = topLevelFile.getViewProvider().getDocument();
|
||||
assert document != null;
|
||||
final int textOffset = element.getTextOffset();
|
||||
document.replaceString(textOffset, textOffset + 1, AMP_ENTITY);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user