Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -54,10 +54,10 @@
|
||||
|
||||
<dist.pathpostfix>nightly</dist.pathpostfix>
|
||||
<dist.path>${dist.type}/${dist.key}/${dist.project}/${dist.pathpostfix}</dist.path>
|
||||
<dist.dependencies-version-path>nightly</dist.dependencies-version-path>
|
||||
<dist.springboot-language-servers-pathpostfix>${dist.dependencies-version-path}</dist.springboot-language-servers-pathpostfix>
|
||||
<dist.springide-pathpostfix>${dist.dependencies-version-path}</dist.springide-pathpostfix>
|
||||
<dist.eclipse-integration-commons-version>${dist.dependencies-version-path}</dist.eclipse-integration-commons-version>
|
||||
|
||||
<eclipsecommons-p2-repo>http://dist.springsource.com/snapshot/TOOLS/eclipse-integration-commons/nightly</eclipsecommons-p2-repo>
|
||||
<springide-p2-repo>http://dist.springframework.org/snapshot/IDE/nightly</springide-p2-repo>
|
||||
<sts4-language-servers-p2-repo>http://dist.springsource.com/${dist.type}/TOOLS/sts4-language-server-integrations/${sts4-language-servers-version}</sts4-language-servers-p2-repo>
|
||||
|
||||
<tycho-version>0.26.0</tycho-version>
|
||||
<encoding>UTF-8</encoding>
|
||||
@@ -72,6 +72,8 @@
|
||||
<dist.path.repo>${dist.type}/TOOLS/sts4/nightly/${dist.target.major}</dist.path.repo>
|
||||
<dist.path.product>${dist.type}/STS4/nightly/dist/${dist.target.major}</dist.path.product>
|
||||
<skip.update-nightly-download-page>false</skip.update-nightly-download-page>
|
||||
|
||||
<sts4-language-servers-version>nightly</sts4-language-servers-version>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
@@ -82,6 +84,8 @@
|
||||
<dist.path.repo>${dist.type}/TOOLS/sts4/update/${unqualifiedVersion}.${p2.qualifier}/${dist.target.major}</dist.path.repo>
|
||||
<dist.path.product>${dist.type}/STS4/${unqualifiedVersion}.${p2.qualifier}/dist/${dist.target.major}</dist.path.product>
|
||||
<skip.update-nightly-download-page>true</skip.update-nightly-download-page>
|
||||
|
||||
<sts4-language-servers-version>today</sts4-language-servers-version> <!-- this should be overridden in the build with the concrete ls version to include-->
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
@@ -92,6 +96,8 @@
|
||||
<dist.path.repo>${dist.type}/TOOLS/sts4/update/${unqualifiedVersion}.${p2.qualifier}/${dist.target.major}</dist.path.repo>
|
||||
<dist.path.product>${dist.type}/STS4/${unqualifiedVersion}.${p2.qualifier}/dist/${dist.target.major}</dist.path.product>
|
||||
<skip.update-nightly-download-page>true</skip.update-nightly-download-page>
|
||||
|
||||
<sts4-language-servers-version>today</sts4-language-servers-version> <!-- this should be overridden in the build with the concrete ls version to include-->
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
@@ -213,25 +219,20 @@
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-boot-language-servers</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://dist.springsource.com/${dist.type}/TOOLS/sts4-language-servers/${dist.springboot-language-servers-pathpostfix}</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-boot-language-server-integrations</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://dist.springsource.com/${dist.type}/TOOLS/sts4-language-server-integrations/${dist.springboot-language-servers-pathpostfix}</url>
|
||||
<url>${sts4-language-servers-p2-repo}</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>springide</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://dist.springframework.org/${dist.type}/IDE/${dist.springide-pathpostfix}</url>
|
||||
<url>${springide-p2-repo}</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>eclipse-integration-commons</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://dist.springsource.com/${dist.type}/TOOLS/eclipse-integration-commons/${dist.eclipse-integration-commons-version}</url>
|
||||
<url>${eclipsecommons-p2-repo}</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>egit-github</id>
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.springframework.tooling.ls.eclipse.gotosymbol.dialogs;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
@@ -26,8 +27,11 @@ import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.StyledString;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.lsp4e.LSPEclipseUtils;
|
||||
import org.eclipse.lsp4e.outline.SymbolsLabelProvider;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.KeyAdapter;
|
||||
@@ -46,6 +50,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
|
||||
import org.springframework.tooling.ls.eclipse.gotosymbol.GotoSymbolPlugin;
|
||||
import org.springsource.ide.eclipse.commons.livexp.core.UIValueListener;
|
||||
import org.springsource.ide.eclipse.commons.livexp.ui.Disposable;
|
||||
import org.springsource.ide.eclipse.commons.livexp.ui.Stylers;
|
||||
import org.springsource.ide.eclipse.commons.livexp.ui.util.SwtConnect;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
@@ -78,7 +83,7 @@ public class GotoSymbolDialog extends PopupDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private static class GotoSymbolsLabelProvider extends SymbolsLabelProvider {
|
||||
private class GotoSymbolsLabelProvider extends SymbolsLabelProvider {
|
||||
@Override
|
||||
protected int getMaxSeverity(IResource resource, SymbolInformation symbolInformation)
|
||||
throws CoreException, BadLocationException {
|
||||
@@ -91,8 +96,25 @@ public class GotoSymbolDialog extends PopupDialog {
|
||||
}
|
||||
return maxSeverity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StyledString getStyledText(Object element) {
|
||||
StyledString s = super.getStyledText(element);
|
||||
if (element instanceof SymbolInformation) {
|
||||
Optional<String> workspacePath = GotoSymbolDialog.this
|
||||
.getWorkspaceLocation((SymbolInformation) element);
|
||||
if (workspacePath.isPresent()) {
|
||||
s.append(" -- [", Stylers.NULL);
|
||||
s.append(workspacePath.get(), Stylers.NULL);
|
||||
s.append("]", Stylers.NULL);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Point DEFAULT_SIZE = new Point(280, 300);
|
||||
|
||||
private GotoSymbolDialogModel model;
|
||||
private List<Disposable> disposables = new ArrayList<>();
|
||||
private ITextEditor fTextEditor;
|
||||
@@ -197,6 +219,21 @@ public class GotoSymbolDialog extends PopupDialog {
|
||||
list.addDoubleClickListener(e -> performOk(list));
|
||||
}
|
||||
|
||||
private Optional<String> getWorkspaceLocation(SymbolInformation symbolInformation) {
|
||||
String val = null;
|
||||
|
||||
if (!model.fromFileProvider(symbolInformation)) {
|
||||
Location location = symbolInformation.getLocation();
|
||||
|
||||
IResource targetResource = LSPEclipseUtils.findResourceFor(location.getUri());
|
||||
if (targetResource != null && targetResource.getFullPath() != null) {
|
||||
val = targetResource.getFullPath().toString();
|
||||
}
|
||||
}
|
||||
|
||||
return val != null ? Optional.of(val) : Optional.empty();
|
||||
}
|
||||
|
||||
private void performOk(TreeViewer list) {
|
||||
if (model.performOk(getTarget(list))) {
|
||||
close();
|
||||
@@ -289,20 +326,22 @@ public class GotoSymbolDialog extends PopupDialog {
|
||||
super.configureShell(shell);
|
||||
|
||||
Control control = fTextEditor.getAdapter(Control.class);
|
||||
Point dialogueSize = DEFAULT_SIZE;
|
||||
if (control != null) {
|
||||
//Set size relative to editor's size.
|
||||
Point size = new Point(control.getBounds().width/3, control.getBounds().height/2);
|
||||
shell.setSize(size);
|
||||
dialogueSize = computeDialogueSize(control);
|
||||
if (alignRight) {
|
||||
shell.setLocation(control.toDisplay(control.getBounds().width - shell.getSize().x, control.getLocation().y));
|
||||
} else {
|
||||
//centered on the editor
|
||||
shell.setLocation(control.toDisplay(control.getBounds().width/3, control.getBounds().height/4));
|
||||
shell.setLocation(control.toDisplay(control.getBounds().width/4, control.getBounds().height/4));
|
||||
}
|
||||
} else {
|
||||
// fallback
|
||||
shell.setSize(280, 300);
|
||||
}
|
||||
}
|
||||
shell.setSize(dialogueSize);
|
||||
}
|
||||
|
||||
protected Point computeDialogueSize(Control control) {
|
||||
return new Point(control.getBounds().width, control.getBounds().height/2);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
@@ -182,6 +182,14 @@ public class GotoSymbolDialogModel {
|
||||
public boolean performOk(SymbolInformation selection) {
|
||||
return this.okHandler.performOk(selection);
|
||||
}
|
||||
|
||||
public boolean fromFileProvider(SymbolInformation symbolInformation) {
|
||||
SymbolsProvider sp = currentSymbolsProvider.getValue();
|
||||
if (sp!=null) {
|
||||
return sp.fromFile(symbolInformation);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,4 +68,13 @@ public class InFileSymbolsProvider implements SymbolsProvider {
|
||||
public String getName() {
|
||||
return "Symbols in File";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fromFile(SymbolInformation symbol) {
|
||||
if (symbol != null && symbol.getLocation() != null) {
|
||||
String symbolUri = symbol.getLocation().getUri();
|
||||
return info.getFileUri().toString().equals(symbolUri);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ public class InWorkspaceSymbolsProvider implements SymbolsProvider {
|
||||
// really use this with a single language server anyways.
|
||||
WorkspaceSymbolParams params = new WorkspaceSymbolParams(query);
|
||||
|
||||
ImmutableList.Builder<SymbolInformation> allSymbols = ImmutableList.builder();
|
||||
Flux<SymbolInformation> symbols = Flux.fromIterable(this.languageServers)
|
||||
.flatMap(server -> Mono.fromFuture(server.getWorkspaceService().symbol(params))
|
||||
.timeout(TIMEOUT)
|
||||
@@ -108,4 +107,8 @@ public class InWorkspaceSymbolsProvider implements SymbolsProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fromFile(SymbolInformation symbol) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,11 @@ import org.eclipse.lsp4j.SymbolInformation;
|
||||
public interface SymbolsProvider {
|
||||
String getName();
|
||||
Collection<SymbolInformation> fetchFor(String query) throws Exception;
|
||||
/**
|
||||
* True if the symbol information is provided from a file provider (a file is the provider of the symbols). False otherwise
|
||||
* @param symbol
|
||||
* @return True if the symbol information is provided from a file provider (a file is the provider of the symbols). False otherwise
|
||||
|
||||
*/
|
||||
boolean fromFile(SymbolInformation symbol);
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site>
|
||||
<category-def name="Spring Tool Suite 4 Language Server Integrations for Eclipse" label="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category-def name="Spring Tools 4 Language Server Integrations for Eclipse" label="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
|
||||
<feature id="org.springframework.tooling.properties.ls.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<feature id="org.springframework.tooling.boot.java.ls.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.integration.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<feature id="org.springframework.tooling.bosh.ls.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<feature id="org.springframework.tooling.concourse.ls.feature">
|
||||
<category name="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<category-def name="deps" label="Dependencies"/>
|
||||
|
||||
@@ -12,14 +12,7 @@
|
||||
<packaging>eclipse-repository</packaging>
|
||||
|
||||
<properties>
|
||||
<dist.accessKey>${accessKey}</dist.accessKey>
|
||||
<dist.secretKey>${secretKey}</dist.secretKey>
|
||||
<dist.bucket>dist.springsource.com</dist.bucket>
|
||||
<dist.type>snapshot</dist.type>
|
||||
<dist.key>TOOLS</dist.key>
|
||||
<dist.project>sts4-language-server-integrations</dist.project>
|
||||
<dist.pathpostfix>nightly</dist.pathpostfix>
|
||||
<dist.path>${dist.type}/${dist.key}/${dist.project}/${dist.pathpostfix}</dist.path>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site>
|
||||
<category-def name="Spring Tooling Language Servers for Eclipse" label="Spring Tooling Language Servers for Eclipse"/>
|
||||
<category-def name="Spring Tools 4 Language Server Integrations for Eclipse" label="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
|
||||
<feature id="org.springframework.tooling.cloudfoundry.manifest.ls.feature">
|
||||
<category name="Spring Tooling Language Servers for Eclipse"/>
|
||||
<category name="Spring Tools 4 Language Server Integrations for Eclipse"/>
|
||||
</feature>
|
||||
|
||||
<category-def name="deps" label="Dependencies"/>
|
||||
|
||||
@@ -12,14 +12,7 @@
|
||||
<packaging>eclipse-repository</packaging>
|
||||
|
||||
<properties>
|
||||
<dist.accessKey>${accessKey}</dist.accessKey>
|
||||
<dist.secretKey>${secretKey}</dist.secretKey>
|
||||
<dist.bucket>dist.springsource.com</dist.bucket>
|
||||
<dist.type>snapshot</dist.type>
|
||||
<dist.key>TOOLS</dist.key>
|
||||
<dist.project>sts4-language-servers</dist.project>
|
||||
<dist.pathpostfix>nightly</dist.pathpostfix>
|
||||
<dist.path>${dist.type}/${dist.key}/${dist.project}/${dist.pathpostfix}</dist.path>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -68,9 +68,41 @@
|
||||
|
||||
<tycho-version>0.26.0</tycho-version>
|
||||
<encoding>UTF-8</encoding>
|
||||
|
||||
<dist.accessKey>${accessKey}</dist.accessKey>
|
||||
<dist.secretKey>${secretKey}</dist.secretKey>
|
||||
<dist.bucket>dist.springsource.com</dist.bucket>
|
||||
<dist.key>TOOLS</dist.key>
|
||||
<dist.path>${dist.type}/${dist.key}/${dist.project}/${dist.version}</dist.path>
|
||||
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>snapshot</id>
|
||||
<properties>
|
||||
<dist.type>snapshot</dist.type>
|
||||
<dist.version>nightly</dist.version>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>milestone</id>
|
||||
<properties>
|
||||
<dist.type>milestone</dist.type>
|
||||
<dist.version>today</dist.version> <!-- should be overridden when building with some timestamp like 20171114 -->
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<properties>
|
||||
<dist.type>release</dist.type>
|
||||
<dist.version>today</dist.version> <!-- should be overridden when building with some timestamp like 20171114 -->
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>e47</id>
|
||||
<properties>
|
||||
@@ -298,7 +330,7 @@
|
||||
<artifactId>tycho-packaging-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<format>yyyyMMddHHmm-'${p2.qualifier}'</format>
|
||||
<format>yyyyMMddHHmm</format>
|
||||
<archiveSite>true</archiveSite>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
|
||||
@@ -205,6 +205,9 @@ public class DelegatingCachedClasspath<T extends IClasspath> implements IClasspa
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
cachedData.set(new ClasspathData(null, Collections.emptySet(), Collections.emptySet(), null));
|
||||
if (cacheFile != null && cacheFile.exists()) {
|
||||
cacheFile.delete();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.nio.file.FileVisitOption;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -84,8 +85,8 @@ public class MavenProjectCacheTest {
|
||||
|
||||
Path cacheFolerPath = testProjectPath.resolve(IJavaProject.PROJECT_CACHE_FOLDER);
|
||||
if (cacheFolerPath.toFile().exists()) {
|
||||
Files.walk(cacheFolerPath, FileVisitOption.FOLLOW_LINKS).map(Path::toFile).forEach(File::delete);
|
||||
Files.delete(cacheFolerPath);
|
||||
Files.walk(cacheFolerPath, FileVisitOption.FOLLOW_LINKS).sorted(Comparator.reverseOrder()).map(Path::toFile)
|
||||
.forEach(File::delete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,5 +253,7 @@ public class MavenProjectCacheTest {
|
||||
}).get(10, TimeUnit.SECONDS);
|
||||
progressDone.set(false);
|
||||
verify(diagnosticService, times(1)).diagnosticEvent(any(ShowMessageException.class));
|
||||
assertTrue(project.getClasspath().getClasspathEntries().isEmpty());
|
||||
assertFalse(cacheFolder.resolve(DelegatingCachedClasspath.CLASSPATH_DATA_CACHE_FILE).toFile().exists());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user