Merge branch 'main' of https://github.com/spring-projects/sts4 into main
This commit is contained in:
@@ -10,7 +10,7 @@ Version: @QUALIFIER@\n\
|
||||
Build Id: @BUILD_ID@\n\
|
||||
Revision: @REVISION@\n\
|
||||
\n\
|
||||
Copyright (c) 2007 - 2024 Broadcom\n\
|
||||
Copyright (c) 2007 - 2025 Broadcom\n\
|
||||
All rights reserved. Visit https://spring.io/tools\n\
|
||||
\n\
|
||||
This product includes software developed by the\n\
|
||||
|
||||
@@ -8,7 +8,7 @@ Version: @QUALIFIER@\n\
|
||||
Build Id: @BUILD_ID@\n\
|
||||
Revision: @REVISION@\n\
|
||||
\n\
|
||||
Copyright (c) 2007 - 2024 Broadcom\n\
|
||||
Copyright (c) 2007 - 2025 Broadcom\n\
|
||||
All rights reserved. Visit https://spring.io/tools\n\
|
||||
\n\
|
||||
This product includes software developed by the\n\
|
||||
|
||||
@@ -4,7 +4,7 @@ This feature contains the Eclipse-UI-specific STS 4 components
|
||||
|
||||
# "copyright" property - text of the Copyright
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Spring Boot Language Server
|
||||
|
||||
# "copyright" property - text of the Copyright
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ BOSH Manifest Language Server
|
||||
|
||||
# "copyright" property - text of the Copyright
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ description=\
|
||||
This feature provides the language server to support editing cloud foundry manifest files
|
||||
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Integeation of the Cloud Foundry Manifest Language Server Extension into the Gen
|
||||
|
||||
# "copyright" property - text of the Copyright
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Concourse Pipeline and Task Language Server
|
||||
|
||||
# "copyright" property - text of the Copyright
|
||||
copyright=\
|
||||
Copyright (c) 2024 Broadcom
|
||||
Copyright (c) 2025 Broadcom
|
||||
|
||||
################ end of copyright property ####################################
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
@@ -25,7 +25,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -57,7 +56,6 @@ import org.springframework.ide.vscode.boot.index.cache.IndexCache;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchyAwareLookup;
|
||||
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.handlers.SymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache;
|
||||
@@ -747,42 +745,6 @@ public class SpringSymbolIndex implements InitializingBean, SpringIndex {
|
||||
}
|
||||
}
|
||||
|
||||
public List<SymbolAddOnInformation> getAllAdditionalInformation(Predicate<SymbolAddOnInformation> filter) {
|
||||
if (filter != null) {
|
||||
synchronized(symbols) {
|
||||
return symbols.stream()
|
||||
.map(s -> s.getAdditionalInformation())
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(i -> Arrays.stream(i))
|
||||
.filter(filter)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<? extends SymbolAddOnInformation> getAdditonalInformation(String docURI) {
|
||||
List<EnhancedSymbolInformation> info = this.symbolsByDoc.get(docURI);
|
||||
|
||||
if (info != null) {
|
||||
synchronized(info) {
|
||||
ImmutableList.Builder<SymbolAddOnInformation> builder = ImmutableList.builder();
|
||||
for (EnhancedSymbolInformation enhanced : info) {
|
||||
SymbolAddOnInformation[] additionalInformation = enhanced.getAdditionalInformation();
|
||||
if (additionalInformation != null) {
|
||||
builder.add(additionalInformation);
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<List<Bean>> beans(BeansParams params) {
|
||||
String projectName = params.getProjectName();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
@@ -34,7 +34,6 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
|
||||
@@ -52,9 +51,6 @@ import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
@@ -351,7 +347,6 @@ public class IndexCacheOnDisc implements IndexCache {
|
||||
|
||||
public static Gson createGson() {
|
||||
return new GsonBuilder()
|
||||
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
|
||||
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
|
||||
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
|
||||
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
|
||||
@@ -426,33 +421,6 @@ public class IndexCacheOnDisc implements IndexCache {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gson adapter to store subtype information for symbol addon informations
|
||||
*/
|
||||
private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject result = new JsonObject();
|
||||
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
|
||||
result.add("data", context.serialize(addonInfo));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject parsedObject = json.getAsJsonObject();
|
||||
String className = parsedObject.get("type").getAsString();
|
||||
JsonElement element = parsedObject.get("data");
|
||||
|
||||
try {
|
||||
return context.deserialize(element, Class.forName(className));
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gson adapter to store subtype information for beans
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
@@ -41,7 +41,6 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
|
||||
@@ -371,7 +370,6 @@ public class IndexCacheOnDiscDeltaBased implements IndexCache {
|
||||
public static Gson createGson() {
|
||||
return new GsonBuilder()
|
||||
.registerTypeAdapter(DeltaStorage.class, new DeltaStorageAdapter())
|
||||
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
|
||||
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
|
||||
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
|
||||
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
|
||||
@@ -637,30 +635,6 @@ public class IndexCacheOnDiscDeltaBased implements IndexCache {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject result = new JsonObject();
|
||||
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
|
||||
result.add("data", context.serialize(addonInfo));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject parsedObject = json.getAsJsonObject();
|
||||
String className = parsedObject.get("type").getAsString();
|
||||
JsonElement element = parsedObject.get("data");
|
||||
|
||||
try {
|
||||
return context.deserialize(element, Class.forName(className));
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class BeanJsonAdapter implements JsonDeserializer<Bean> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.core.dom.ASTNode;
|
||||
import org.eclipse.jdt.core.dom.Annotation;
|
||||
import org.eclipse.jdt.core.dom.Block;
|
||||
import org.eclipse.jdt.core.dom.IAnnotationBinding;
|
||||
import org.eclipse.jdt.core.dom.ITypeBinding;
|
||||
import org.eclipse.jdt.core.dom.MethodDeclaration;
|
||||
@@ -39,8 +40,8 @@ import org.springframework.ide.vscode.boot.java.requestmapping.WebfluxRouterSymb
|
||||
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.FunctionUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.SCAN_PASS;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.InjectionPoint;
|
||||
@@ -62,7 +63,6 @@ import reactor.util.function.Tuples;
|
||||
public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BeansSymbolProvider.class);
|
||||
|
||||
private static final String[] NAME_ATTRIBUTES = {"value", "name"};
|
||||
|
||||
@Override
|
||||
@@ -73,21 +73,23 @@ public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
if (parent == null || !(parent instanceof MethodDeclaration)) return;
|
||||
|
||||
MethodDeclaration method = (MethodDeclaration) parent;
|
||||
|
||||
if (isMethodAbstract(method)) return;
|
||||
|
||||
List<SpringIndexElement> childElements = new ArrayList<>();
|
||||
|
||||
boolean isWebfluxRouter = WebfluxRouterSymbolProvider.isWebfluxRouterBean(method);
|
||||
|
||||
// for webflux details, we need full method body ASTs
|
||||
if (isWebfluxRouter && SCAN_PASS.ONE.equals(context.getPass())) {
|
||||
context.getNextPassFiles().add(context.getFile());
|
||||
return;
|
||||
}
|
||||
|
||||
List<SpringIndexElement> childElements = new ArrayList<>();
|
||||
|
||||
if (isWebfluxRouter) {
|
||||
WebfluxRouterSymbolProvider.createWebfluxElements(method, context, doc, childElements);
|
||||
Block methodBody = method.getBody();
|
||||
if ((methodBody == null || methodBody.statements() == null || methodBody.statements().size() == 0)
|
||||
&& SCAN_PASS.ONE.equals(context.getPass())) {
|
||||
context.getNextPassFiles().add(context.getFile());
|
||||
return;
|
||||
}
|
||||
else {
|
||||
WebfluxRouterSymbolProvider.createWebfluxElements(method, context, doc, childElements);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFunction = isFunctionBean(method);
|
||||
@@ -103,8 +105,7 @@ public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
new WorkspaceSymbol(
|
||||
beanLabel(isFunction, nameAndRegion.getT1(), beanType.getName(), "@Bean" + markerString),
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(location)),
|
||||
null
|
||||
Either.forLeft(location))
|
||||
);
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(method, doc);
|
||||
@@ -142,7 +143,7 @@ public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
Either.forLeft(beanLocation));
|
||||
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(),
|
||||
new EnhancedSymbolInformation(symbol, null)));
|
||||
new EnhancedSymbolInformation(symbol)));
|
||||
|
||||
|
||||
ITypeBinding concreteBeanType = typeDeclaration.resolveBinding();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
@@ -62,7 +62,7 @@ public class ComponentSymbolProvider extends AbstractSymbolProvider {
|
||||
}
|
||||
else if (Annotations.NAMED_ANNOTATIONS.contains(annotationType.getQualifiedName())) {
|
||||
WorkspaceSymbol symbol = DefaultSymbolProvider.provideDefaultSymbol(node, doc);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class ComponentSymbolProvider extends AbstractSymbolProvider {
|
||||
|
||||
Bean beanDefinition = new Bean(beanName, beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, isConfiguration);
|
||||
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol), beanDefinition);
|
||||
}
|
||||
|
||||
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
@@ -97,7 +97,7 @@ public class FeignClientSymbolProvider extends AbstractSymbolProvider {
|
||||
|
||||
Bean beanDefinition = new Bean(beanName, beanType == null ? "" : beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, false);
|
||||
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol), beanDefinition);
|
||||
}
|
||||
|
||||
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -63,7 +63,7 @@ public class DataRepositorySymbolProvider extends AbstractSymbolProvider {
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(location));
|
||||
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(typeDeclaration, doc);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2022 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -18,21 +18,15 @@ import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
public class EnhancedSymbolInformation {
|
||||
|
||||
private final WorkspaceSymbol symbol;
|
||||
private final SymbolAddOnInformation[] additionalInformation;
|
||||
|
||||
public EnhancedSymbolInformation(WorkspaceSymbol symbol, SymbolAddOnInformation[] additionalInformation) {
|
||||
public EnhancedSymbolInformation(WorkspaceSymbol symbol) {
|
||||
this.symbol = symbol;
|
||||
this.additionalInformation = additionalInformation;
|
||||
}
|
||||
|
||||
public WorkspaceSymbol getSymbol() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public SymbolAddOnInformation[] getAdditionalInformation() {
|
||||
return additionalInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnhancedSymbolInformation [symbol=" + symbol + "]";
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 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
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.handlers;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public interface SymbolAddOnInformation {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
@@ -69,7 +69,7 @@ public class RequestMappingSymbolProvider extends AbstractSymbolProvider {
|
||||
.filter(Objects::nonNull).map(p -> {
|
||||
return combinePath(parent, p);
|
||||
}))
|
||||
.map(p -> RouteUtils.createRouteSymbol(location, p, methods, contentTypes, acceptTypes, null))
|
||||
.map(p -> RouteUtils.createRouteSymbol(location, p, methods, contentTypes, acceptTypes))
|
||||
.forEach((enhancedSymbol) -> context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol)));
|
||||
} catch (Exception e) {
|
||||
log.error("problem occured while scanning for request mapping symbols from " + doc.getUri(), e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -15,7 +15,6 @@ import org.eclipse.lsp4j.SymbolKind;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
@@ -23,7 +22,7 @@ import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
public class RouteUtils {
|
||||
|
||||
public static EnhancedSymbolInformation createRouteSymbol(Location location, String path,
|
||||
String[] httpMethods, String[] contentTypes, String[] acceptTypes, SymbolAddOnInformation[] enhancedInformation) {
|
||||
String[] httpMethods, String[] contentTypes, String[] acceptTypes) {
|
||||
|
||||
if (path != null && path.length() > 0) {
|
||||
String label = "@" + (path.startsWith("/") ? path : ("/" + path));
|
||||
@@ -35,7 +34,7 @@ public class RouteUtils {
|
||||
String contentType = WebfluxUtils.getStringRep(contentTypes, WebfluxUtils::getMediaType);
|
||||
label += contentType != null ? " - Content-Type: " + contentType : "";
|
||||
|
||||
return new EnhancedSymbolInformation(new WorkspaceSymbol(label, SymbolKind.Interface, Either.forLeft(location)), enhancedInformation);
|
||||
return new EnhancedSymbolInformation(new WorkspaceSymbol(label, SymbolKind.Interface, Either.forLeft(location)));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -132,7 +132,7 @@ public class WebfluxRouterSymbolProvider {
|
||||
if (elements != null) indexElementsCollector.add(elements);
|
||||
|
||||
EnhancedSymbolInformation enhancedSymbol = RouteUtils.createRouteSymbol(location, path, getElementStrings(httpMethods),
|
||||
getElementStrings(contentTypes), getElementStrings(acceptTypes), null);
|
||||
getElementStrings(contentTypes), getElementStrings(acceptTypes));
|
||||
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2023 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -39,7 +39,7 @@ public class RestrictedDefaultSymbolProvider extends AbstractSymbolProvider {
|
||||
// provide default symbol only in case this annotation is not combined with @Bean annotation
|
||||
if (!isCombinedWithAnnotation(node, Annotations.BEAN)) {
|
||||
try {
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(DefaultSymbolProvider.provideDefaultSymbol(node, doc), null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(DefaultSymbolProvider.provideDefaultSymbol(node, doc));
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
|
||||
} catch (Exception e) {
|
||||
log.warn(e.getMessage());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
@@ -58,7 +58,7 @@ public class SpringFactoriesIndexer implements SpringIndexer {
|
||||
|
||||
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
|
||||
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
|
||||
private static final String GENERATION = "GEN-7";
|
||||
private static final String GENERATION = "GEN-8";
|
||||
|
||||
private static final String FILE_PATTERN = "**/META-INF/spring/*.factories";
|
||||
|
||||
@@ -121,7 +121,7 @@ public class SpringFactoriesIndexer implements SpringIndexer {
|
||||
symbols.add(new EnhancedSymbolInformation(new WorkspaceSymbol(
|
||||
BeansSymbolProvider.beanLabel(false, beanId, fqName, Paths.get(URI.create(docURI)).getFileName().toString()),
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(new Location(docURI, range))), null));
|
||||
Either.forLeft(new Location(docURI, range)))));
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
@@ -93,7 +93,7 @@ public class SpringIndexerJava implements SpringIndexer {
|
||||
|
||||
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
|
||||
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
|
||||
private static final String GENERATION = "GEN-11";
|
||||
private static final String GENERATION = "GEN-12";
|
||||
private static final String INDEX_FILES_TASK_ID = "index-java-source-files-task-";
|
||||
|
||||
private static final String SYMBOL_KEY = "symbols";
|
||||
@@ -770,7 +770,7 @@ public class SpringIndexerJava implements SpringIndexer {
|
||||
} else {
|
||||
WorkspaceSymbol symbol = provideDefaultSymbol(node, context);
|
||||
if (symbol != null) {
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
@@ -54,7 +54,7 @@ public class SpringIndexerXML implements SpringIndexer {
|
||||
|
||||
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
|
||||
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
|
||||
private static final String GENERATION = "GEN-6";
|
||||
private static final String GENERATION = "GEN-7";
|
||||
|
||||
private static final String SYMBOL_KEY = "symbols";
|
||||
private static final String BEANS_KEY = "beans";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
@@ -92,7 +92,7 @@ public class SpringIndexerXMLNamespaceHandlerBeans implements SpringIndexerXMLNa
|
||||
}
|
||||
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("@+ '" + beanID + "' " + beanClass, SymbolKind.Interface, Either.forLeft(new Location(docURI, range)));
|
||||
EnhancedSymbolInformation fullSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation fullSymbol = new EnhancedSymbolInformation(symbol);
|
||||
|
||||
CachedSymbol cachedSymbol = new CachedSymbol(docURI, lastModified, fullSymbol);
|
||||
generatedSymbols.add(cachedSymbol);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
@@ -89,7 +89,7 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, ImmutableMultimap.of(
|
||||
@@ -107,7 +107,6 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
assertEquals("symbol1", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> dependencies = result.getRight();
|
||||
assertEquals(2, dependencies.keySet().size());
|
||||
@@ -133,7 +132,7 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, null, CachedSymbol.class);
|
||||
@@ -157,7 +156,7 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, ImmutableMultimap.of(
|
||||
@@ -268,17 +267,17 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
|
||||
List<CachedSymbol> generatedSymbols2 = new ArrayList<>();
|
||||
symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Interface, Either.forLeft(new Location(doc1URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols2.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, enhancedSymbol1));
|
||||
generatedSymbols2.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, enhancedSymbol2));
|
||||
@@ -305,7 +304,7 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
@@ -369,15 +368,15 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
|
||||
WorkspaceSymbol symbol3 = new WorkspaceSymbol("symbol3", SymbolKind.Field, Either.forLeft(new Location(doc3URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3, null);
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3);
|
||||
generatedSymbols.add(new CachedSymbol(doc3URI, timeFile3.toMillis(), enhancedSymbol3));
|
||||
|
||||
// store original version of the symbols to the cache
|
||||
@@ -388,17 +387,17 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
List<CachedSymbol> updatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol updatedSymbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol1 = new EnhancedSymbolInformation(updatedSymbol1, null);
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol1 = new EnhancedSymbolInformation(updatedSymbol1);
|
||||
|
||||
WorkspaceSymbol newSymbol1 = new WorkspaceSymbol("symbol1-new", SymbolKind.Interface, Either.forLeft(new Location(doc1URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation newEnhancedSymbol1 = new EnhancedSymbolInformation(newSymbol1, null);
|
||||
EnhancedSymbolInformation newEnhancedSymbol1 = new EnhancedSymbolInformation(newSymbol1);
|
||||
|
||||
updatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, updatedEnhancedSymbol1));
|
||||
updatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, newEnhancedSymbol1));
|
||||
assertTrue(file1.toFile().setLastModified(timeFile1.toMillis() + 2000));
|
||||
|
||||
WorkspaceSymbol updatedSymbol2 = new WorkspaceSymbol("symbol2-updated", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol2 = new EnhancedSymbolInformation(updatedSymbol2, null);
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol2 = new EnhancedSymbolInformation(updatedSymbol2);
|
||||
updatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis() + 3000, updatedEnhancedSymbol2));
|
||||
assertTrue(file2.toFile().setLastModified(timeFile2.toMillis() + 3000));
|
||||
|
||||
@@ -472,7 +471,7 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
@@ -533,14 +532,14 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
|
||||
List<CachedSymbol> generatedSymbols2 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Interface, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols2.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
|
||||
@@ -605,10 +604,10 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
@@ -629,7 +628,6 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
assertEquals("symbol2", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> cachedDependencies = result.getRight();
|
||||
assertEquals(ImmutableSet.of(), cachedDependencies.get(file1.toString()));
|
||||
@@ -667,16 +665,16 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
WorkspaceSymbol symbol3 = new WorkspaceSymbol("symbol3", SymbolKind.Field, Either.forLeft(new Location(doc3URI, new Range(new Position(20, 11), new Position(20, 30)))));
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3, null);
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3);
|
||||
|
||||
WorkspaceSymbol symbol4 = new WorkspaceSymbol("symbol4", SymbolKind.Field, Either.forLeft(new Location(doc4URI, new Range(new Position(4, 4), new Position(5, 5)))));
|
||||
EnhancedSymbolInformation enhancedSymbol4 = new EnhancedSymbolInformation(symbol4, null);
|
||||
EnhancedSymbolInformation enhancedSymbol4 = new EnhancedSymbolInformation(symbol4);
|
||||
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
@@ -701,12 +699,10 @@ public class IndexCacheOnDiscDeltaBasedTest {
|
||||
assertEquals("symbol2", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
assertEquals("symbol4", cachedSymbols[1].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[1].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc4URI, new Range(new Position(4, 4), new Position(5, 5))), cachedSymbols[1].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[1].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> cachedDependencies = result.getRight();
|
||||
assertEquals(ImmutableSet.of(), cachedDependencies.get(file1.toString()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2023 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
@@ -87,7 +87,7 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, ImmutableMultimap.of(
|
||||
@@ -105,7 +105,6 @@ public class IndexCacheOnDiscTest {
|
||||
assertEquals("symbol1", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> dependencies = result.getRight();
|
||||
assertEquals(2, dependencies.keySet().size());
|
||||
@@ -131,7 +130,7 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, null, CachedSymbol.class);
|
||||
@@ -155,7 +154,7 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
|
||||
generatedSymbols.add(new CachedSymbol("", timeFile1.toMillis(), enhancedSymbol));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols, ImmutableMultimap.of(
|
||||
@@ -266,17 +265,17 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
|
||||
List<CachedSymbol> generatedSymbols2 = new ArrayList<>();
|
||||
symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Interface, Either.forLeft(new Location(doc1URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols2.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, enhancedSymbol1));
|
||||
generatedSymbols2.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, enhancedSymbol2));
|
||||
@@ -315,15 +314,15 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
|
||||
WorkspaceSymbol symbol3 = new WorkspaceSymbol("symbol3", SymbolKind.Field, Either.forLeft(new Location(doc3URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3, null);
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3);
|
||||
generatedSymbols.add(new CachedSymbol(doc3URI, timeFile3.toMillis(), enhancedSymbol3));
|
||||
|
||||
// store original version of the symbols to the cache
|
||||
@@ -334,17 +333,17 @@ public class IndexCacheOnDiscTest {
|
||||
List<CachedSymbol> updatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol updatedSymbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol1 = new EnhancedSymbolInformation(updatedSymbol1, null);
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol1 = new EnhancedSymbolInformation(updatedSymbol1);
|
||||
|
||||
WorkspaceSymbol newSymbol1 = new WorkspaceSymbol("symbol1-new", SymbolKind.Interface, Either.forLeft(new Location(doc1URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation newEnhancedSymbol1 = new EnhancedSymbolInformation(newSymbol1, null);
|
||||
EnhancedSymbolInformation newEnhancedSymbol1 = new EnhancedSymbolInformation(newSymbol1);
|
||||
|
||||
updatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, updatedEnhancedSymbol1));
|
||||
updatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis() + 2000, newEnhancedSymbol1));
|
||||
assertTrue(file1.toFile().setLastModified(timeFile1.toMillis() + 2000));
|
||||
|
||||
WorkspaceSymbol updatedSymbol2 = new WorkspaceSymbol("symbol2-updated", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol2 = new EnhancedSymbolInformation(updatedSymbol2, null);
|
||||
EnhancedSymbolInformation updatedEnhancedSymbol2 = new EnhancedSymbolInformation(updatedSymbol2);
|
||||
updatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis() + 3000, updatedEnhancedSymbol2));
|
||||
assertTrue(file2.toFile().setLastModified(timeFile2.toMillis() + 3000));
|
||||
|
||||
@@ -418,7 +417,7 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location("docURI", new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
@@ -479,14 +478,14 @@ public class IndexCacheOnDiscTest {
|
||||
|
||||
List<CachedSymbol> generatedSymbols1 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
generatedSymbols1.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
|
||||
cache.store(CACHE_KEY_VERSION_1, files, generatedSymbols1, null, CachedSymbol.class);
|
||||
|
||||
List<CachedSymbol> generatedSymbols2 = new ArrayList<>();
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Interface, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 5), new Position(5, 10)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols2.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
|
||||
@@ -551,10 +550,10 @@ public class IndexCacheOnDiscTest {
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
@@ -575,7 +574,6 @@ public class IndexCacheOnDiscTest {
|
||||
assertEquals("symbol2", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> cachedDependencies = result.getRight();
|
||||
assertEquals(ImmutableSet.of(), cachedDependencies.get(file1.toString()));
|
||||
@@ -613,16 +611,16 @@ public class IndexCacheOnDiscTest {
|
||||
List<CachedSymbol> generatedSymbols = new ArrayList<>();
|
||||
|
||||
WorkspaceSymbol symbol1 = new WorkspaceSymbol("symbol1", SymbolKind.Field, Either.forLeft(new Location(doc1URI, new Range(new Position(3, 10), new Position(3, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1, null);
|
||||
EnhancedSymbolInformation enhancedSymbol1 = new EnhancedSymbolInformation(symbol1);
|
||||
|
||||
WorkspaceSymbol symbol2 = new WorkspaceSymbol("symbol2", SymbolKind.Field, Either.forLeft(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20)))));
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2, null);
|
||||
EnhancedSymbolInformation enhancedSymbol2 = new EnhancedSymbolInformation(symbol2);
|
||||
|
||||
WorkspaceSymbol symbol3 = new WorkspaceSymbol("symbol3", SymbolKind.Field, Either.forLeft(new Location(doc3URI, new Range(new Position(20, 11), new Position(20, 30)))));
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3, null);
|
||||
EnhancedSymbolInformation enhancedSymbol3 = new EnhancedSymbolInformation(symbol3);
|
||||
|
||||
WorkspaceSymbol symbol4 = new WorkspaceSymbol("symbol4", SymbolKind.Field, Either.forLeft(new Location(doc4URI, new Range(new Position(4, 4), new Position(5, 5)))));
|
||||
EnhancedSymbolInformation enhancedSymbol4 = new EnhancedSymbolInformation(symbol4, null);
|
||||
EnhancedSymbolInformation enhancedSymbol4 = new EnhancedSymbolInformation(symbol4);
|
||||
|
||||
generatedSymbols.add(new CachedSymbol(doc1URI, timeFile1.toMillis(), enhancedSymbol1));
|
||||
generatedSymbols.add(new CachedSymbol(doc2URI, timeFile2.toMillis(), enhancedSymbol2));
|
||||
@@ -647,12 +645,10 @@ public class IndexCacheOnDiscTest {
|
||||
assertEquals("symbol2", cachedSymbols[0].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[0].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc2URI, new Range(new Position(5, 10), new Position(5, 20))), cachedSymbols[0].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[0].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
assertEquals("symbol4", cachedSymbols[1].getEnhancedSymbol().getSymbol().getName());
|
||||
assertEquals(SymbolKind.Field, cachedSymbols[1].getEnhancedSymbol().getSymbol().getKind());
|
||||
assertEquals(new Location(doc4URI, new Range(new Position(4, 4), new Position(5, 5))), cachedSymbols[1].getEnhancedSymbol().getSymbol().getLocation().getLeft());
|
||||
assertNull(cachedSymbols[1].getEnhancedSymbol().getAdditionalInformation());
|
||||
|
||||
Multimap<String, String> cachedDependencies = result.getRight();
|
||||
assertEquals(ImmutableSet.of(), cachedDependencies.get(file1.toString()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
@@ -12,7 +12,6 @@ package org.springframework.ide.vscode.boot.java.beans.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2022 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2024, 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* Copyright (c) 2024, 2025 Broadcom, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023, 2024 VMware, Inc.
|
||||
* Copyright (c) 2023, 2025 VMware, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2025 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
|
||||
@@ -14,6 +14,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -21,6 +23,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -36,6 +39,7 @@ import org.springframework.ide.vscode.boot.java.requestmapping.WebfluxHandlerMet
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.InjectionPoint;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.SpringIndexElement;
|
||||
import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
@@ -284,6 +288,34 @@ public class WebFluxMappingSymbolProviderTest {
|
||||
assertEquals("org.test.PersonHandler3", handlerElement6.getHandlerClass());
|
||||
assertEquals("public Mono<org.springframework.web.reactive.function.server.ServerResponse> deletePerson(org.springframework.web.reactive.function.server.ServerRequest)", handlerElement6.getHandlerMethod());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdatedRouteInChangedDocument() throws Exception {
|
||||
// update document and update index
|
||||
String changedDocURI = directory.toPath().resolve("src/main/java/org/test/QuoteRouter.java").toUri().toString();
|
||||
|
||||
String newContent = FileUtils.readFileToString(new File(new URI(changedDocURI)), Charset.defaultCharset()).replace("/hello", "/hello-updated");
|
||||
CompletableFuture<Void> updateFuture = indexer.updateDocument(changedDocURI, newContent, "test triggered");
|
||||
updateFuture.get(5, TimeUnit.SECONDS);
|
||||
|
||||
Bean[] routeBeans = springIndex.getBeansWithName(project.getElementName(), "route");
|
||||
assertEquals(1, routeBeans.length);
|
||||
assertEquals("route", routeBeans[0].getName());
|
||||
|
||||
SpringIndexElement[] children = routeBeans[0].getChildren();
|
||||
assertEquals(8, children.length);
|
||||
|
||||
WebfluxHandlerMethodIndexElement handlerElement1 = getWebfluxIndexElements(children, "/hello-updated", "GET").get(0);
|
||||
assertEquals("/hello-updated", handlerElement1.getPath());
|
||||
assertEquals("[GET]", Arrays.toString(handlerElement1.getHttpMethods()));
|
||||
assertEquals(0, handlerElement1.getContentTypes().length);
|
||||
assertEquals("[TEXT_PLAIN]", Arrays.toString(handlerElement1.getAcceptTypes()));
|
||||
assertEquals("org.test.QuoteHandler", handlerElement1.getHandlerClass());
|
||||
assertEquals("public Mono<org.springframework.web.reactive.function.server.ServerResponse> hello(org.springframework.web.reactive.function.server.ServerRequest)", handlerElement1.getHandlerMethod());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean containsSymbol(List<? extends WorkspaceSymbol> symbols, String name, String uri, int startLine, int startCHaracter, int endLine, int endCharacter) {
|
||||
for (Iterator<? extends WorkspaceSymbol> iterator = symbols.iterator(); iterator.hasNext();) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom
|
||||
* Copyright (c) 2025 Broadcom
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2024 Broadcom, Inc.
|
||||
* Copyright (c) 2017, 2025 Broadcom, 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019, 2024 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2025 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
|
||||
|
||||
Reference in New Issue
Block a user