mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
more references highlighted as warnings rather than errors (PY-7253)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
*/
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class WeakFileReference extends FileReference implements PsiReferenceEx {
|
||||
public WeakFileReference(FileReferenceSet fileReferenceSet, TextRange range, int index, String text) {
|
||||
super(fileReferenceSet, range, index, text);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
|
||||
return HighlightSeverity.WARNING;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnresolvedDescription() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+6
-11
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.jetbrains.python.templateLanguages;
|
||||
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -26,10 +25,12 @@ import com.intellij.psi.ElementManipulators;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.*;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceHelper;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceHelperRegistrar;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileSystemItemUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.jetbrains.python.psi.PsiReferenceEx;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import com.jetbrains.python.psi.WeakFileReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -38,7 +39,7 @@ import java.util.Collection;
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class TemplateFileReference extends FileReference implements PsiReferenceEx {
|
||||
public class TemplateFileReference extends WeakFileReference {
|
||||
@NotNull private final FileReferenceSet myReferenceSet;
|
||||
|
||||
public TemplateFileReference(@NotNull FileReferenceSet fileReferenceSet, TextRange range, int index, String text) {
|
||||
@@ -46,12 +47,6 @@ public class TemplateFileReference extends FileReference implements PsiReference
|
||||
myReferenceSet = fileReferenceSet;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
|
||||
return HighlightSeverity.WARNING;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnresolvedDescription() {
|
||||
|
||||
Reference in New Issue
Block a user