GH-1434: wrapped all remaining calls to getLiteralValue via ASTUtils to avoid threading issues
Fixes GH-1434
This commit is contained in:
@@ -29,6 +29,7 @@ import org.eclipse.jdt.core.dom.QualifiedName;
|
||||
import org.eclipse.jdt.core.dom.SimpleName;
|
||||
import org.eclipse.jdt.core.dom.StringLiteral;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
|
||||
@@ -235,8 +236,7 @@ public class AnnotationAttributeCompletionProcessor implements CompletionProvide
|
||||
List<?> expressions = arrayNode.expressions();
|
||||
for (Object expression : expressions) {
|
||||
if (expression instanceof StringLiteral) {
|
||||
StringLiteral stringExr = (StringLiteral) expression;
|
||||
String value = stringExr.getLiteralValue();
|
||||
String value = ASTUtils.getLiteralValue((StringLiteral) expression);
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DependsOnDefinitionProvider implements IJavaDefinitionProvider {
|
||||
Annotation a = (Annotation) parent;
|
||||
IAnnotationBinding binding = a.resolveAnnotationBinding();
|
||||
if (binding != null && binding.getAnnotationType() != null && Annotations.DEPENDS_ON.equals(binding.getAnnotationType().getQualifiedName())) {
|
||||
String beanName = valueNode.getLiteralValue();
|
||||
String beanName = ASTUtils.getLiteralValue(valueNode);
|
||||
|
||||
if (beanName != null && beanName.length() > 0) {
|
||||
return findBeansWithName(project, beanName);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class NamedDefinitionProvider implements IJavaDefinitionProvider {
|
||||
Annotation a = (Annotation) parent;
|
||||
IAnnotationBinding binding = a.resolveAnnotationBinding();
|
||||
if (binding != null && binding.getAnnotationType() != null && Annotations.NAMED_ANNOTATIONS.contains(binding.getAnnotationType().getQualifiedName())) {
|
||||
String beanName = valueNode.getLiteralValue();
|
||||
String beanName = ASTUtils.getLiteralValue(valueNode);
|
||||
|
||||
if (beanName != null && beanName.length() > 0) {
|
||||
return findBeansWithName(project, beanName);
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
|
||||
@@ -50,14 +51,14 @@ public class NamedReferencesProvider implements ReferenceProvider {
|
||||
// case: @Value("prefix<*>")
|
||||
if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
// case: @Value(value="prefix<*>")
|
||||
else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
|
||||
&& "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.eclipse.lsp4j.jsonrpc.CancelChecker;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
|
||||
@@ -48,20 +49,20 @@ public class ProfileReferencesProvider implements ReferenceProvider {
|
||||
// case: @Value("prefix<*>")
|
||||
if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
// case: @Value(value="prefix<*>")
|
||||
else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
|
||||
&& "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
// case: @Qualifier({"prefix<*>"})
|
||||
else if (node instanceof StringLiteral && node.getParent() instanceof ArrayInitializer) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class QualifierDefinitionProvider implements IJavaDefinitionProvider {
|
||||
Annotation a = (Annotation) parent;
|
||||
IAnnotationBinding binding = a.resolveAnnotationBinding();
|
||||
if (binding != null && binding.getAnnotationType() != null && Annotations.QUALIFIER.equals(binding.getAnnotationType().getQualifiedName())) {
|
||||
String beanName = valueNode.getLiteralValue();
|
||||
String beanName = ASTUtils.getLiteralValue(valueNode);
|
||||
|
||||
if (beanName != null && beanName.length() > 0) {
|
||||
return findBeansWithName(project, beanName);
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.lsp4j.jsonrpc.CancelChecker;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
|
||||
@@ -47,14 +48,14 @@ public class QualifierReferencesProvider implements ReferenceProvider {
|
||||
// case: @Value("prefix<*>")
|
||||
if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
// case: @Value(value="prefix<*>")
|
||||
else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
|
||||
&& "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
|
||||
if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
|
||||
return provideReferences(project, ((StringLiteral) node).getLiteralValue());
|
||||
return provideReferences(project, ASTUtils.getLiteralValue((StringLiteral) node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ResourceDefinitionProvider implements IJavaDefinitionProvider {
|
||||
if (binding != null && binding.getAnnotationType() != null
|
||||
&& (Annotations.RESOURCE_JAVAX.equals(binding.getAnnotationType().getQualifiedName())
|
||||
|| Annotations.RESOURCE_JAKARTA.equals(binding.getAnnotationType().getQualifiedName()))) {
|
||||
String beanName = valueNode.getLiteralValue();
|
||||
String beanName = ASTUtils.getLiteralValue(valueNode);
|
||||
|
||||
if (beanName != null && beanName.length() > 0) {
|
||||
return findBeansWithName(project, beanName);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ConditionalOnBeanDefinitionProvider implements IJavaDefinitionProvi
|
||||
}
|
||||
|
||||
private List<LocationLink> getDefinitions(IJavaProject project, StringLiteral valueNode) {
|
||||
String value = valueNode.getLiteralValue();
|
||||
String value = ASTUtils.getLiteralValue(valueNode);
|
||||
|
||||
if (value != null && value.length() > 0) {
|
||||
return getDefinitionsForValue(project, valueNode, value);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ConditionalOnPropertyCompletionProcessor implements AnnotationAttri
|
||||
if (valuePairName != null && "prefix".equals(valuePairName)
|
||||
&& valuePair.getValue() != null && valuePair.getValue() instanceof StringLiteral) {
|
||||
StringLiteral prefixLiteral = (StringLiteral) valuePair.getValue();
|
||||
String valuePairValue = prefixLiteral.getLiteralValue();
|
||||
String valuePairValue = ASTUtils.getLiteralValue(prefixLiteral);
|
||||
return valuePairValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
|
||||
import org.springframework.ide.vscode.boot.java.IJavaDefinitionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IClasspathUtil;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class ConditionalOnResourceDefinitionProvider implements IJavaDefinitionP
|
||||
if (n instanceof StringLiteral) {
|
||||
StringLiteral valueNode = (StringLiteral) n;
|
||||
|
||||
String literalValue = valueNode.getLiteralValue();
|
||||
String literalValue = ASTUtils.getLiteralValue(valueNode);
|
||||
if (literalValue != null) {
|
||||
if (literalValue.startsWith("classpath")) {
|
||||
return getDefinitionForClasspathResource(project, cu, valueNode, literalValue);
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationAttributeCompletionProposal;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationAttributeProposal;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IClasspathUtil;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
|
||||
@@ -143,7 +144,8 @@ public class ContextConfigurationProcessor implements CompletionProvider {
|
||||
int startOffset = offset - prefix.length();
|
||||
int endOffset = offset;
|
||||
|
||||
String unfilteredPrefix = node.getLiteralValue().substring(0, offset - (node.getStartPosition() + 1));
|
||||
String literalValue = ASTUtils.getLiteralValue(node);
|
||||
String unfilteredPrefix = literalValue.substring(0, offset - (node.getStartPosition() + 1));
|
||||
addClasspathResourceProposals(project, doc, startOffset, endOffset, unfilteredPrefix, false, completions);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.eclipse.jdt.core.dom.TextBlock;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.embedded.lang.EmbeddedLangAstUtils;
|
||||
import org.springframework.ide.vscode.boot.java.embedded.lang.EmbeddedLanguageSnippet;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
|
||||
public class JdtCronVisitorUtils {
|
||||
|
||||
@@ -48,7 +49,7 @@ public class JdtCronVisitorUtils {
|
||||
private static boolean isCronExpression(Expression e) {
|
||||
String value = null;
|
||||
if (e instanceof StringLiteral sl) {
|
||||
value = sl.getLiteralValue();
|
||||
value = ASTUtils.getLiteralValue(sl);
|
||||
} else if (e instanceof TextBlock tb) {
|
||||
value = tb.getLiteralValue();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.embedded.lang.EmbeddedLanguageSnippet;
|
||||
import org.springframework.ide.vscode.boot.java.spel.AnnotationParamSpelExtractor;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.java.SpringProjectUtil;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
@@ -298,7 +299,7 @@ public class CopilotCodeLensProvider implements CodeLensProvider {
|
||||
} else if (expression instanceof SimpleName) {
|
||||
return ((SimpleName) expression).getIdentifier();
|
||||
} else if (expression instanceof StringLiteral) {
|
||||
String literalValue = ((StringLiteral) expression).getLiteralValue();
|
||||
String literalValue = ASTUtils.getLiteralValue((StringLiteral) expression);
|
||||
StringBuilder pointcuts = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : pointcutMap.entrySet()) {
|
||||
if (literalValue.contains(entry.getKey())) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
|
||||
import org.eclipse.jdt.core.dom.StringLiteral;
|
||||
import org.openrewrite.marker.Range;
|
||||
import org.springframework.ide.vscode.boot.java.Boot2JavaProblemType;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.languageserver.quickfix.QuickfixRegistry;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
@@ -141,7 +142,7 @@ public class ImplicitWebAnnotationNamesReconciler implements JdtAstReconciler {
|
||||
}
|
||||
|
||||
if (value instanceof StringLiteral) {
|
||||
return ((StringLiteral) value).getLiteralValue();
|
||||
return ASTUtils.getLiteralValue((StringLiteral) value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -19,6 +19,7 @@ import org.eclipse.jdt.core.dom.IMethodBinding;
|
||||
import org.eclipse.jdt.core.dom.MethodInvocation;
|
||||
import org.eclipse.jdt.core.dom.StringLiteral;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.commons.util.BadLocationException;
|
||||
import org.springframework.ide.vscode.commons.util.text.TextDocument;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class WebfluxPathFinder extends ASTVisitor {
|
||||
StringLiteral stringLiteral = WebfluxUtils.extractStringLiteralArgument(node);
|
||||
if (stringLiteral != null) {
|
||||
Range range = doc.toRange(stringLiteral.getStartPosition(), stringLiteral.getLength());
|
||||
path.add(new WebfluxRouteElement(stringLiteral.getLiteralValue(), range));
|
||||
path.add(new WebfluxRouteElement(ASTUtils.getLiteralValue(stringLiteral), range));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2023 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.SCAN_PASS;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
|
||||
@@ -157,7 +158,7 @@ public class WebfluxRouterSymbolProvider extends AbstractSymbolProvider {
|
||||
StringLiteral stringLiteral = WebfluxUtils.extractStringLiteralArgument(methodInvocation);
|
||||
if (stringLiteral != null) {
|
||||
Range range = doc.toRange(stringLiteral.getStartPosition(), stringLiteral.getLength());
|
||||
return new WebfluxRouteElement(stringLiteral.getLiteralValue(), range);
|
||||
return new WebfluxRouteElement(ASTUtils.getLiteralValue(stringLiteral), range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2023 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -647,7 +647,7 @@ public class ASTUtils {
|
||||
private static AnnotationAttributeValue convertExpressionInto(Expression expression, TextDocument doc) throws BadLocationException {
|
||||
if (expression instanceof StringLiteral) {
|
||||
StringLiteral stringLiteral = (StringLiteral) expression;
|
||||
String literalValue = stringLiteral.getLiteralValue();
|
||||
String literalValue = ASTUtils.getLiteralValue(stringLiteral);
|
||||
|
||||
DocumentRegion region = ASTUtils.nodeRegion(doc, stringLiteral);
|
||||
Range range = doc.toRange(region);
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.jdt.core.dom.NormalAnnotation;
|
||||
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
|
||||
import org.eclipse.jdt.core.dom.StringLiteral;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
|
||||
public class PropertyExtractor {
|
||||
|
||||
@@ -40,27 +41,27 @@ public class PropertyExtractor {
|
||||
|
||||
Annotations.VALUE, (annotation, memberValuePair, stringLiteral) -> {
|
||||
if (annotation.isSingleMemberAnnotation()) {
|
||||
return extractPropertyKey(stringLiteral.getLiteralValue());
|
||||
return extractPropertyKey(ASTUtils.getLiteralValue(stringLiteral));
|
||||
} else if (annotation.isNormalAnnotation() && PARAM_VALUE.equals(memberValuePair.getName().getIdentifier())) {
|
||||
return extractPropertyKey(stringLiteral.getLiteralValue());
|
||||
return extractPropertyKey(ASTUtils.getLiteralValue(stringLiteral));
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
Annotations.CONDITIONAL_ON_PROPERTY, (annotation, memberValuePair, stringLiteral) -> {
|
||||
if (annotation.isSingleMemberAnnotation()) {
|
||||
return stringLiteral.getLiteralValue();
|
||||
return ASTUtils.getLiteralValue(stringLiteral);
|
||||
} else if (annotation.isNormalAnnotation()) {
|
||||
switch (memberValuePair.getName().getIdentifier()) {
|
||||
case PARAM_VALUE:
|
||||
return stringLiteral.getLiteralValue();
|
||||
return ASTUtils.getLiteralValue(stringLiteral);
|
||||
case PARAM_NAME:
|
||||
String prefix = extractAnnotationParameter(annotation, PARAM_PREFIX);
|
||||
String name = stringLiteral.getLiteralValue();
|
||||
String name = ASTUtils.getLiteralValue(stringLiteral);
|
||||
return prefix != null && !prefix.isBlank() ? prefix + "." + name : name;
|
||||
case PARAM_PREFIX:
|
||||
name = extractAnnotationParameter(annotation, PARAM_NAME);
|
||||
prefix = stringLiteral.getLiteralValue();
|
||||
prefix = ASTUtils.getLiteralValue(stringLiteral);
|
||||
return prefix != null && !prefix.isBlank() ? prefix + "." + name : name;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +122,7 @@ public class PropertyExtractor {
|
||||
}
|
||||
}
|
||||
if (value instanceof StringLiteral) {
|
||||
return ((StringLiteral) value).getLiteralValue();
|
||||
return ASTUtils.getLiteralValue((StringLiteral) value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationAttributeCompletionProposal;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationAttributeProposal;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.metadata.ProjectBasedPropertyIndexProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
|
||||
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
|
||||
@@ -195,7 +196,8 @@ public class ValueCompletionProcessor implements CompletionProvider {
|
||||
completions.add(proposal);
|
||||
}
|
||||
|
||||
String unfilteredPrefix = node.getLiteralValue().substring(0, offset - (node.getStartPosition() + 1));
|
||||
String literalValue = ASTUtils.getLiteralValue(node);
|
||||
String unfilteredPrefix = literalValue.substring(0, offset - (node.getStartPosition() + 1));
|
||||
addClasspathResourceProposals(project, doc, startOffset, endOffset, unfilteredPrefix, false, completions);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.eclipse.lsp4j.jsonrpc.CancelChecker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.IJavaDefinitionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.properties.BootPropertiesLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.commons.java.IClasspathUtil;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
@@ -54,7 +55,7 @@ public class ValueDefinitionProvider implements IJavaDefinitionProvider {
|
||||
if (n instanceof StringLiteral) {
|
||||
StringLiteral valueNode = (StringLiteral) n;
|
||||
|
||||
String literalValue = valueNode.getLiteralValue();
|
||||
String literalValue = ASTUtils.getLiteralValue(valueNode);
|
||||
if (literalValue != null) {
|
||||
if (literalValue.startsWith("classpath")) {
|
||||
return getDefinitionForClasspathResource(project, cu, valueNode, literalValue);
|
||||
|
||||
Reference in New Issue
Block a user