Merge branch 'master' into jumpy-completions

This commit is contained in:
Kris De Volder
2018-06-13 12:02:56 -07:00
74 changed files with 542 additions and 284 deletions

View File

@@ -150,7 +150,7 @@ If you subsequently launch Atom from that same terminal the dynamic CA and linti
## Dev environment setup:
**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed
1. Clone the repository
2. Run `npm install`
2. Run `npm install && npm run build`
3. Execute `apm link .` from the folder above
5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reload`, select, press `Return`)
6. Open any `pipeline.yml` or `task.yml` file in Atom observe reconciling, content assist and other IDE features

View File

@@ -1,6 +1,6 @@
{
"name": "bosh-yaml",
"version": "0.3.0",
"version": "0.3.1",
"description": "Provides validation and content assist for various Bosh configuration files",
"repository": "https://github.com/spring-projects/atom-bosh",
"icon": "icon.png",

View File

@@ -46,7 +46,7 @@ read its detailed documentation.
## Dev environment setup:
**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed
1. Clone the repository
2. Run `npm install`
2. Run `npm install && npm run build`
3. Execute `apm link .` from the folder above
5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reaload`, select, press `Return`)
6. Open any `manifest.yml` file in Atom observe reconciling, content assist and other IDE features

View File

@@ -1,6 +1,6 @@
{
"name": "cf-manifest-yaml",
"version": "0.3.0",
"version": "0.3.1",
"description": "Cloud Foundry Deployment Manifest YAML support for Atom",
"repository": "https://github.com/spring-projects/atom-cf-manifest-yaml",
"icon": "icon.png",

View File

@@ -50,7 +50,7 @@ Resource Type declaration? The Atom Outline View (View -> Toggle Outline View) h
## Dev environment setup:
**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed
1. Clone the repository
2. Run `npm install`
2. Run `npm install && npm run build`
3. Execute `apm link .` from the folder above
5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reload`, select, press `Return`)
6. Open any `pipeline.yml` or `task.yml` file in Atom observe reconciling, content assist and other IDE features

View File

@@ -1,6 +1,6 @@
{
"name": "concourse-pipeline-yaml",
"version": "0.3.0",
"version": "0.3.1",
"description": "Provides validation and content assist for Concourse CI pipeline and task configuration yml files",
"repository": "https://github.com/spring-projects/atom-concourse",
"icon": "icon.png",

View File

@@ -23,7 +23,7 @@ For all other files containing boot properties select grammar to be `Spring-Boot
To build all these pieces you normally only need to run:
npm install
npm install && npm run build
Now you can link it to Atom:

View File

@@ -1,6 +1,6 @@
{
"name": "spring-boot",
"version": "0.3.0",
"version": "0.3.1",
"description": "Spring Boot support for Atom",
"repository": "https://github.com/spring-projects/atom-spring-boot",
"icon": "icon.png",
@@ -27,6 +27,7 @@
}
},
"dependencies": {
"atom-languageclient": "0.9.2",
"@pivotal-tools/atom-languageclient-commons": "0.0.5",
"atom-package-deps": "^4.6.0",
"download": "^6.2.5"

View File

@@ -1,5 +1,12 @@
# Development Notes
## Testing Release repo with Atom
1. Clone the release repository for Atom package 'X'
2. Navigate to `X` folder
3. Run `npm install` and nothing more
4. Run `apm link .`
5. Either start Atom or Reload Window in Atom
## Releasing Atom Extension
Before Atom package is released the RC language server `JAR` needs to be produced. Open [promote-fatjars-to-rc](https://ci.spring.io/teams/tools/pipelines/sts4-master/jobs/promote-fatjars-to-rc/builds/1) task in Concourse and kick off the build.

View File

@@ -204,38 +204,6 @@ resources:
secret_access_key: ((s3_prod_secretkey))
region_name: ((s3_prod_region))
regexp: release/STS4/fatjars/spring-boot-language-server-(.*).jar
- name: s3-manifest-yaml-atom-snapshot
type: s3
source:
bucket: ((s3_bucket))
access_key_id: ((s3_accesskey))
secret_access_key: ((s3_secretkey))
region_name: ((s3_region))
regexp: sts4/atom/snapshots/cf-manifest-yaml-(.*).tgz
- name: s3-concourse-atom-snapshot
type: s3
source:
bucket: ((s3_bucket))
access_key_id: ((s3_accesskey))
secret_access_key: ((s3_secretkey))
region_name: ((s3_region))
regexp: sts4/atom/snapshots/concourse-pipeline-yaml-(.*).tgz
- name: s3-bosh-atom-snapshot
type: s3
source:
bucket: ((s3_bucket))
access_key_id: ((s3_accesskey))
secret_access_key: ((s3_secretkey))
region_name: ((s3_region))
regexp: sts4/atom/snapshots/bosh-yaml-(.*).tgz
- name: s3-spring-boot-atom-snapshot
type: s3
source:
bucket: ((s3_bucket))
access_key_id: ((s3_accesskey))
secret_access_key: ((s3_secretkey))
region_name: ((s3_region))
regexp: sts4/atom/snapshots/spring-boot-(.*).tgz
- name: vscode-snapshot-website
type: s3-multi
source:
@@ -246,16 +214,16 @@ resources:
path: snapshot/STS4/vscode-extensions
options:
- "--acl public-read"
- name: atom-snapshot-website
type: s3-multi
source:
bucket: ((s3_prod_bucket))
access_key_id: ((s3_prod_accesskey))
secret_access_key: ((s3_prod_secretkey))
region_name: ((s3_region))
path: snapshot/STS4/atom-packages
options:
- "--acl public-read"
# - name: atom-snapshot-website
# type: s3-multi
# source:
# bucket: ((s3_prod_bucket))
# access_key_id: ((s3_prod_accesskey))
# secret_access_key: ((s3_prod_secretkey))
# region_name: ((s3_region))
# path: snapshot/STS4/atom-packages
# options:
# - "--acl public-read"
- name: slack-notification
type: slack-notification
source:
@@ -963,32 +931,32 @@ jobs:
- put: version
params:
file: version/version
- name: build-atom-snapshot-website
serial: true
plan:
- aggregate:
- get: sts4
- get: s3-bosh-atom-snapshot
trigger: true
passed:
- build-bosh-atom-package
- get: s3-manifest-yaml-atom-snapshot
trigger: true
passed:
- build-manifest-yaml-atom-package
- get: s3-concourse-atom-snapshot
trigger: true
passed:
- build-concourse-atom-package
- get: s3-spring-boot-atom-snapshot
trigger: true
passed:
- build-spring-boot-atom-package
- task: build-website
file: sts4/concourse/tasks/build-atom-website.yml
- put: atom-snapshot-website
params:
path: website
# - name: build-atom-snapshot-website
# serial: true
# plan:
# - aggregate:
# - get: sts4
# - get: s3-bosh-atom-snapshot
# trigger: true
# passed:
# - build-bosh-atom-package
# - get: s3-manifest-yaml-atom-snapshot
# trigger: true
# passed:
# - build-manifest-yaml-atom-package
# - get: s3-concourse-atom-snapshot
# trigger: true
# passed:
# - build-concourse-atom-package
# - get: s3-spring-boot-atom-snapshot
# trigger: true
# passed:
# - build-spring-boot-atom-package
# - task: build-website
# file: sts4/concourse/tasks/build-atom-website.yml
# - put: atom-snapshot-website
# params:
# path: website
- name: build-vscode-snapshot-website
serial: true
plan:
@@ -1066,10 +1034,6 @@ jobs:
fatjar: s3-manifest-yaml-fatjar-snapshot
file: sts4/concourse/tasks/build-atom-package.yml
- aggregate:
- put: s3-manifest-yaml-atom-snapshot
params:
file: out/cf-manifest-yaml-*.tgz
acl: public-read
- put: atom-cf-manifest-yaml
params:
repository: out/repo
@@ -1099,10 +1063,6 @@ jobs:
fatjar: s3-concourse-fatjar-snapshot
file: sts4/concourse/tasks/build-atom-package.yml
- aggregate:
- put: s3-concourse-atom-snapshot
params:
file: out/concourse-pipeline-yaml-*.tgz
acl: public-read
- put: atom-concourse
params:
repository: out/repo
@@ -1132,10 +1092,6 @@ jobs:
release_repo: atom-bosh
file: sts4/concourse/tasks/build-atom-package.yml
- aggregate:
- put: s3-bosh-atom-snapshot
params:
file: out/bosh-yaml-*.tgz
acl: public-read
- put: atom-bosh
params:
repository: out/repo
@@ -1165,10 +1121,6 @@ jobs:
release_repo: atom-spring-boot
file: sts4/concourse/tasks/build-atom-package.yml
- aggregate:
- put: s3-spring-boot-atom-snapshot
params:
file: out/spring-boot-*.tgz
acl: public-read
- put: atom-spring-boot
params:
repository: out/repo
@@ -1218,7 +1170,7 @@ groups:
- bump-version-minor
- name: atom-snapshots
jobs:
- build-atom-snapshot-website
# - build-atom-snapshot-website
- atom-language-servers-test
- build-concourse-atom-package
- build-bosh-atom-package

View File

@@ -49,20 +49,3 @@ git add .
git commit \
-m "Publish $fatjar_version"
# Publish linkable artifact to S3
cd $atom_package
npm install bundle-deps
node ./node_modules/bundle-deps/bundle-deps .
timestamp=`date -u +%Y%m%d%H%M`
basename=$(npm pack | tee /dev/tty)
length=${#basename}
newName=${basename:0:${length}-4}-$timestamp${basename:${length}-4:${length}}
cp ${basename} $output/${newName}

View File

@@ -220,7 +220,7 @@
<repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository/</url>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository</url>
</repository>
<!-- <repository>
<id>orbit-i-builds</id>

View File

@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Spring Boot Language Server
Bundle-Vendor: Pivotal, Inc.
Bundle-SymbolicName: org.springframework.tooling.boot.ls;singleton:=true
Bundle-Version: 0.2.1.qualifier
Bundle-Version: 0.3.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
org.eclipse.core.runtime;bundle-version="3.12.0",

View File

@@ -12,14 +12,14 @@
</parent>
<artifactId>org.springframework.tooling.boot.ls</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>spring-boot-language-server</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -16,7 +16,7 @@ package org.springframework.tooling.boot.ls;
public class Constants {
public static final String PLUGIN_ID = "org.springframework.tooling.boot.ls";
public static final String LANGUAGE_SERVER_VERSION = "0.2.1-SNAPSHOT.jar";
public static final String LANGUAGE_SERVER_VERSION = "0.3.1-SNAPSHOT.jar";
public static final String PREF_BOOT_HINTS = "boot-java.boot-hints.on";

View File

@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: BOSH Manifest Language Server
Bundle-Vendor: Pivotal, Inc.
Bundle-SymbolicName: org.springframework.tooling.bosh.ls;singleton:=true
Bundle-Version: 0.2.1.qualifier
Bundle-Version: 0.3.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
org.eclipse.core.runtime;bundle-version="3.12.0",

View File

@@ -12,14 +12,14 @@
</parent>
<artifactId>org.springframework.tooling.bosh.ls</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>bosh-language-server</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.ide.eclipse</groupId>

View File

@@ -16,6 +16,6 @@ package org.springframework.tooling.bosh.ls;
public class Constants {
public static final String PLUGIN_ID = "org.springframework.tooling.bosh.ls";
public static final String LANGUAGE_SERVER_VERSION = "0.2.1-SNAPSHOT";
public static final String LANGUAGE_SERVER_VERSION = "0.3.1-SNAPSHOT";
}

View File

@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Cloud Foundry Manifest Language Server
Bundle-Vendor: Pivotal, Inc.
Bundle-SymbolicName: org.springframework.tooling.cloudfoundry.manifest.ls;singleton:=true
Bundle-Version: 0.2.1.qualifier
Bundle-Version: 0.3.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.8.0",
org.eclipse.core.runtime;bundle-version="3.12.0",

View File

@@ -12,14 +12,14 @@
</parent>
<artifactId>org.springframework.tooling.cloudfoundry.manifest.ls</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>manifest-yaml-language-server</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -16,6 +16,6 @@ package org.springframework.tooling.cloudfoundry.manifest.ls;
public class Constants {
public static final String PLUGIN_ID = "org.springframework.tooling.cloudfoundry.manifest.ls";
public static final String LANGUAGE_SERVER_VERSION = "0.2.1-SNAPSHOT.jar";
public static final String LANGUAGE_SERVER_VERSION = "0.3.1-SNAPSHOT.jar";
}

View File

@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Concourse Pipeline Language Server
Bundle-Vendor: Pivotal, Inc.
Bundle-SymbolicName: org.springframework.tooling.concourse.ls;singleton:=true
Bundle-Version: 0.2.1.qualifier
Bundle-Version: 0.3.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
org.eclipse.core.runtime;bundle-version="3.12.0",

View File

@@ -12,14 +12,14 @@
</parent>
<artifactId>org.springframework.tooling.concourse.ls</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>concourse-language-server</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.ide.eclipse</groupId>

View File

@@ -16,6 +16,6 @@ package org.springframework.tooling.concourse.ls;
public class Constants {
public static final String PLUGIN_ID = "org.springframework.tooling.concourse.ls";
public static final String LANGUAGE_SERVER_VERSION = "0.2.1-SNAPSHOT";
public static final String LANGUAGE_SERVER_VERSION = "0.3.1-SNAPSHOT";
}

View File

@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.8.0",
org.springframework.tooling.jdt.ls.commons,
org.eclipse.ui.ide,
org.eclipse.jdt.core,
org.eclipse.jdt.ui
org.eclipse.jdt.ui,
org.apache.commons.lang3
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.springframework.tooling.ls.eclipse.commons,

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.springframework.tooling.properties.ls</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -168,26 +168,26 @@
<layout>p2</layout>
<url>http://download.eclipse.org/releases/photon/</url>
</repository>
<!-- <repository>
<repository>
<id>staging</id>
<layout>p2</layout>
<url>http://download.eclipse.org/staging/photon/</url>
</repository> -->
<repository>
</repository>
<!-- <repository>
<id>platform-i-builds</id>
<layout>p2</layout>
<url>http://download.eclipse.org/eclipse/updates/4.8-I-builds/</url>
</repository>
<!-- <repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/S20171130170529/repository/</url>
</repository> -->
<repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository</url>
</repository>
<!-- <repository>
<id>orbit-i-builds</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/latest-I/</url>
</repository>
</repository> -->
<!-- <repository>
<id>lsp4j-snapshots</id>
<layout>p2</layout>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../commons/pom.xml</relativePath>
</parent>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -59,7 +59,7 @@ class BindingKeyUtils {
}
sb.append(')');
sb.append(getGeneralTypeBindingKey(method.returnType()));
return method.name().toString();
return sb.toString();
}
public static String getGeneralTypeBindingKey(Type type) {

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016-2017 Pivotal, Inc.
* Copyright (c) 2016-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
@@ -11,12 +11,14 @@
package org.springframework.ide.vscode.commons.jandex;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import org.jboss.jandex.FieldInfo;
import org.springframework.ide.vscode.commons.java.Flags;
import org.springframework.ide.vscode.commons.java.IAnnotation;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IJavaType;
import org.springframework.ide.vscode.commons.java.IJavadocProvider;
import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.javadoc.IJavadoc;
@@ -93,4 +95,26 @@ class FieldImpl implements IField {
return BindingKeyUtils.getBindingKey(field);
}
@Override
public IJavaType type() {
return Wrappers.wrap(field.type());
}
@Override
public String signature() {
String jandexSignature = field.toString();
int typeEndIdx = jandexSignature.indexOf(' ');
if (typeEndIdx < 0) {
return jandexSignature;
} else {
if (isEnumConstant()) {
// Chop off field type completely for enum constant
return jandexSignature.substring(typeEndIdx + 1);
} else {
// Chop off prefix of the FQ name of the field type
return Pattern.compile(field.type().name().toString(), Pattern.LITERAL).matcher(jandexSignature).replaceFirst(Wrappers.simpleName(field.type().name()));
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016-2017 Pivotal, Inc.
* Copyright (c) 2016-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
@@ -75,16 +75,6 @@ public class MethodImpl implements IMethod {
return Wrappers.wrap(method.returnType());
}
// @Override
// public String getSignature() {
// StringBuilder sb = new StringBuilder();
// sb.append('(');
// method.parameters().forEach(p -> sb.append(signature(p)));
// sb.append(')');
// sb.append(getReturnType());
// return sb.toString();
// }
@Override
public String toString() {
return method.toString();
@@ -113,4 +103,10 @@ public class MethodImpl implements IMethod {
return BindingKeyUtils.getBindingKey(method);
}
@Override
public String signature() {
//Return Jandex signature for now
return method.toString();
}
}

View File

@@ -19,6 +19,8 @@ import java.util.stream.Stream;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;
import org.springframework.ide.vscode.commons.java.Flags;
import org.springframework.ide.vscode.commons.java.IAnnotation;
@@ -103,7 +105,8 @@ class TypeImpl implements IType {
@Override
public IField getField(String name) {
return Wrappers.wrap(this, info.field(name), javadocProvider);
FieldInfo fieldInfo = info.field(name);
return fieldInfo == null ? null : Wrappers.wrap(this, fieldInfo, javadocProvider);
}
@Override
@@ -116,7 +119,8 @@ class TypeImpl implements IType {
@Override
public IMethod getMethod(String name, Stream<IJavaType> parameters) {
List<Type> typeParameters = parameters.map(Wrappers::from).collect(Collectors.toList());
return Wrappers.wrap(this, info.method(name, typeParameters.toArray(new Type[typeParameters.size()])), javadocProvider);
MethodInfo methodInfo = info.method(name, typeParameters.toArray(new Type[typeParameters.size()]));
return methodInfo == null ? null : Wrappers.wrap(this, methodInfo, javadocProvider);
}
@Override
@@ -154,4 +158,9 @@ class TypeImpl implements IType {
return classpathContainer;
}
@Override
public String signature() {
return info.toString();
}
}

View File

@@ -18,6 +18,7 @@ import java.io.File;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.PrimitiveType;
@@ -153,4 +154,10 @@ public class Wrappers {
throw new IllegalArgumentException("Invalid Java Type " + type.toString());
}
public static String simpleName(DotName dotName) {
String fqName = dotName.toString();
int idx = fqName.lastIndexOf('.');
return idx < 0 ? fqName : fqName.substring(idx + 1);
}
}

View File

@@ -15,6 +15,8 @@ import java.io.File;
public interface IField extends IMember {
boolean isEnumConstant();
IJavaType type();
@Override
default File classpathContainer() {
return getDeclaringType().classpathContainer();

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2013, 2016 IBM Corporation and others.
* Copyright (c) 2000, 2013, 2018 IBM Corporation and others.
* 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
@@ -47,4 +47,6 @@ public interface IMember extends IJavaElement, IAnnotatable {
File classpathContainer();
String signature();
}

View File

@@ -10,16 +10,21 @@
*******************************************************************************/
package org.springframework.ide.vscode.commons.jandex;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.io.File;
import java.util.function.BiConsumer;
import java.util.stream.Stream;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.springframework.ide.vscode.commons.java.ClasspathData;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IMethod;
import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.languageserver.jdt.ls.Classpath.CPE;
import org.springframework.ide.vscode.commons.util.BasicFileObserver;
@@ -99,4 +104,35 @@ public class JandexClasspathTest {
assertNull(subject.findType("demo.Hello"));
assertNull(subject.findType("demo.Goodbye"));
}
@Test public void fieldSignature() throws Exception {
TestProject project = new TestProject("simple-java-project");
project.createClass("demo.Hello");
JandexClasspath subject = project.getJandexClasspath();
IType type = subject.findType("demo.Hello");
assertNotNull(type);
IField field = type.getField("message");
assertNotNull(field);
assertEquals("String demo.Hello.message", field.signature());
}
@Test public void methodSignature() throws Exception {
TestProject project = new TestProject("simple-java-project");
project.createClass("demo.Hello");
JandexClasspath subject = project.getJandexClasspath();
IType type = subject.findType("demo.Hello");
assertNotNull(type);
IMethod method = type.getMethod("getMessage", Stream.of());
assertNotNull(method);
assertEquals("java.util.List<java.lang.String> getMessage()", method.signature());
}
}

View File

@@ -1,5 +1,14 @@
package demo;
import java.util.Collections;
import java.util.List;
public class Hello {
String message;
public List<String> getMessage() {
return Collections.singletonList(message);
}
}

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -22,13 +22,16 @@ import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.CompletionList;
import org.eclipse.lsp4j.MarkupContent;
import org.eclipse.lsp4j.MarkupKind;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
import org.springframework.ide.vscode.commons.languageserver.util.SortKeys;
import org.springframework.ide.vscode.commons.util.BadLocationException;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
import com.google.common.base.Supplier;
@@ -120,7 +123,7 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
private Mono<CompletionList> getCompletionsMono(TextDocumentPositionParams params) {
SimpleTextDocumentService documents = server.getTextDocumentService();
if (documents.get(params) != null) {
TextDocument doc = documents.get(params).copy();
TextDocument doc = documents.getDocumentSnapshot(params.getTextDocument());
return Mono.fromCallable(() -> {
if (resolver!=null) {
//Assumes we don't have more than one completion request in flight from the client.
@@ -188,7 +191,6 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
*
*/
private void resolveEdits(TextDocument doc, int cursor, ICompletionProposal completion, CompletionItem item) {
try {
LspCompletionInterpreter lspCompletionInterpreter = new LspCompletionInterpreter(doc, cursor, server);
@@ -214,34 +216,6 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
return null;
}
// private static Optional<TextEdit> adaptEdits(TextDocument doc, DocumentEdits edits) {
// try {
// TextReplace replaceEdit = edits.asReplacement(doc);
// if (replaceEdit==null) {
// //The original edit does nothing.
// return Optional.empty();
// } else {
// TextDocument newDoc = doc.copy();
// edits.apply(newDoc);
// TextEdit vscodeEdit = new TextEdit();
// vscodeEdit.setRange(doc.toRange(replaceEdit.start, replaceEdit.end-replaceEdit.start));
// if (Boolean.getBoolean("lsp.completions.indentation.enable")) {
// vscodeEdit.setNewText(replaceEdit.newText);
// } else {
// vscodeEdit.setNewText(vscodeIndentFix(doc, vscodeEdit.getRange().getStart(), replaceEdit.newText));
// }
// //TODO: cursor offset within newText? for now we assume its always at the end.
// return Optional.of(vscodeEdit);
// }
// } catch (Exception e) {
// LOG.get().error("{}", e);
// return Optional.empty();
// }
// }
@Override
public CompletionItem resolveCompletion(CompletionItem unresolved) {
resolver.resolveNow(unresolved);

View File

@@ -599,10 +599,6 @@ public class SimpleLanguageServer implements Sts4LanguageServer, LanguageClientA
}
};
// try {
// Thread.sleep(2000);
// } catch (InterruptedException e) {
// }
engine.reconcile(doc, problems);
})
.onErrorResume(error -> {

View File

@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@@ -58,6 +59,7 @@ import org.springframework.ide.vscode.commons.languageserver.quickfix.Quickfix;
import org.springframework.ide.vscode.commons.util.Assert;
import org.springframework.ide.vscode.commons.util.BadLocationException;
import org.springframework.ide.vscode.commons.util.CollectorUtil;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
import org.springframework.ide.vscode.commons.util.text.TextDocument;
@@ -478,4 +480,18 @@ public class SimpleTextDocumentService implements TextDocumentService {
return this.codeLensResolveHandler != null;
}
public TextDocument getDocumentSnapshot(TextDocumentIdentifier textDocumentIdentifier) {
try {
return async.invoke(() -> {
TextDocument doc = get(textDocumentIdentifier.getUri());
if (doc!=null) {
return doc.copy();
}
return null;
}).get();
} catch (Exception e) {
throw ExceptionUtil.unchecked(e);
}
}
}

View File

@@ -37,15 +37,21 @@ public class SnippetBuilder {
}
return "";
}
@Override
protected String createFinalTabStop() {
return ""; //Better these be invisible on server that doesn't support snippet.
}
};
}
private static final int FIRST_PLACE_HOLDER_ID = 1;
private int nextPlaceHolderId = FIRST_PLACE_HOLDER_ID;
private StringBuilder buf = new StringBuilder();
protected StringBuilder buf = new StringBuilder();
private Multimap<Object, PlaceHolder> placeHolders = MultimapBuilder.hashKeys().arrayListValues().build();
private Map<String,Object> idMap = new HashMap<>();
private boolean isFinalTabStopUsed = true;
public SnippetBuilder text(String text) {
buf.append(text);
@@ -64,6 +70,17 @@ public class SnippetBuilder {
return this;
}
public SnippetBuilder finalTabStop() {
Assert.isLegal(isFinalTabStopUsed, "Final tab stop should only be used once");
isFinalTabStopUsed = true;
buf.append(createFinalTabStop());
return this;
}
protected String createFinalTabStop() {
return "$0";
}
public SnippetBuilder placeHolder(String name, String _value) {
Assert.isNotNull(_value);
int offset = buf.length();

View File

@@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -142,6 +142,12 @@ public class Renderables {
// The correct implementation should probably check wether text in buffer already
// ends with newline(s) and add more only if needed. Then it should
// also append double newline at its end.
//TODO: verify that the if below solves the above "todo"
if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) != '\n') {
// 2 spaces and then new line would create a line break in text
buffer.append(" ");
}
buffer.append("\n");
text.renderAsMarkdown(buffer);
buffer.append("\n");
@@ -206,7 +212,7 @@ public class Renderables {
@Override
public void renderAsMarkdown(StringBuilder buffer) {
if (buffer.charAt(buffer.length() - 1) != '\n') {
if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) != '\n') {
// 2 spaces and then new line would create a line break in text
buffer.append(" ");
}

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -145,7 +145,7 @@ public class LanguageServerHarness<S extends SimpleLanguageServerWrapper> {
this.defaultLanguageId = defaultLanguageId;
}
public static final Duration HIGHLIGHTS_TIMEOUT = Duration.ofMillis(10_000); //Why so long?
public static final Duration HIGHLIGHTS_TIMEOUT = Duration.ofMillis(15_000); //Why so long?
public LanguageServerHarness(Callable<S> factory) throws Exception {
this(factory, LanguageId.PLAINTEXT);

View File

@@ -6,7 +6,7 @@
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<packaging>pom</packaging>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<name>commons-parent</name>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../commons/pom.xml</relativePath>
</parent>

View File

@@ -75,6 +75,7 @@ public class ClasspathListenerHandlerTest {
}
@Ignore //TODO: fails randomly for unknown reason.
@Test public void classpathIsSentForNewProject_and_removedForDeletedProject() throws Exception {
service.addClasspathListener(classpaths.commandId);
@@ -94,7 +95,8 @@ public class ClasspathListenerHandlerTest {
});
}
@Ignore @Test public void classpathIsRemovedWhenProjectDeletedFromFileSystem() throws Exception {
@Ignore //TODO: fails randomly for unknown reason.
@Test public void classpathIsRemovedWhenProjectDeletedFromFileSystem() throws Exception {
String projectName = "classpath-test-simple-java-project";
IProject project = createTestProject(projectName);
File loc = project.getLocation().toFile();

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../commons/pom.xml</relativePath>
</parent>

View File

@@ -0,0 +1,59 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=false
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=false
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=false
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.3.1-SNAPSHOT</version>
<relativePath>../commons/pom.xml</relativePath>
</parent>

View File

@@ -11,6 +11,8 @@
package org.springframework.ide.vscode.boot.metadata.hints;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.boot.configurationmetadata.Deprecation;
import org.springframework.ide.vscode.boot.configurationmetadata.ValueHint;
import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory;
@@ -22,7 +24,6 @@ import org.springframework.ide.vscode.commons.java.IJavaElement;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.util.Assert;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.StringUtil;
@@ -39,6 +40,7 @@ import org.springframework.ide.vscode.commons.util.StringUtil;
*/
public class StsValueHint {
private static final Logger log = LoggerFactory.getLogger(StsValueHint.class);
private final String value;
private final Renderable description;
@@ -87,7 +89,7 @@ public class StsValueHint {
}
}
} catch (Exception e) {
Log.log(e);
log.error("", e);
}
return null;
}
@@ -122,7 +124,7 @@ public class StsValueHint {
private static Renderable javaDocSnippet(IJavaProject project, IJavaElement je) {
return Renderables.lazy(() -> {
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
return PropertyDocUtils.documentation(sourceLinks, project, je);
return PropertyDocUtils.documentJavaElement(sourceLinks, project, je);
});
}

View File

@@ -35,10 +35,13 @@ import java.util.stream.Stream;
import javax.inject.Provider;
import org.springframework.ide.vscode.boot.configurationmetadata.Deprecation;
import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory;
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
import org.springframework.ide.vscode.boot.metadata.ResourceHintProvider;
import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry.ValueProviderStrategy;
import org.springframework.ide.vscode.boot.metadata.hints.StsValueHint;
import org.springframework.ide.vscode.boot.metadata.util.DeprecationUtil;
import org.springframework.ide.vscode.boot.metadata.util.PropertyDocUtils;
import org.springframework.ide.vscode.commons.java.Flags;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IJavaElement;
@@ -53,6 +56,7 @@ import org.springframework.ide.vscode.commons.util.EnumValueParser;
import org.springframework.ide.vscode.commons.util.LazyProvider;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.MimeTypes;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.util.ValueParser;
@@ -122,7 +126,7 @@ public class TypeUtil {
}
private IJavaProject javaProject;
public TypeUtil(IJavaProject jp) {
//Note javaProject is allowed to be null, but only in unit testing context
// (This is so some tests can be run without an explicit jp needing to be created)
@@ -638,6 +642,8 @@ public class TypeUtil {
//TODO: handle type parameters.
if (typeFromIndex != null) {
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
IJavaProject project = getJavaProject();
ArrayList<TypedProperty> properties = new ArrayList<>();
getGetterMethods(typeFromIndex).forEach(m -> {
Deprecation deprecation = DeprecationUtil.extract(m);
@@ -649,11 +655,11 @@ public class TypeUtil {
}
if (beanMode.includesHyphenated()) {
properties.add(new TypedProperty(getterOrSetterNameToProperty(m.getElementName()), propType,
deprecation));
Renderables.lazy(() -> PropertyDocUtils.documentJavaElement(sourceLinks, project, m)), deprecation));
}
if (beanMode.includesCamelCase()) {
properties.add(new TypedProperty(getterOrSetterNameToCamelName(m.getElementName()), propType,
deprecation));
Renderables.lazy(() -> PropertyDocUtils.documentJavaElement(sourceLinks, project, m)), deprecation));
}
});
return properties;
@@ -817,15 +823,15 @@ public class TypeUtil {
}
public Optional<IMethod> getSetter(Type beanType, String propName) {
public IMethod getSetter(Type beanType, String propName) {
try {
String setterName = "set" + StringUtil.hyphensToCamelCase(propName, true);
IType type = findType(beanType);
return type.getMethods().filter(m -> setterName.equals(m.getElementName())).findFirst();
return type.getMethods().filter(m -> setterName.equals(m.getElementName())).findFirst().orElse(null);
} catch (Exception e) {
Log.log(e);
}
return Optional.empty();
return null;
}
public IJavaElement getGetter(Type beanType, String propName) {
@@ -833,9 +839,16 @@ public class TypeUtil {
IType type = findType(beanType);
IMethod m = type.getMethod(getterName, Stream.empty());
if (m.exists()) {
if (m != null && m.exists()) {
return m;
}
getterName = "is" + StringUtil.hyphensToCamelCase(propName, true);
m = type.getMethod(getterName, Stream.empty());
if (m != null && m.exists()) {
return m;
}
return null;
}

View File

@@ -41,17 +41,33 @@ public class PropertyDocUtils {
* @param je
* @return
*/
public static Renderable documentation(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
IJavadoc javadoc = je.getJavaDoc();
public static Renderable javadocContent(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
Builder<Renderable> renderableBuilder = ImmutableList.builder();
IJavadoc javadoc = je.getJavaDoc();
renderableBuilder.add(Renderables.lineBreak());
renderableBuilder.add(Renderables.paragraph(javadoc == null ? Renderables.NO_DESCRIPTION: javadoc.getRenderable()));
return Renderables.concat(renderableBuilder.build());
}
/**
* Generates documentation for the value of some Java type. Includes signature, javadoc, link to container type.
*
* @param sourceLinks
* @param project
* @param je
* @return
*/
public static Renderable documentJavaElement(SourceLinks sourceLinks, IJavaProject project, IJavaElement je) {
Builder<Renderable> renderableBuilder = ImmutableList.builder();
renderableBuilder.add(javadoc == null ? Renderables.NO_DESCRIPTION: javadoc.getRenderable());
if (je instanceof IMember) {
IType containingType = je instanceof IType ? (IType) je : ((IMember)je).getDeclaringType();
IMember member = (IMember) je;
renderableBuilder.add(Renderables.lineBreak());
renderableBuilder.add(Renderables.inlineSnippet(Renderables.text(member.signature())));
IType containingType = je instanceof IType ? (IType) je : ((IMember)je).getDeclaringType();
if (je != null) {
renderableBuilder.add(Renderables.lineBreak());
renderableBuilder.add(Renderables.text("Type: "));
String type = containingType.getFullyQualifiedName();
Optional<String> url = SourceLinkFactory.createSourceLinks(null).sourceLinkUrlForFQName(project, type);
renderableBuilder.add(Renderables.lineBreak());
if (url.isPresent()) {
renderableBuilder.add(Renderables.link(type, url.get()));
} else {
@@ -59,6 +75,9 @@ public class PropertyDocUtils {
}
}
}
IJavadoc javadoc = je.getJavaDoc();
renderableBuilder.add(Renderables.lineBreak());
renderableBuilder.add(Renderables.paragraph(javadoc == null ? Renderables.NO_DESCRIPTION: javadoc.getRenderable()));
return Renderables.concat(renderableBuilder.build());
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2016 Pivotal, Inc.
* Copyright (c) 2015, 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
@@ -27,6 +27,7 @@ import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
import org.springframework.ide.vscode.boot.configurationmetadata.Deprecation;
import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory;
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
import org.springframework.ide.vscode.boot.metadata.IndexNavigator;
import org.springframework.ide.vscode.boot.metadata.PropertyInfo;
import org.springframework.ide.vscode.boot.metadata.hints.HintProvider;
@@ -41,6 +42,7 @@ import org.springframework.ide.vscode.boot.metadata.types.TypedProperty;
import org.springframework.ide.vscode.boot.metadata.util.PropertyDocUtils;
import org.springframework.ide.vscode.commons.java.IField;
import org.springframework.ide.vscode.commons.java.IJavaElement;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.java.IMember;
import org.springframework.ide.vscode.commons.languageserver.completion.DocumentEdits;
import org.springframework.ide.vscode.commons.languageserver.completion.ICompletionProposal;
@@ -75,7 +77,7 @@ import com.google.common.collect.ImmutableList;
* content assistance.
*/
public abstract class ApplicationYamlAssistContext extends AbstractYamlAssistContext {
private static Logger log = LoggerFactory.getLogger(ApplicationYamlAssistContext.class);
protected final RelaxedNameConfig conf;
@@ -549,7 +551,9 @@ public abstract class ApplicationYamlAssistContext extends AbstractYamlAssistCon
if (jes != null) {
for (IJavaElement je : jes) {
if (je instanceof IMember) {
return PropertyDocUtils.documentation(SourceLinkFactory.createSourceLinks(null), typeUtil.getJavaProject(), je);
SourceLinks sourceLinks = SourceLinkFactory.createSourceLinks(null);
IJavaProject project = typeUtil.getJavaProject();
return PropertyDocUtils.documentJavaElement(sourceLinks, project, je);
}
}
}
@@ -573,7 +577,7 @@ public abstract class ApplicationYamlAssistContext extends AbstractYamlAssistCon
} else {
ArrayList<IJavaElement> elements = new ArrayList<IJavaElement>(3);
maybeAdd(elements, typeUtil.getField(beanType, propName));
maybeAdd(elements, typeUtil.getSetter(beanType, propName).get());
maybeAdd(elements, typeUtil.getSetter(beanType, propName));
maybeAdd(elements, typeUtil.getGetter(beanType, propName));
if (!elements.isEmpty()) {
return elements;

View File

@@ -16,6 +16,8 @@ import static org.junit.Assert.assertTrue;
import static org.springframework.ide.vscode.languageserver.testharness.Editor.INDENTED_COMPLETION;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.Callable;
import org.eclipse.core.resources.IProject;
import org.eclipse.lsp4j.CompletionItem;
@@ -35,6 +37,7 @@ import org.springframework.ide.vscode.commons.languageserver.composable.Composab
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
import org.springframework.ide.vscode.commons.util.RunnableWithException;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.util.text.LanguageId;
import org.springframework.ide.vscode.languageserver.testharness.Editor;
@@ -103,6 +106,20 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
);
}
@Test public void almostJumpyCompletion() throws Exception {
defaultTestData();
assertCompletion(
"server:\n" +
" address: bark\n" +
"port<*>\n"
, // ==>
"server:\n" +
" address: bark\n" +
" port: <*>\n"
);
}
///////////////////// ported tests from old STS code base ////////////////////////////////////////////////
@Test public void testHovers() throws Exception {
@@ -1469,7 +1486,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
" bar: <*>\n"+
"other:"
);
assertCompletion(
"foo.nested.nested.b<*>\n" +
"foo:\n" +
@@ -1487,21 +1504,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
"other:"
);
}
@Test public void almostJumpyCompletion() throws Exception {
defaultTestData();
assertCompletion(
"server:\n" +
" address: bark\n" +
"port<*>\n"
, // ==>
"server:\n" +
" address: bark\n" +
" port: <*>\n"
);
}
@Test public void testBooleanValueCompletion() throws Exception {
defaultTestData();
assertCompletions(
@@ -3727,7 +3730,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
String collectionType = "java.util.List";
doCollectionOfEnumReconcileTest(collectionType);
}
private void doCollectionOfEnumReconcileTest(String collectionType) throws Exception {
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.colors", collectionType + "<demo.Color>", null, "Ooh! nice colors!");
@@ -3753,7 +3756,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
" colors: [red, green, BLUE, not-a-color]"
);
editor.assertProblems("not-a-color|demo.Color");
//block list
editor = newEditor(
"my:\n" +
@@ -3765,11 +3768,11 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
);
editor.assertProblems("not-a-color|demo.Color");
}
@Test public void testSetOfEnumCompletions() throws Exception {
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.colors", "java.util.Set<demo.Color>", null, "Ooh! nice colors!");
Editor editor = newEditor(
"my:\n" +
" colors:\n" +
@@ -3780,9 +3783,23 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
editor.assertContextualCompletions("B<*>", "BLUE<*>");
}
///////////////// cruft ////////////////////////////////////////////////////////
private void withSystemProperty(String prop, String value, RunnableWithException doit) throws Exception {
Optional<String> oldValue = System.getProperties().containsKey(prop) ? Optional.of(System.getProperty(prop)) : Optional.empty();
try {
System.setProperty(prop, value);
doit.run();
} finally {
if (oldValue.isPresent()) {
System.setProperty(prop, oldValue.get());
} else {
System.getProperties().remove(prop);
}
}
}
private void generateNestedProperties(int levels, String[] names, String prefix) {
if (levels==0) {
data(prefix, "java.lang.String", null, "Property "+prefix);
@@ -3804,8 +3821,8 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
protected SimpleLanguageServer newLanguageServer() {
ComposableLanguageServer<?> server = BootLanguageServer.create(
s -> new BootLanguageServerParams(
javaProjectFinder,
ProjectObserver.NULL,
javaProjectFinder,
ProjectObserver.NULL,
md.getIndexProvider(),
typeUtilProvider,
RunningAppProvider.NULL,
@@ -3825,5 +3842,5 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
protected LanguageId getLanguageId() {
return LanguageId.BOOT_PROPERTIES_YAML;
}
}

View File

@@ -0,0 +1,19 @@
## 2018-05-14 (M11)
* _(all)_ JVM used to run the language servers can now be specified via custom settings ([#51](https://github.com/spring-projects/sts4/issues/51))
## 2018-03-15 (M10)
* _(all)_ language server processes now show up with their real name when using `jps` instead of just `JarLauncher`
## 2018-02-23 (M9)
* _(all)_ improved the way the JDK to run the language server is found together with an improved error message if no JDK can be found
## 2017-12-15 (M7)
* _(all)_ issues solved when running on Windows ([#25](https://github.com/spring-projects/sts4/issues/25), [#26](https://github.com/spring-projects/sts4/issues/26), [#29](https://github.com/spring-projects/sts4/issues/29))
## 2017-12-04
* initial public beta launch

View File

@@ -3,7 +3,7 @@
"displayName": "Bosh Editor",
"description": "Provides validation and content assist for various Bosh configuration files",
"icon": "icon.png",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "Pivotal",
"repository": {
"type": "git",

View File

@@ -0,0 +1,33 @@
## 2018-06-08 (M12)
* _(Concourse)_ add support for new attributes of DockerImageSource (aws_session_token, max_concurrent_downloads, max_concurrent_uploads) and DockerImagePutParams (additional_tags, cache_from, load_bases, target_name) ([#56](https://github.com/spring-projects/sts4/issues/56))
* _(Concourse)_ bugfix: quick fixes work again
## 2018-05-14 (M11)
* _(all)_ JVM used to run the language servers can now be specified via custom settings ([#51](https://github.com/spring-projects/sts4/issues/51))
## 2018-03-15 (M10)
* _(Concourse)_ added support for symbols for groups
* _(Concourse)_ updated URLs in documentation to point to new Concourse domain
* _(all)_ language server processes now show up with their real name when using `jps` instead of just `JarLauncher`
## 2018-02-23 (M9)
* _(Concourse)_ Concourse CI Pipeline Editor reports errors on valid `pipeline.yml` fixed (([#41](https://github.com/spring-projects/sts4/issues/41)))
* _(all)_ improved the way the JDK to run the language server is found together with an improved error message if no JDK can be found
## 2018-01-30 (M8)
* _(Concourse)_ added support for cache attribute in tasks
* _(Concourse)_ added missing version attribute in image_resource
## 2017-12-15 (M7)
* _(all)_ issues solved when running on Windows ([#25](https://github.com/spring-projects/sts4/issues/25), [#26](https://github.com/spring-projects/sts4/issues/26), [#29](https://github.com/spring-projects/sts4/issues/29))
* _(Concourse)_ getstep.version property in concourse pipeline now accepts a Map<String,String> ([#24](https://github.com/spring-projects/sts4/issues/24)) as well as special values 'every' and 'latest' ([#28](https://github.com/spring-projects/sts4/issues/28)).
## 2017-12-04
* initial public beta launch

View File

@@ -3,7 +3,7 @@
"displayName": "Concourse CI Pipeline Editor",
"description": "Provides validation and content assist for Concourse CI pipeline and task configuration yml files",
"icon": "icon.png",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "Pivotal",
"repository": {
"type": "git",

View File

@@ -0,0 +1,19 @@
## 2018-05-14 (M11)
* _(all)_ JVM used to run the language servers can now be specified via custom settings ([#51](https://github.com/spring-projects/sts4/issues/51))
## 2018-03-15 (M10)
* _(all)_ language server processes now show up with their real name when using `jps` instead of just `JarLauncher`
## 2018-02-23 (M9)
* _(all)_ improved the way the JDK to run the language server is found together with an improved error message if no JDK can be found
## 2017-12-15 (M7)
* _(all)_ issues solved when running on Windows ([#25](https://github.com/spring-projects/sts4/issues/25), [#26](https://github.com/spring-projects/sts4/issues/26), [#29](https://github.com/spring-projects/sts4/issues/29))
## 2017-12-04
* initial public beta launch

View File

@@ -3,7 +3,7 @@
"displayName": "Cloudfoundry Manifest YML Support",
"description": "Adds linting, content assist and hoverinfo's for Cloudfoundry Deployment Manifests (a.k.a. `manifest.yml`) files.",
"icon": "icon.png",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "Pivotal",
"repository": {
"type": "git",

View File

@@ -0,0 +1,61 @@
## 2018-06-08 (M12)
* _(Spring Boot)_ live hovers now updated in all open editors, not just the active one
* _(Spring Boot)_ more detailed context shown in hover documentation when editing property files ([#265](https://github.com/spring-projects/spring-ide/issues/265))
* _(Spring Boot)_ performance improvement: project symbols now show up a lot faster for the open editors/projects (in a multi-root folder workspace)
* _(Spring Boot)_ bugfix: JDK9 and JDK10 projects supported now even if main editor and/or language server runs on JDK8
* _(Spring Boot)_ bugfix: various NPEs in Spring indexer fixed
## 2018-05-14 (M11)
* _(Spring Boot)_ major performance improvements and footprint reductions (due to a groundbreaking change to how projects are being resolved, this is now delegated to the surrounding Java tooling)
* _(Spring Boot)_ support for JDK10 added
* _(Spring Boot)_ bugfix - custom JMX domains now supported for live hovers ([#44](https://github.com/spring-projects/sts4/issues/44))
* _(Spring Boot)_ bugfix - live hovers now show up for all open editors (not limited to the one with focus anymore)
* _(all)_ JVM used to run the language servers can now be specified via custom settings ([#51](https://github.com/spring-projects/sts4/issues/51))
## 2018-03-15 (M10)
* _(Spring Boot)_ support added for request-mapping-like symbols for webflux router definitions
* _(Spring Boot)_ code lenses for webflux handler methods implemented that visualize the mapped route (VSCode only at the moment)
* _(Spring Boot)_ document highlight support added for webflux router definitions that highlight parts of the routes that belong together
* _(Spring Boot)_ request mapping symbols now include accept and content type defintions
* _(Spring Boot)_ support for direct navigation from live injection reports to source code added for Eclipse
* _(Spring Boot)_ abstract @Bean-annotated methods are now ignored when creating symbols for bean definitions
* _(Spring Boot)_ URLs from hovers (like request mapping URLs from running boot apps) now open in an internal browser that has a navigation and an address bar
* _(Spring Boot)_ bugfix for NPE that happened occasionally when creating a new Java file
* _(all)_ language server processes now show up with their real name when using `jps` instead of just `JarLauncher`
## 2018-02-23 (M9)
__Attention:__ We merged the two different extensions for Spring Boot (for Java code and for properties) into a single extension for the various platforms (Eclipse, VSCode, Atom). This might require that you manually uninstall the old extensions and install the new ones. Automatic updates don't work here. For the Eclipse case, you might want to start with a fresh STS4 M9 distribution and go from there to avoid manual uninstall/install steps.
* _(Spring Boot)_ support added for Spring Data repositories, they show up as bean symbols now
* _(Spring Boot)_ fixed a bug that caused an exception when using content-assist for a non-Spring-Boot java project
* _(Spring Boot, VSCode)_ support for navigation added to live injection reports, they allow you to directly navigate to the source code of the bean type and the resource where the bean got defined. Limitation: this works for VSCode only at the moment, support for Eclipse and Atom still in progress
* _(Spring Boot, Eclipse integration)_ fixed a bug that caused content-assist to be turned off in the java editor
* improved the way the JDK to run the language server is found together with an improved error message if no JDK can be found
## 2018-01-30 (M8)
* _(Spring Boot Java)_ function declarations are now being parsed into symbols for functions that directly inherit from `java.util.Function` ([#18](https://github.com/spring-projects/sts4/issues/18))
* _(Spring Boot Java)_ updated live hover mechanics to work with latest Spring Boot 2.0 snapshot versions
* _(Spring Boot Java)_ improved the way the JDK (to run the language server) is found
* _(Spring Boot Java)_ improved warning message about missing tools.jar
* _(Spring Boot Java)_ live hovers now show up on class flies that are displayed as source
* _(Spring Boot Java)_ fixed a problem with outdated symbols showing up after file deletion/rename
* _(Spring Boot Java)_ fixed a deadlock issue
* _(Spring Boot Java)_ reduced number of threads used behind the scenes
* _(Spring Boot Java)_ reduced number of CPU cycles used by live hover mechanism
* _(Spring Boot Java, Spring Boot Properties)_ reduced memory footprint
* _(Spring Boot Properties)_ fixed an issue with wrong indentation after inserting property node
## 2017-12-15 (M7)
* _(all)_ issues solved when running on Windows ([#25](https://github.com/spring-projects/sts4/issues/25), [#26](https://github.com/spring-projects/sts4/issues/26), [#29](https://github.com/spring-projects/sts4/issues/29))
* _(Spring Boot Java)_ live hover information now works for inner classes
* _(Spring Boot Properties)_ boot property editing now activated for bootstrap*.yml files in VSCode automatically
## 2017-12-04
* initial public beta launch

View File

@@ -1,4 +1,4 @@
# VS Code Language Server for Spring Boot Application Properties
# VS Code Language Server for Spring Boot
VSCode extension and Language Server providing support for working with Spring Boot
`application.properties`, `application.yml` and `.java` files.
@@ -8,9 +8,9 @@ VSCode extension and Language Server providing support for working with Spring B
The extension will automatically activate when you edit files with the following
name patterns:
- `*.java` => activates Spring Boot specific support editing `.java` files.
- `application*.properties` => activates support for Spring Boot properties in `.properties`format.
- `application*.yml` => activates support for Spring Boot properties in `.yml` format.
- `*.java` => activates Spring Boot specific support editing `.java` files.
You can also define your own patterns and map them to the language-ids
`spring-boot-properties` or `spring-boot-properties-yaml` by defining `files.associations`

View File

@@ -3,7 +3,7 @@
"displayName": "Spring Boot Tools",
"description": "Provides validation and content assist for Spring Boot `application.properties`, `application.yml` properties files. As well as Boot-specific support for `.java` files.",
"icon": "spring-boot-logo.png",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "Pivotal",
"repository": {
"type": "git",