Merge remote-tracking branch 'devops/master' into cs/migrate

This commit is contained in:
Sheng Chen 2019-04-15 09:41:58 +08:00
Родитель caa718bf11 b42102553c
Коммит 1600f59adf
91 изменённых файлов: 8441 добавлений и 1 удалений

6
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,6 @@
# Tab indentation
[*]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

13
.gitignore поставляемый
Просмотреть файл

@ -18,6 +18,19 @@
*.zip
*.tar.gz
*.rar
*.tgz
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Build files
target/
bin/
# NPM package
**/node_modules/
cmd/repository/
cmd/workspace/
# Mac OS
.DS_Store

110
.mvn/wrapper/MavenWrapperDownloader.java поставляемый Normal file
Просмотреть файл

@ -0,0 +1,110 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

1
.mvn/wrapper/maven-wrapper.properties поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip

17
.project Normal file
Просмотреть файл

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

Просмотреть файл

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

15
.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,15 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.import.exclusions": [
"**/org.eclipse.jdt.ls.tests/projects"
],
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.classpath" : true,
"**/.project": true
}
}

27
.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,27 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Package",
"type": "shell",
"command": "./mvnw clean -B package",
"windows": {
"command": ".\\mvnw.cmd clean -B package"
},
"group": "build",
"problemMatcher": []
},
{
"label": "Verify",
"type": "shell",
"command": "./mvnw -B verify",
"windows": {
"command": ".\\mvnw.cmd -B verify"
},
"group": "test",
"problemMatcher": []
}
]
}

30
CHANGELOG.md Normal file
Просмотреть файл

@ -0,0 +1,30 @@
# Change Log
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## 0.1.4
### Fixed
- Fix an NPE in ImplementationsVisitor when get the implementation ranges
### Changed
- Visit SimpleType and SimpleName in HoverVisitor and ReferencesVisitor
## 0.1.3
### Added
- Add SimpleType, SingleVariableDeclaration, VariableDeclarationFragment and MethodInvocation into ReferencesVisitor
### Fixed
- Stop enlisting the vertices and edges if the element does not have hover information
## 0.1.2
### Changed
- Change the output format
## 0.1.1
### Fixed
- Fix the typo for `metaData`.
- Remove the duplicated `hoverResults`
## 0.1.0
Initialize the Java LSIF Indexer

Просмотреть файл

@ -1,5 +1,6 @@
# Java Language Server Indexer
# Contributing
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us

4
cmd/.npmignore Normal file
Просмотреть файл

@ -0,0 +1,4 @@
node_modules/
workspace/
gulpfile.js
*.tgz

2
cmd/.npmrc Normal file
Просмотреть файл

@ -0,0 +1,2 @@
@lsif:registry=https://devdiv.pkgs.visualstudio.com/_packaging/CloudKernel/npm/registry/
always-auth=true

23
cmd/README.md Normal file
Просмотреть файл

@ -0,0 +1,23 @@
# LSIF for Java
## Prerequisite
The LSIF Java Indexer currently supports Maven or Gradle managed project. You can find `pom.xml` or `build.gradle` file in the project's base path.
## Parameters
- `-Dintellinav.repo.path`=`[path of repo]`
- `-Dintellinav.output.format`=`[format]`
- Supported values: line, json. Default: line
## Example
Invoke the `index.bat` with the path of the target repo:
```bat
> ./index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic"
```
```bat
> ./index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic" "-Dintellinav.output.format=json"
```
## Changelog
See [CHANGELOG.md](https://dev.azure.com/mseng/VSJava/_git/lsif-java?path=%2FCHANGELOG.md&version=GBmaster)

35
cmd/gulpfile.js Normal file
Просмотреть файл

@ -0,0 +1,35 @@
const gulp = require('gulp');
const cp = require('child_process');
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const rimraf = require("rimraf");
const rootPath = path.join(__dirname, '..');
gulp.task('clean', (done) => {
rimraf.sync(path.join(__dirname, 'repository'));
rimraf.sync(path.join(__dirname, 'workspace'));
const packages = glob.sync('*.tgz');
for (const package of packages) {
fs.unlinkSync(package);
}
done();
});
gulp.task('build-indexer', (done) => {
cp.execSync(`${mvnw()} clean verify`, { cwd: rootPath, stdio: [0, 1, 2] });
gulp.src(path.join(rootPath, 'com.microsoft.java.lsif.product', 'target', 'repository', '**/*'))
.pipe(gulp.dest(path.join(rootPath, 'cmd', 'repository')));
done();
});
gulp.task('build', gulp.series('clean', 'build-indexer'));
function isWin() {
return /^win/.test(process.platform);
}
function mvnw() {
return isWin() ? 'mvnw.cmd' : './mvnw';
}

29
cmd/index.bat Normal file
Просмотреть файл

@ -0,0 +1,29 @@
@echo off
set basePath=%cd%\repository
IF "%~1" == "" GOTO Help
set input=%*
:Main
java ^
-Dlog.level=ALL ^
%input% ^
-noverify ^
-jar %basePath%\plugins\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar ^
-configuration %basePath%\config_win
goto End
:Help
@echo Parameters:
@echo. -Dintellinav.repo.path=[path of repo]
@echo.
@echo. -Dintellinav.output.format=[format]
@echo. Supported values: line, json. Default: line
@echo.
@echo Example:
@echo. index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic"
@echo.
@echo. index.bat "-Dintellinav.repo.path=D:\Workspace\spring-petclinic" "-Dintellinav.output.format=json"
:End

3452
cmd/package-lock.json сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

21
cmd/package.json Normal file
Просмотреть файл

@ -0,0 +1,21 @@
{
"name": "@lsif/lsif-java-indexer",
"version": "0.1.4",
"description": "The Java Indexer for LSIF",
"scripts": {
"refreshVSToken": "vsts-npm-auth -config .npmrc",
"build": "gulp build"
},
"repository": {
"type": "git",
"url": "https://dev.azure.com/mseng/VSJava/_git/lsif-java"
},
"author": "yaozheng@microsoft.com, sheche@microsoft.com",
"license": "ISC",
"devDependencies": {
"glob": "^7.1.3",
"gulp": "^4.0.0",
"rimraf": "^2.6.3",
"vsts-npm-auth": "^0.37.0"
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

Просмотреть файл

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.microsoft.java.lsif.core</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>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

Просмотреть файл

@ -0,0 +1,431 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=true
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

Просмотреть файл

@ -0,0 +1,3 @@
eclipse.preferences.version=1
pluginProject.extensions=true
resolve.requirebundle=false

Просмотреть файл

@ -0,0 +1,6 @@
eclipse.preferences.version=1
org.moreunit.generateCommentsForTestMethod=true
org.moreunit.preferences.version=2
org.moreunit.test_annotation=BY_NAME
org.moreunit.unitsourcefolder=org.eclipse.jdt.ls.core\:src\:org.eclipse.jdt.ls.tests\:src
org.moreunit.useprojectsettings=true

Просмотреть файл

@ -0,0 +1,36 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.microsoft.java.lsif.core;singleton:=true
Bundle-Version: 0.1.4.qualifier
Bundle-Activator: com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.core.resources,
org.eclipse.core.net,
org.eclipse.jdt.core,
org.eclipse.ltk.core.refactoring,
org.eclipse.text;bundle-version="3.6.0",
org.eclipse.m2e.core,
com.ibm.icu.base,
org.eclipse.core.filebuffers;bundle-version="3.6.0",
org.eclipse.m2e.maven.runtime,
org.eclipse.buildship.core;bundle-version="1.0.18",
org.eclipse.jdt.launching,
org.eclipse.jdt.core.manipulation;bundle-version="1.8.0",
org.apache.log4j;bundle-version="1.2.15",
com.google.gson;bundle-version="2.7.0",
org.apache.commons.lang3;bundle-version="3.1.0",
org.eclipse.lsp4j,
org.eclipse.lsp4j.jsonrpc,
org.eclipse.jdt.ls.core;bundle-version="0.32.0",
org.apache.commons.io;bundle-version="2.2.0"
Export-Package: com.microsoft.java.lsif.core.internal
Bundle-ClassPath: lib/jsoup-1.9.2.jar,
lib/remark-1.0.0.jar,
.
Bundle-Vendor: %Bundle-Vendor
Automatic-Module-Name: org.eclipse.jdt.ls.core

Просмотреть файл

@ -0,0 +1,12 @@
source.. = src/
output.. = target/classes
bin.includes = META-INF/,\
.,\
plugin.xml,\
lifecycle-mapping-metadata.xml,\
plugin.properties,\
pom.xml
src.includes = src/,\
META-INF/,\
plugin.xml,\
pom.xml

Просмотреть файл

Просмотреть файл

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<!-- build-helper-maven-plugin mapping mostly copied from
https://github.com/mojohaus/build-helper-maven-plugin/blob/33355c039d3fc4aa4ca43a895834d5b4085baf5b/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
-->
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<versionRange>[1.0, 3.0.0)</versionRange>
<goals>
<goal>add-resource</goal>
<goal>add-source</goal>
<goal>add-test-resource</goal>
<goal>add-test-source</goal>
<goal>bsh-property</goal>
<goal>cpu-count</goal>
<goal>local-ip</goal>
<goal>maven-version</goal>
<goal>parse-version</goal>
<goal>regex-properties</goal>
<goal>regex-property</goal>
<goal>released-version</goal>
<goal>reserve-network-port</goal>
<goal>timestamp-property</goal>
<goal>uptodate-properties</goal>
<goal>uptodate-property</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<versionRange>[1.0, 3.0.0)</versionRange>
<goals>
<goal>attach-artifact</goal>
<goal>remove-project-artifact</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>false</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>

Просмотреть файл

@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2016-2017 Red Hat Inc. 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
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat Inc. - initial API and implementation
###############################################################################
Bundle-Vendor = Eclipse.org
Bundle-Name = JDT Language Server - Core

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="id1"
point="org.eclipse.core.runtime.applications">
<application
cardinality="singleton-global"
thread="main"
visible="true">
<run
class="com.microsoft.java.lsif.core.internal.LanguageServerIndexer">
</run>
</application>
</extension>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="com.microsoft.java.lsif.core.id1"
name="Java Language Server">
<property
name="appName"
value="Java Language Server">
</property>
</product>
</extension>
</plugin>

Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.java.lsif</groupId>
<artifactId>parent</artifactId>
<version>0.1.4-SNAPSHOT</version>
</parent>
<artifactId>com.microsoft.java.lsif.core</artifactId>
<packaging>eclipse-plugin</packaging>
<name>${base.name} :: Core</name>
</project>

Просмотреть файл

@ -0,0 +1,20 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal;
public final class IConstant {
private IConstant() {
}
public final static String PLUGIN_ID = "com.microsoft.java.lsif.core";
public final static String JAVA_ID = "java";
public final static String DEFAULT_LSIF_FILE_NAME = "lsif.json";
public final static String LSIF_FORMAT_VERSION = "0.1.0";
}

Просмотреть файл

@ -0,0 +1,83 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.managers.ProjectsManager;
import org.eclipse.lsp4j.Location;
public final class JdtlsUtils {
private JdtlsUtils() {
}
public final static Location getElementLocation(IJavaElement element) {
Location targetLocation = null;
try {
ICompilationUnit compilationUnit = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
IClassFile cf = (IClassFile) element.getAncestor(IJavaElement.CLASS_FILE);
if (compilationUnit != null || (cf != null && cf.getSourceRange() != null)) {
targetLocation = JdtlsUtils.fixLocation(element, JDTUtils.toLocation(element),
element.getJavaProject());
}
if (element instanceof IMember && ((IMember) element).getClassFile() != null) {
targetLocation = JdtlsUtils.fixLocation(element,
JDTUtils.toLocation(((IMember) element).getClassFile()), element.getJavaProject());
}
} catch (CoreException ex) {
}
return targetLocation;
}
public final static Location fixLocation(IJavaElement element, Location location, IJavaProject javaProject) {
if (!javaProject.equals(element.getJavaProject())
&& element.getJavaProject().getProject().getName().equals(ProjectsManager.DEFAULT_PROJECT_NAME)) {
// see issue at: https://github.com/eclipse/eclipse.jdt.ls/issues/842 and
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=541573
// for jdk classes, jdt will reuse the java model by altering project to share
// the model between projects
// so that sometimes the project for `element` is default project and the
// project is different from the project for `unit`
// this fix is to replace the project name with non-default ones since default
// project should be transparent to users.
if (location.getUri().contains(ProjectsManager.DEFAULT_PROJECT_NAME)) {
String patched = StringUtils.replaceOnce(location.getUri(), ProjectsManager.DEFAULT_PROJECT_NAME,
javaProject.getProject().getName());
try {
IClassFile cf = (IClassFile) JavaCore.create(JDTUtils.toURI(patched).getQuery());
if (cf != null && cf.exists()) {
location.setUri(patched);
}
} catch (Exception ex) {
}
}
}
return location;
}
/**
* Normalize the URI to the same format as the client.
*/
public final static String normalizeUri(String uri) {
if (Platform.OS_WIN32.equals(Platform.getOS())) {
if (uri.startsWith("file:///") && uri.length() > 10 && Character.isUpperCase(uri.charAt(8))
&& uri.charAt(9) == ':') {
return "file:///" + Character.toLowerCase(uri.charAt(8)) + uri.substring(9);
}
}
return uri;
}
}

Просмотреть файл

@ -0,0 +1,32 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import com.microsoft.java.lsif.core.internal.indexer.Indexer;
public class LanguageServerIndexer implements IApplication {
@Override
public Object start(IApplicationContext context) {
try {
Indexer indexer = new Indexer();
indexer.generateLsif();
} catch (Exception ex) {
LanguageServerIndexerPlugin.logException("Exception when indexing ", ex);
System.exit(1);
}
return null;
}
@Override
public void stop() {
}
}

Просмотреть файл

@ -0,0 +1,87 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal;
import java.io.PrintStream;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class LanguageServerIndexerPlugin implements BundleActivator {
private static BundleContext context;
// Language server will redirect the out when starting, save this value for
// indexer usage.
private static PrintStream out;
@Override
public void start(BundleContext context) throws Exception {
LanguageServerIndexerPlugin.context = context;
LanguageServerIndexerPlugin.out = System.out;
if (context != null) {
Platform.getLog(LanguageServerIndexerPlugin.context.getBundle()).addLogListener(new ILogListener() {
@Override
public void logging(IStatus status, String plugin) {
LanguageServerIndexerPlugin.out.println(status.getMessage());
if (status.getException() != null) {
status.getException().printStackTrace(LanguageServerIndexerPlugin.out);
}
}
});
}
}
@Override
public void stop(BundleContext context) throws Exception {
}
public static void log(IStatus status) {
if (context != null) {
Platform.getLog(LanguageServerIndexerPlugin.context.getBundle()).log(status);
}
}
public static void log(CoreException e) {
log(e.getStatus());
}
public static void logError(String message) {
if (context != null) {
log(new Status(IStatus.ERROR, context.getBundle().getSymbolicName(), message));
}
}
public static void logInfo(String message) {
if (context != null) {
log(new Status(IStatus.INFO, context.getBundle().getSymbolicName(), message));
}
}
public static void logException(String message, Throwable ex) {
if (context != null) {
log(new Status(IStatus.ERROR, context.getBundle().getSymbolicName(), message, ex));
}
}
public static void print(String message) {
out.print(message);
}
public static void println() {
out.println();
}
public static void println(String message) {
out.println(message);
}
}

Просмотреть файл

@ -0,0 +1,17 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.emitter;
import com.microsoft.java.lsif.core.internal.protocol.Element;
public interface Emitter {
void start();
void emit(Element element);
void end();
}

Просмотреть файл

@ -0,0 +1,57 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.emitter;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.protocol.Element;
public class JsonEmitter implements Emitter {
private boolean isFirst;
public JsonEmitter() {
this.isFirst = true;
}
/*
* (non-Javadoc)
*
* @see com.microsoft.java.lsif.core.internal.emitter.Emitter#start()
*/
@Override
public void start() {
LanguageServerIndexerPlugin.println("[");
}
/*
* (non-Javadoc)
*
* @see
* com.microsoft.java.lsif.core.internal.emitter.Emitter#emit(com.microsoft.java
* .lsif.core.internal.protocol.Element)
*/
@Override
public void emit(Element element) {
if (!isFirst) {
LanguageServerIndexerPlugin.println(",");
}
LanguageServerIndexerPlugin.print("\t");
LanguageServerIndexerPlugin.print(JsonParser.toJson(element));
this.isFirst = false;
}
/*
* (non-Javadoc)
*
* @see com.microsoft.java.lsif.core.internal.emitter.Emitter#end()
*/
@Override
public void end() {
if (!isFirst) {
LanguageServerIndexerPlugin.println();
}
LanguageServerIndexerPlugin.println("]");
}
}

Просмотреть файл

@ -0,0 +1,26 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.emitter;
import org.eclipse.lsp4j.adapters.HoverTypeAdapter;
import org.eclipse.lsp4j.jsonrpc.json.adapters.CollectionTypeAdapter;
import org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter;
import org.eclipse.lsp4j.jsonrpc.json.adapters.EnumTypeAdapter;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class JsonParser {
private static final Gson gson = new GsonBuilder().registerTypeAdapterFactory(new CollectionTypeAdapter.Factory())
.registerTypeAdapterFactory(new EnumTypeAdapter.Factory())
.registerTypeAdapterFactory(new HoverTypeAdapter.Factory())
.registerTypeAdapterFactory(new EitherTypeAdapter.Factory()).create();
public static String toJson(Object element) {
return gson.toJson(element);
}
}

Просмотреть файл

@ -0,0 +1,47 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.emitter;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.protocol.Element;
public class LineEmitter implements Emitter {
/*
* (non-Javadoc)
*
* @see com.microsoft.java.lsif.core.internal.emitter.Emitter#start()
*/
@Override
public void start() {
}
/*
* (non-Javadoc)
*
* @see
* com.microsoft.java.lsif.core.internal.emitter.Emitter#emit(com.microsoft.java
* .lsif.core.internal.protocol.Element)
*/
@Override
public void emit(Element element) {
LanguageServerIndexerPlugin.println(JsonParser.toJson(element));
}
/*
* (non-Javadoc)
*
* @see com.microsoft.java.lsif.core.internal.emitter.Emitter#end()
*/
@Override
public void end() {
}
}

Просмотреть файл

@ -0,0 +1,88 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import com.microsoft.java.lsif.core.internal.IConstant;
public final class ASTUtil {
/**
* Creates a new compilation unit AST.
*
* @param input the Java element for which to create the AST
* @param progressMonitor the progress monitor
* @return AST
*/
public static CompilationUnit createAST(final ITypeRoot input, final IProgressMonitor progressMonitor) {
if (progressMonitor != null && progressMonitor.isCanceled()) {
return null;
}
final CompilationUnit root[] = new CompilationUnit[1];
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() {
try {
if (progressMonitor != null && progressMonitor.isCanceled()) {
return;
}
if (input instanceof ICompilationUnit) {
ICompilationUnit cu = (ICompilationUnit) input;
if (cu.isWorkingCopy()) {
root[0] = cu.reconcile(IASTSharedValues.SHARED_AST_LEVEL, true, null, progressMonitor);
}
}
if (root[0] == null) {
final ASTParser parser = newASTParser();
parser.setSource(input);
root[0] = (CompilationUnit) parser.createAST(progressMonitor);
}
// mark as unmodifiable
ASTNodes.setFlagsToAST(root[0], ASTNode.PROTECT);
} catch (OperationCanceledException ex) {
return;
} catch (JavaModelException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
return;
}
}
@Override
public void handleException(Throwable ex) {
IStatus status = new Status(IStatus.ERROR, IConstant.PLUGIN_ID, IStatus.OK,
"Error in JDT Core during AST creation", ex); //$NON-NLS-1$
JavaLanguageServerPlugin.log(status);
}
});
return root[0];
}
public static ASTParser newASTParser() {
final ASTParser parser = ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL);
parser.setResolveBindings(true);
parser.setStatementsRecovery(IASTSharedValues.SHARED_AST_STATEMENT_RECOVERY);
parser.setBindingsRecovery(IASTSharedValues.SHARED_BINDING_RECOVERY);
return parser;
}
}

Просмотреть файл

@ -0,0 +1,70 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.Edge;
import com.microsoft.java.lsif.core.internal.protocol.Project;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ReferenceItem;
import com.microsoft.java.lsif.core.internal.protocol.Vertex;
public class EdgeBuilder {
private IdGenerator generator;
public EdgeBuilder(IdGenerator idGenerator) {
this.generator = idGenerator;
}
public Edge contains(Project from, Document to) {
return new Edge(generator.next(), Edge.CONTAINS, from.getId(), to.getId());
}
public Edge contains(Document from, Range to) {
return new Edge(generator.next(), Edge.CONTAINS, from.getId(), to.getId());
}
public Edge contains(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.CONTAINS, from.getId(), to.getId());
}
public Edge hover(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_HOVER, from.getId(), to.getId());
}
public Edge referenceItem(Vertex from, Vertex to, String property) {
return new ReferenceItem(generator.next(), Edge.ITEM, from.getId(), to.getId(), property);
}
public Edge definition(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_DEFINITION, from.getId(), to.getId());
}
public Edge typeDefinition(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_TYPEDEFINITION, from.getId(), to.getId());
}
public Edge references(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_REFERENCES, from.getId(), to.getId());
}
public Edge implementation(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_IMPLEMENTATION, from.getId(), to.getId());
}
public Edge documentSymbols(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_DOCUMENTSYMBOL, from.getId(), to.getId());
}
public Edge refersTo(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.REFERSTO, from.getId(), to.getId());
}
public Edge diagnostic(Vertex from, Vertex to) {
return new Edge(generator.next(), Edge.T_DIAGNOSTIC, from.getId(), to.getId());
}
}

Просмотреть файл

@ -0,0 +1,36 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import java.util.UUID;
public class IdGenerator {
public static enum IdType {
UUID, COUNTER
}
private int counter = 0;
public IdGenerator(IdType type) {
this.idtype = type;
}
private IdType idtype;
public String next() {
switch (idtype) {
case COUNTER:
counter++;
return String.valueOf(counter);
case UUID:
return UUID.randomUUID().toString();
default:
break;
}
return null;
}
}

Просмотреть файл

@ -0,0 +1,147 @@
package com.microsoft.java.lsif.core.internal.indexer;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.lsp4j.ClientCapabilities;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.emitter.JsonEmitter;
import com.microsoft.java.lsif.core.internal.emitter.LineEmitter;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.Project;
import com.microsoft.java.lsif.core.internal.visitors.DefinitionVisitor;
import com.microsoft.java.lsif.core.internal.visitors.DiagnosticVisitor;
import com.microsoft.java.lsif.core.internal.visitors.DocumentVisitor;
import com.microsoft.java.lsif.core.internal.visitors.HoverVisitor;
import com.microsoft.java.lsif.core.internal.visitors.ImplementationsVisitor;
import com.microsoft.java.lsif.core.internal.visitors.ProtocolVisitor;
import com.microsoft.java.lsif.core.internal.visitors.ReferencesVisitor;
import com.microsoft.java.lsif.core.internal.visitors.TypeDefinitionVisitor;
public class Indexer {
private WorkspaceHandler handler;
//@formatter:off
private List<ProtocolVisitor> visitors = Arrays.asList(
new DefinitionVisitor(),
new TypeDefinitionVisitor(),
new ImplementationsVisitor(),
new ReferencesVisitor(),
new HoverVisitor());
//@formatter:on
public Indexer() {
this.handler = new WorkspaceHandler(System.getProperty("intellinav.repo.path"));
}
public void generateLsif() throws JavaModelException {
NullProgressMonitor monitor = new NullProgressMonitor();
IPath path = this.handler.initialize();
initializeJdtls();
LsifService lsif = new LsifService();
Emitter emitter = this.createEmitter();
emitter.start();
emitter.emit(lsif.getVertexBuilder().metaData());
handler.importProject(path, monitor);
handler.buildProject(monitor);
buildIndex(path, monitor, emitter, lsif);
handler.removeProject(monitor);
emitter.end();
}
private void buildIndex(IPath path, IProgressMonitor monitor, Emitter emitter, LsifService lsif)
throws JavaModelException {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (IProject proj : projects) {
if (proj == null) {
return;
}
IJavaProject javaProject = JavaCore.create(proj);
if (!javaProject.exists()) {
continue;
}
Project projVertex = lsif.getVertexBuilder().project();
emitter.emit(projVertex);
IClasspathEntry[] references = javaProject.getRawClasspath();
for (IClasspathEntry reference : references) {
if (reference.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
IPackageFragmentRoot[] fragmentRoots = javaProject.findPackageFragmentRoots(reference);
for (IPackageFragmentRoot fragmentRoot : fragmentRoots) {
for (IJavaElement child : fragmentRoot.getChildren()) {
IPackageFragment fragment = (IPackageFragment) child;
if (fragment.hasChildren()) {
for (IJavaElement sourceFile : fragment.getChildren()) {
if (!sourceFile.exists()) {
continue;
}
CompilationUnit cu = ASTUtil.createAST((ITypeRoot) sourceFile, monitor);
IndexerContext currentContext = new IndexerContext(emitter, lsif, null,
(ITypeRoot) sourceFile, JavaLanguageServerPlugin.getPreferencesManager());
Document docVertex = (new DocumentVisitor(currentContext, projVertex))
.enlist(sourceFile);
currentContext.setDocVertex(docVertex);
for (ProtocolVisitor vis : this.visitors) {
vis.setContext(currentContext);
cu.accept(vis);
}
// Dump diagnostic information
DiagnosticVisitor diagnosticVisitor = new DiagnosticVisitor(currentContext, cu);
diagnosticVisitor.enlist();
}
}
}
}
}
}
}
}
private void initializeJdtls() {
Map<String, Object> extendedClientCapabilities = new HashMap<>();
extendedClientCapabilities.put("classFileContentsSupport", false);
JavaLanguageServerPlugin.getPreferencesManager().updateClientPrefences(new ClientCapabilities(),
extendedClientCapabilities);
}
private Emitter createEmitter() {
final String format = System.getProperty("intellinav.output.format", "line" /* default */);
switch (format) {
case "json":
return new JsonEmitter();
case "line":
return new LineEmitter();
default:
throw new RuntimeException("Unsupported output format: " + format);
}
}
}

Просмотреть файл

@ -0,0 +1,98 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.protocol.Document;
public class IndexerContext {
private Emitter emitter;
private LsifService lsif;
private Document docVertex;
private ITypeRoot typeRoot;
private PreferenceManager preferenceManger;
public IndexerContext(Emitter emitter, LsifService lsif, Document docVertex, ITypeRoot typeRoot,
PreferenceManager preferenceManager) {
this.setEmitter(emitter);
this.setLsif(lsif);
this.setDocVertex(docVertex);
this.setTypeRoot(typeRoot);
this.setPreferenceManger(preferenceManager);
}
public Emitter getEmitter() {
return this.emitter;
}
/**
* @return the lsif
*/
public LsifService getLsif() {
return lsif;
}
public Document getDocVertex() {
return this.docVertex;
}
/**
* @return the typeRoot
*/
public ITypeRoot getTypeRoot() {
return typeRoot;
}
/**
* @param typeRoot the typeRoot to set
*/
public void setTypeRoot(ITypeRoot typeRoot) {
this.typeRoot = typeRoot;
}
/**
* @param emitter the emitter to set
*/
public void setEmitter(Emitter emitter) {
this.emitter = emitter;
}
/**
* @param lsif the lsif to set
*/
public void setLsif(LsifService lsif) {
this.lsif = lsif;
}
/**
* @param docVertex the docVertex to set
*/
public void setDocVertex(Document docVertex) {
this.docVertex = docVertex;
}
/**
* @return the preferenceManger
*/
public PreferenceManager getPreferenceManger() {
return preferenceManger;
}
/**
* @param preferenceManger the preferenceManger to set
*/
public void setPreferenceManger(PreferenceManager preferenceManger) {
this.preferenceManger = preferenceManger;
}
}

Просмотреть файл

@ -0,0 +1,31 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import com.microsoft.java.lsif.core.internal.indexer.IdGenerator.IdType;
public class LsifService {
private IdGenerator generator;
private VertexBuilder vBuilder;
private EdgeBuilder eBuilder;
public LsifService() {
this.generator = new IdGenerator(IdType.COUNTER);
this.vBuilder = new VertexBuilder(generator);
this.eBuilder = new EdgeBuilder(generator);
}
public VertexBuilder getVertexBuilder() {
return this.vBuilder;
}
public EdgeBuilder getEdgeBuilder() {
return this.eBuilder;
}
}

Просмотреть файл

@ -0,0 +1,86 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import java.util.HashMap;
import java.util.Map;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.HoverResult;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public class Repository {
// Key: document URI
// Value: Document object
private Map<String, Document> documentMap = new HashMap<>();
// Key: document URI
// Value: ranges among the documents
// Key: LSP range
// LSIF: range
private Map<String, Map<org.eclipse.lsp4j.Range, Range>> rangeMap = new HashMap<>();
// Key: Range
// Value: ResultSet that range refers to
private Map<Range, ResultSet> resultSetMap = new HashMap<>();
// Key: Hash Code of the Hover Content
// Value: HoverResult
private Map<Integer, HoverResult> hoverResultMap = new HashMap<>();
private static Repository instance = new Repository();
private Repository() {
}
public static Repository getInstance() {
return instance;
}
public void addDocument(Document doc) {
this.documentMap.put(doc.getUri(), doc);
}
public void addRange(Document owner, org.eclipse.lsp4j.Range lspRange, Range range) {
Map<org.eclipse.lsp4j.Range, Range> ranges = this.rangeMap.computeIfAbsent(owner.getUri(),
s -> new HashMap<>());
ranges.putIfAbsent(lspRange, range);
}
public void addResultSet(Range range, ResultSet resultSet) {
this.resultSetMap.put(range, resultSet);
}
public void addHoverResult(int hashCode, HoverResult hoverResult) {
this.hoverResultMap.put(hashCode, hoverResult);
}
public Document findDocumentByUri(String uri) {
return this.documentMap.getOrDefault(uri, null);
}
public Document findDocumentById() {
throw new UnsupportedOperationException();
}
public Range findRange(String uri, org.eclipse.lsp4j.Range lspRange) {
Map<org.eclipse.lsp4j.Range, Range> ranges = rangeMap.get(uri);
if (ranges != null) {
return ranges.get(lspRange);
}
return null;
}
public ResultSet findResultSetByRange(Range range) {
return this.resultSetMap.getOrDefault(range, null);
}
public HoverResult findHoverResultByHashCode(int hashCode) {
return this.hoverResultMap.getOrDefault(hashCode, null);
}
}

Просмотреть файл

@ -0,0 +1,92 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import java.util.List;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import com.microsoft.java.lsif.core.internal.JdtlsUtils;
import com.microsoft.java.lsif.core.internal.protocol.DefinitionResult;
import com.microsoft.java.lsif.core.internal.protocol.DiagnosticResult;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.DocumentSymbolResult;
import com.microsoft.java.lsif.core.internal.protocol.HoverResult;
import com.microsoft.java.lsif.core.internal.protocol.ImplementationResult;
import com.microsoft.java.lsif.core.internal.protocol.MetaData;
import com.microsoft.java.lsif.core.internal.protocol.Project;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ReferenceResult;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
import com.microsoft.java.lsif.core.internal.protocol.TypeDefinitionResult;
public final class VertexBuilder {
private IdGenerator generator;
public VertexBuilder(IdGenerator generator) {
this.generator = generator;
}
public MetaData metaData() {
return new MetaData(generator.next());
}
public Project project() {
return new Project(generator.next());
}
public Document document(String uri) {
uri = JdtlsUtils.normalizeUri(uri);
Document res = new Document(generator.next(), uri);
return res;
}
public Range range(org.eclipse.lsp4j.Range lspRange) {
return new Range(generator.next(), lspRange.getStart(), lspRange.getEnd());
}
public ResultSet resultSet() {
return new ResultSet(generator.next());
}
public DefinitionResult definitionResult(String resultId) {
return new DefinitionResult(generator.next(), resultId);
}
public HoverResult hoverResult(Hover hover) {
return new HoverResult(generator.next(), hover);
}
public TypeDefinitionResult typeDefinitionResult(String resultId) {
return new TypeDefinitionResult(generator.next(), resultId);
}
public ReferenceResult referenceResult() {
return new ReferenceResult(generator.next());
}
public ReferenceResult referenceResult(List<String> declarations, List<String> definitions, List<String> references,
List<String> referenceResults) {
return new ReferenceResult(generator.next(), declarations, definitions, references, referenceResults);
}
public ImplementationResult implementationResult(List<Either<String, Location>> result) {
return new ImplementationResult(generator.next(), result);
}
public DocumentSymbolResult documentSymbolResult(List<DocumentSymbol> symbols) {
return new DocumentSymbolResult(generator.next(), symbols);
}
public DiagnosticResult diagnosticResult(List<Diagnostic> diagnostics) {
return new DiagnosticResult(generator.next(), diagnostics);
}
}

Просмотреть файл

@ -0,0 +1,158 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.indexer;
import java.io.File;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jdt.ls.core.internal.BuildWorkspaceStatus;
import org.eclipse.jdt.ls.core.internal.IConstants;
import org.eclipse.jdt.ls.core.internal.IProjectImporter;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jdt.ls.core.internal.ResourceUtils;
import org.eclipse.jdt.ls.core.internal.managers.GradleBuildSupport;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
public class WorkspaceHandler {
private String workspaceFolder;
public WorkspaceHandler(String workspaceFolder) {
this.workspaceFolder = workspaceFolder;
}
public IPath initialize() {
NullProgressMonitor monitor = new NullProgressMonitor();
try {
deleteInvalidProjects(monitor);
GradleBuildSupport.cleanGradleModels(monitor);
} catch (OperationCanceledException e) {
}
if (StringUtils.isEmpty(workspaceFolder)) {
throw new RuntimeException("Build path is not specified.");
}
File projectDir = new File(workspaceFolder);
if (!projectDir.isDirectory()) {
throw new RuntimeException("Build path should be a directory.");
}
return getProjectPathIfValid(projectDir);
}
public void importProject(IPath path, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
File rootFolder = path.toFile();
IProjectImporter importer;
try {
importer = getImporter(rootFolder, subMonitor.split(30));
if (importer != null) {
importer.importToWorkspace(subMonitor.split(70));
}
} catch (OperationCanceledException | CoreException e) {
e.printStackTrace();
}
}
public BuildWorkspaceStatus buildProject(IProgressMonitor monitor) {
try {
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
// ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE,
// monitor);
if (monitor.isCanceled()) {
return BuildWorkspaceStatus.CANCELLED;
}
return BuildWorkspaceStatus.SUCCEED;
} catch (CoreException e) {
LanguageServerIndexerPlugin.logException("Failed to build workspace.", e);
return BuildWorkspaceStatus.FAILED;
} catch (OperationCanceledException e) {
return BuildWorkspaceStatus.CANCELLED;
}
}
public IProjectImporter getImporter(File rootFolder, IProgressMonitor monitor)
throws OperationCanceledException, CoreException {
Collection<IProjectImporter> importers = importers();
SubMonitor subMonitor = SubMonitor.convert(monitor, importers.size());
for (IProjectImporter importer : importers) {
importer.initialize(rootFolder);
if (importer.applies(subMonitor.split(1))) {
return importer;
}
}
return null;
}
private Collection<IProjectImporter> importers() {
Map<Integer, IProjectImporter> importers = new TreeMap<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IConstants.PLUGIN_ID,
"importers");
IConfigurationElement[] configs = extensionPoint.getConfigurationElements();
for (int i = 0; i < configs.length; i++) {
try {
Integer order = Integer.valueOf(configs[i].getAttribute("order"));
importers.put(order, (IProjectImporter) configs[i].createExecutableExtension("class")); //$NON-NLS-1$
} catch (CoreException e) {
JavaLanguageServerPlugin.log(e.getStatus());
}
}
return importers.values();
}
private static IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
private void deleteInvalidProjects(IProgressMonitor monitor) {
for (IProject project : getWorkspaceRoot().getProjects()) {
try {
project.delete(false, true, monitor);
} catch (CoreException e1) {
JavaLanguageServerPlugin.logException(e1.getMessage(), e1);
}
}
}
private IPath getProjectPathIfValid(File f) {
if (f.isDirectory() && ((new File(f.getAbsolutePath(), "pom.xml")).exists()
|| (new File(f.getAbsolutePath(), "build.gradle")).exists())) {
return ResourceUtils.filePathFromURI(f.toURI().toString());
}
throw new RuntimeException(
"Failed to find project to index. Please make sure there is a valid 'pom.xml' or 'build.gradle' under the project base path.");
}
public void removeProject(IProgressMonitor monitor) {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
try {
for (IProject proj : projects) {
proj.getProject().delete(false, true, monitor);
}
} catch (CoreException e) {
e.printStackTrace();
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import org.eclipse.lsp4j.SymbolKind;
public class DeclarationTag extends Tag {
private SymbolKind kind;
private org.eclipse.lsp4j.Range fullRange;
public DeclarationTag(String text) {
super(Tag.DECLARATION, text);
}
}

Просмотреть файл

@ -0,0 +1,21 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class DefinitionResult extends Vertex {
// TODO: Support bag result.
private String result;
public DefinitionResult(String id, String result) {
super(id, Vertex.DEFINITIONRESULT);
this.result = result;
}
public String getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,57 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import org.eclipse.lsp4j.SymbolKind;
public class DefinitionTag extends Tag {
/**
* The symbol kind.
*/
private SymbolKind kind;
/**
* Indicates if this symbol is deprecated.
*/
private Boolean deprecated;
/**
* The full range of the definition not including leading/trailing whitespace
* but everything else, e.g comments and code. The range must be included in
* fullRange.
*/
private org.eclipse.lsp4j.Range fullRange;
/**
* Optional detail information for the definition.
*/
private String detail;
public DefinitionTag(String text, SymbolKind kind, Boolean deprecated, org.eclipse.lsp4j.Range fullRange, String detail) {
super(Tag.DEFINITION, text);
this.kind = kind;
this.deprecated = deprecated;
this.fullRange = fullRange;
this.detail = detail;
}
public SymbolKind getKind() {
return this.kind;
}
public Boolean getDeprecated() {
return this.deprecated;
}
public org.eclipse.lsp4j.Range getFullRange() {
return this.fullRange;
}
public String getDetail() {
return this.detail;
}
}

Просмотреть файл

@ -0,0 +1,25 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import java.util.List;
import org.eclipse.lsp4j.Diagnostic;
public class DiagnosticResult extends Vertex {
private List<Diagnostic> result;
public DiagnosticResult(String id, List<Diagnostic> result) {
super(id, Vertex.DIAGNOSTICRESULT);
this.result = result;
}
public List<Diagnostic> getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,29 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import com.microsoft.java.lsif.core.internal.IConstant;
public class Document extends Vertex {
private String uri;
private String languageId;
public Document(String id, String uri) {
super(id, Vertex.DOCUMENT);
this.uri = uri;
this.languageId = IConstant.JAVA_ID;
}
public String getUri() {
return this.uri;
}
public String getLanguageId() {
return this.languageId;
}
}

Просмотреть файл

@ -0,0 +1,25 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import java.util.List;
import org.eclipse.lsp4j.DocumentSymbol;
public class DocumentSymbolResult extends Vertex {
// TODO: Support bag result.
private List<DocumentSymbol> result;
public DocumentSymbolResult(String id, List<DocumentSymbol> result) {
super(id, Vertex.DOCUMENTSYMBOLRESULT);
this.result = result;
}
public List<DocumentSymbol> getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,57 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class Edge extends Element {
public final static String CONTAINS = "contains";
public final static String ITEM = "item";
public final static String REFERSTO = "refersTo";
public final static String EXPORTS = "exports";
public final static String IMPORTS = "imports";
public final static String T_DOCUMENTSYMBOL = "textDocument/documentSymbol";
public final static String T_FOLDINGRANGE = "textDocument/foldingRange";
public final static String T_DOCUMENTLINK = "textDocument/documentLink";
public final static String T_DIAGNOSTIC = "textDocument/diagnostic";
public final static String T_DEFINITION = "textDocument/definition";
public final static String T_DECLARATION = "textDocument/declaration";
public final static String T_TYPEDEFINITION = "textDocument/typeDefinition";
public final static String T_HOVER = "textDocument/hover";
public final static String T_REFERENCES = "textDocument/references";
public final static String T_IMPLEMENTATION = "textDocument/implementation";
private String outV;
private String inV;
public Edge(String id, String label, String outV, String inV) {
super(id, Element.EDGE, label);
this.outV = outV;
this.inV = inV;
}
public String getOutV() {
return this.outV;
}
public String getInV() {
return this.inV;
}
}

Просмотреть файл

@ -0,0 +1,37 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public abstract class Element {
public final static String VERTEX = "vertex";
public final static String EDGE = "edge";
private String id;
private String type;
private String label;
public Element(String id, String type, String label) {
this.id = id;
this.type = type;
this.label = label;
}
public String getId() {
return this.id;
}
public String getType() {
return this.type;
}
public String getLabel() {
return this.label;
}
}

Просмотреть файл

@ -0,0 +1,23 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import org.eclipse.lsp4j.Hover;
public class HoverResult extends Vertex {
public Hover result;
public HoverResult(String id, Hover result) {
super(id, Vertex.HOVERRESULT);
this.result = result;
}
public Hover getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,25 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import java.util.List;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
public class ImplementationResult extends Vertex {
private List<Either<String, Location>> result;
public ImplementationResult(String id, List<Either<String, Location>> result) {
super(id, Vertex.IMPLEMENTATIONRESULT);
this.result = result;
}
public List<Either<String, Location>> getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,18 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import com.microsoft.java.lsif.core.internal.IConstant;
public class MetaData extends Vertex {
public String version;
public MetaData(String id) {
super(id, Vertex.METADATA);
this.version = IConstant.LSIF_FORMAT_VERSION;
}
}

Просмотреть файл

@ -0,0 +1,20 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class Project extends Vertex {
private String kind;
public Project(String id) {
super(id, Vertex.PROJECT);
this.kind = "java";
}
public String getKind() {
return this.kind;
}
}

Просмотреть файл

@ -0,0 +1,85 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import org.eclipse.lsp4j.Position;
public class Range extends Vertex {
private Position start;
private Position end;
private Tag tag;
public Range(String id, Position start, Position end) {
super(id, Vertex.RANGE);
this.start = start;
this.end = end;
}
public Range(String id, Position start, Position end, Tag tag) {
this(id, start, end);
this.tag = tag;
}
public static Range fromLspRange(String id, org.eclipse.lsp4j.Range lspRange) {
return new Range(id, lspRange.getStart(), lspRange.getEnd());
}
public static Range fromLspRange(String id, org.eclipse.lsp4j.Range lspRange, Tag tag) {
return new Range(id, lspRange.getStart(), lspRange.getEnd(), tag);
}
public Position getStart() {
return this.start;
}
public Position getEnd() {
return this.end;
}
public Tag getTag() {
return this.tag;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Range other = (Range) obj;
if (this.start == null) {
if (other.start != null) {
return false;
}
} else if (!this.start.equals(other.start)) {
return false;
}
if (this.end == null) {
if (other.end != null) {
return false;
}
} else if (!this.end.equals(other.end)) {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.start == null) ? 0 : this.start.hashCode());
return prime * result + ((this.end == null) ? 0 : this.end.hashCode());
}
}

Просмотреть файл

@ -0,0 +1,26 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class ReferenceItem extends Edge {
public final static String DECLARATION = "declaration";
public final static String DEFINITION = "definition";
public final static String REFERENCE = "reference";
private String property;
public ReferenceItem(String id, String label, String outV, String inV, String property) {
super(id, label, outV, inV);
this.property = property;
}
public String getProperty() {
return this.property;
}
}

Просмотреть файл

@ -0,0 +1,47 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import java.util.List;
public class ReferenceResult extends Vertex {
private List<String> declarations;
private List<String> definitions;
private List<String> references;
private List<String> referenceResults;
public ReferenceResult(String id) {
super(id, Vertex.REFERENCERESULT);
}
public ReferenceResult(String id, List<String> declarations, List<String> definitions, List<String> references, List<String> referenceResults) {
super(id, Vertex.REFERENCERESULT);
this.declarations = declarations;
this.definitions = definitions;
this.references = references;
this.referenceResults = referenceResults;
}
public List<String> getDeclarations() {
return this.declarations;
}
public List<String> getDefinitions() {
return this.definitions;
}
public List<String> getReferences() {
return this.references;
}
public List<String> getReferenceResults() {
return this.referenceResults;
}
}

Просмотреть файл

@ -0,0 +1,13 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class ResultSet extends Vertex {
public ResultSet(String id) {
super(id, Vertex.RESULTSET);
}
}

Просмотреть файл

@ -0,0 +1,34 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public abstract class Tag {
public static final String DECLARATION = "declaration";
public static final String DEFINITION = "definition";
public static final String REFERENCE = "reference";
public static final String UNKNOWN = "unknown";
private String type;
private String text;
public Tag(String type, String text) {
this.type = type;
this.text = text;
}
public String getType() {
return this.type;
}
public String getText() {
return this.text;
}
}

Просмотреть файл

@ -0,0 +1,23 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
import java.util.Arrays;
import java.util.List;
public class TypeDefinitionResult extends Vertex {
private List<String> result;
public TypeDefinitionResult(String id, String result) {
super(id, Vertex.TYPEDEFINITIONRESULT);
this.result = Arrays.asList(result);
}
public List<String> getResult() {
return this.result;
}
}

Просмотреть файл

@ -0,0 +1,49 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.protocol;
public class Vertex extends Element {
public static final String METADATA = "metaData";
public static final String PROJECT = "project";
public static final String RANGE = "range";
public static final String LOCATION = "location";
public static final String DOCUMENT = "document";
public static final String EXTERNALIMPORTITEM = "externalImportItem";
public static final String EXPORTITEM = "exportItem";
public static final String RESULTSET = "resultSet";
public static final String DOCUMENTSYMBOLRESULT = "documentSymbolResult";
public static final String FOLDINGRANGERESULT = "foldingRangeResult";
public static final String DOCUMENTLINKRESULT = "documentLinkResult";
public static final String DIAGNOSTICRESULT = "diagnosticResult";
public static final String DECLARATIONRESULT = "declarationResult";
public static final String DEFINITIONRESULT = "definitionResult";
public static final String TYPEDEFINITIONRESULT = "typeDefinitionResult";
public static final String HOVERRESULT = "hoverResult";
public static final String REFERENCERESULT = "referenceResult";
public static final String IMPLEMENTATIONRESULT = "implementationResult";
public Vertex(String id, String label) {
super(id, Element.VERTEX, label);
}
}

Просмотреть файл

@ -0,0 +1,94 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager;
import org.eclipse.lsp4j.Location;
import com.microsoft.java.lsif.core.internal.JdtlsUtils;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.DefinitionResult;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public class DefinitionVisitor extends ProtocolVisitor {
public DefinitionVisitor() {
}
@Override
public boolean visit(SimpleName node) {
emitDefinition(node.getStartPosition(), node.getLength());
return false;
}
@Override
public boolean visit(SingleVariableDeclaration node) {
Type declarationType = node.getType();
emitDefinition(declarationType.getStartPosition(), declarationType.getLength());
return false;
}
@Override
public boolean visit(SimpleType node) {
emitDefinition(node.getStartPosition(), node.getLength());
return false;
}
private void emitDefinition(int startPosition, int length) {
try {
org.eclipse.lsp4j.Range fromRange = JDTUtils.toRange(this.getContext().getTypeRoot(), startPosition,
length);
IJavaElement element = JDTUtils.findElementAtSelection(this.getContext().getTypeRoot(),
fromRange.getStart().getLine(), fromRange.getStart().getCharacter(), new PreferenceManager(),
new NullProgressMonitor());
if (element == null) {
return;
}
Location targetLocation = JdtlsUtils.getElementLocation(element);
if (targetLocation == null) {
return;
}
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
Document docVertex = this.getContext().getDocVertex();
// Source range:
Range sourceRange = this.enlistRange(docVertex, fromRange);
// Target range:
org.eclipse.lsp4j.Range toRange = targetLocation.getRange();
Document targetDocument = this.enlistDocument(targetLocation.getUri());
Range targetRange = this.enlistRange(targetDocument, toRange);
// Result set
ResultSet resultSet = this.enlistResultSet(sourceRange);
// Link resultSet & definitionResult
DefinitionResult defResult = lsif.getVertexBuilder().definitionResult(targetRange.getId());
emitter.emit(defResult);
emitter.emit(lsif.getEdgeBuilder().definition(resultSet, defResult));
} catch (CoreException ex) {
LanguageServerIndexerPlugin.logException("Exception in definition visitor: ", ex);
}
}
}

Просмотреть файл

@ -0,0 +1,141 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaModelMarker;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.DiagnosticSeverity;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
import org.eclipse.m2e.core.internal.IMavenConstants;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.IndexerContext;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.DiagnosticResult;
import com.microsoft.java.lsif.core.internal.protocol.Document;
public class DiagnosticVisitor extends ProtocolVisitor {
private CompilationUnit cu;
public DiagnosticVisitor(IndexerContext context, CompilationUnit cu) {
this.setContext(context);
this.cu = cu;
}
public void enlist() {
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
Document docVertex = this.getContext().getDocVertex();
IResource resource = cu.getJavaElement().getResource();
if (resource == null || !resource.exists()) {
LanguageServerIndexerPlugin.logError("Cannot find resource for: " + cu.getJavaElement().getElementName());
return;
}
IMarker[] markers = null;
IDocument document = null;
try {
IMarker[] javaMarkers = resource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false,
IResource.DEPTH_ONE);
IMarker[] taskMarkers = resource.findMarkers(IJavaModelMarker.TASK_MARKER, false, IResource.DEPTH_ONE);
int totalLength = javaMarkers.length + taskMarkers.length;
if (totalLength == 0) {
return;
}
markers = Arrays.copyOf(javaMarkers, javaMarkers.length + taskMarkers.length);
System.arraycopy(taskMarkers, 0, markers, javaMarkers.length, taskMarkers.length);
document = JsonRpcHelpers.toDocument(cu.getJavaElement().getOpenable().getBuffer());
} catch (CoreException ex) {
LanguageServerIndexerPlugin.logException("Exception when dumping diagnostics ", ex);
return;
}
if (document == null) {
LanguageServerIndexerPlugin
.logError("Cannot parse the document for: " + cu.getJavaElement().getElementName());
return;
}
List<Diagnostic> diagnostics = toDiagnosticsArray(document, markers);
DiagnosticResult diagnosticResult = lsif.getVertexBuilder().diagnosticResult(diagnostics);
emitter.emit(diagnosticResult);
emitter.emit(lsif.getEdgeBuilder().diagnostic(docVertex, diagnosticResult));
}
private List<Diagnostic> toDiagnosticsArray(IDocument document, IMarker[] markers) {
List<Diagnostic> diagnostics = Stream.of(markers).map(m -> toDiagnostic(document, m)).filter(d -> d != null)
.collect(Collectors.toList());
return diagnostics;
}
private static Diagnostic toDiagnostic(IDocument document, IMarker marker) {
if (marker == null || !marker.exists()) {
return null;
}
Diagnostic d = new Diagnostic();
d.setSource(JavaLanguageServerPlugin.SERVER_SOURCE_ID);
d.setMessage(marker.getAttribute(IMarker.MESSAGE, ""));
d.setCode(String.valueOf(marker.getAttribute(IJavaModelMarker.ID, 0)));
d.setSeverity(convertSeverity(marker.getAttribute(IMarker.SEVERITY, -1)));
d.setRange(convertRange(document, marker));
return d;
}
private static Range convertRange(IDocument document, IMarker marker) {
int line = marker.getAttribute(IMarker.LINE_NUMBER, -1) - 1;
int cStart = 0;
int cEnd = 0;
try {
// Buildship doesn't provide markers for gradle files, Maven does
if (marker.isSubtypeOf(IMavenConstants.MARKER_ID)) {
cStart = marker.getAttribute(IMavenConstants.MARKER_COLUMN_START, -1);
cEnd = marker.getAttribute(IMavenConstants.MARKER_COLUMN_END, -1);
} else {
int lineOffset = 0;
try {
lineOffset = document.getLineOffset(line);
} catch (BadLocationException unlikelyException) {
JavaLanguageServerPlugin.logException(unlikelyException.getMessage(), unlikelyException);
return new Range(new Position(line, 0), new Position(line, 0));
}
cEnd = marker.getAttribute(IMarker.CHAR_END, -1) - lineOffset;
cStart = marker.getAttribute(IMarker.CHAR_START, -1) - lineOffset;
}
} catch (CoreException e) {
LanguageServerIndexerPlugin.logException(e.getMessage(), e);
}
cStart = Math.max(0, cStart);
cEnd = Math.max(0, cEnd);
return new Range(new Position(line, cStart), new Position(line, cEnd));
}
private static DiagnosticSeverity convertSeverity(int severity) {
if (severity == IMarker.SEVERITY_ERROR) {
return DiagnosticSeverity.Error;
}
if (severity == IMarker.SEVERITY_WARNING) {
return DiagnosticSeverity.Warning;
}
return DiagnosticSeverity.Information;
}
}

Просмотреть файл

@ -0,0 +1,63 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.List;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.ls.core.internal.ResourceUtils;
import org.eclipse.jdt.ls.core.internal.handlers.DocumentSymbolHandler;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.DocumentSymbolParams;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import com.microsoft.java.lsif.core.internal.indexer.IndexerContext;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.DocumentSymbolResult;
import com.microsoft.java.lsif.core.internal.protocol.Project;
public class DocumentVisitor extends ProtocolVisitor {
private Project projVertex;
public DocumentVisitor(IndexerContext context, Project projVertex) {
this.setContext(context);
this.projVertex = projVertex;
}
public Document enlist(IJavaElement sourceFile) {
String uri = ResourceUtils.fixURI(sourceFile.getResource().getRawLocationURI());
Document docVertex = this.enlistDocument(uri);
this.getContext().getEmitter()
.emit(this.getContext().getLsif().getEdgeBuilder().contains(projVertex, docVertex));
handleDocumentSymbol(docVertex);
return docVertex;
}
// TODO: Refine the symbol to range-based
private void handleDocumentSymbol(Document docVertex) {
List<DocumentSymbol> symbols = this.handle(docVertex.getUri());
DocumentSymbolResult documentSymbolResult = this.getContext().getLsif().getVertexBuilder()
.documentSymbolResult(symbols);
this.getContext().getEmitter().emit(documentSymbolResult);
this.getContext().getEmitter()
.emit(this.getContext().getLsif().getEdgeBuilder().documentSymbols(docVertex, documentSymbolResult));
}
private List<DocumentSymbol> handle(String uri) {
DocumentSymbolParams documentSymbolParams = new DocumentSymbolParams(new TextDocumentIdentifier(uri));
DocumentSymbolHandler proxy = new DocumentSymbolHandler(true);
List<Either<SymbolInformation, DocumentSymbol>> result = proxy.documentSymbol(documentSymbolParams,
new NullProgressMonitor());
return result.stream().map(either -> either.getRight()).collect(Collectors.toList());
}
}

Просмотреть файл

@ -0,0 +1,114 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.handlers.HoverHandler;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.MarkedString;
import org.eclipse.lsp4j.MarkupContent;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.HoverResult;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public class HoverVisitor extends ProtocolVisitor {
public HoverVisitor() {
}
@Override
public boolean visit(SimpleType type) {
emitHover(type.getStartPosition(), type.getLength());
return false;
}
@Override
public boolean visit(SimpleName node) {
emitHover(node.getStartPosition(), node.getLength());
return false;
}
private void emitHover(int startPosition, int length) {
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
Document docVertex = this.getContext().getDocVertex();
try {
org.eclipse.lsp4j.Range fromRange = JDTUtils.toRange(this.getContext().getTypeRoot(), startPosition,
length);
// Link resultSet & definitionResult
Hover result = hover(fromRange.getStart().getLine(), fromRange.getStart().getCharacter());
if (isEmpty(result)) {
return;
}
// Source range:
Range sourceRange = this.enlistRange(docVertex, fromRange);
// Result set
ResultSet resultSet = this.enlistResultSet(sourceRange);
HoverResult hoverResult = this.enlistHoverResult(result);
emitter.emit(lsif.getEdgeBuilder().hover(resultSet, hoverResult));
} catch (CoreException e) {
LanguageServerIndexerPlugin.log(e);
}
}
private Hover hover(int line, int character) {
TextDocumentPositionParams params = new TextDocumentPositionParams(
new TextDocumentIdentifier(this.getContext().getDocVertex().getUri()), new Position(line, character));
HoverHandler proxy = new HoverHandler(this.getContext().getPreferenceManger());
return proxy.hover(params, new NullProgressMonitor());
}
/**
* Check if the hover is empty or not.
*
* @param hover The {@link org.eclipse.lsp4j.Hover} returned from LSFJ.
* @return
*/
private boolean isEmpty(Hover hover) {
Either<List<Either<String, MarkedString>>, MarkupContent> content = hover.getContents();
if (content == null) {
return true;
}
if (content.isRight()) {
return false;
}
List<Either<String, MarkedString>> list = content.getLeft();
if (list == null || list.size() == 0) {
return true;
}
for (Either<String, MarkedString> either : list) {
if (StringUtils.isNotEmpty(either.getLeft()) || either.isRight()) {
return false;
}
}
return true;
}
}

Просмотреть файл

@ -0,0 +1,102 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.handlers.ImplementationsHandler;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.ImplementationResult;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public class ImplementationsVisitor extends ProtocolVisitor {
public ImplementationsVisitor() {
}
@Override
public boolean visit(SimpleName node) {
if (node.getParent() instanceof TypeDeclaration) {
this.emitImplementation(node.getStartPosition(), node.getLength());
}
return false;
}
@Override
public boolean visit(SimpleType node) {
if (node.getParent() instanceof TypeDeclaration) {
this.emitImplementation(node.getStartPosition(), node.getLength());
}
return false;
}
private void emitImplementation(int startPosition, int length) {
org.eclipse.lsp4j.Range fromRange;
try {
fromRange = JDTUtils.toRange(this.getContext().getTypeRoot(), startPosition, length);
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
List<Range> ranges = getImplementationRanges(fromRange.getStart().getLine(),
fromRange.getStart().getCharacter());
if (ranges == null || ranges.size() == 0) {
return;
}
// Source range:
Range sourceRange = this.enlistRange(this.getContext().getDocVertex(), fromRange);
// Result set
ResultSet resultSet = this.enlistResultSet(sourceRange);
// ImplementationResult
List<Either<String, Location>> result = ranges.stream()
.map(r -> Either.<String, Location>forLeft(r.getId())).collect(Collectors.toList());
ImplementationResult implResult = lsif.getVertexBuilder().implementationResult(result);
emitter.emit(implResult);
emitter.emit(lsif.getEdgeBuilder().implementation(resultSet, implResult));
} catch (CoreException ex) {
LanguageServerIndexerPlugin.logException("Exception when visiting implementation ", ex);
}
}
private List<Range> getImplementationRanges(int line, int character) {
List<? extends Location> locations = getImplementations(line, character);
if (locations == null) {
return Collections.emptyList();
}
return locations.stream().map(loc -> this.enlistRange(loc.getUri(), loc.getRange())).filter(r -> r != null)
.collect(Collectors.toList());
}
public List<? extends Location> getImplementations(int line, int character) {
TextDocumentPositionParams params = new TextDocumentPositionParams(
new TextDocumentIdentifier(this.getContext().getDocVertex().getUri()), new Position(line, character));
ImplementationsHandler proxy = new ImplementationsHandler(this.getContext().getPreferenceManger());
return proxy.findImplementations(params, new NullProgressMonitor());
}
}

Просмотреть файл

@ -0,0 +1,90 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.lsp4j.Hover;
import com.microsoft.java.lsif.core.internal.JdtlsUtils;
import com.microsoft.java.lsif.core.internal.indexer.IndexerContext;
import com.microsoft.java.lsif.core.internal.indexer.Repository;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.HoverResult;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public abstract class ProtocolVisitor extends ASTVisitor {
private IndexerContext context;
/**
* Constructor
*/
public ProtocolVisitor() {
}
public IndexerContext getContext() {
return this.context;
}
public void setContext(IndexerContext context) {
this.context = context;
}
public Document enlistDocument(String uri) {
Repository repo = Repository.getInstance();
uri = JdtlsUtils.normalizeUri(uri);
Document targetDocument = repo.findDocumentByUri(uri);
if (targetDocument == null) {
targetDocument = this.context.getLsif().getVertexBuilder().document(uri);
repo.addDocument(targetDocument);
this.context.getEmitter().emit(targetDocument);
}
return targetDocument;
}
public ResultSet enlistResultSet(Range range) {
Repository repo = Repository.getInstance();
ResultSet resultSet = repo.findResultSetByRange(range);
if (resultSet == null) {
resultSet = this.context.getLsif().getVertexBuilder().resultSet();
repo.addResultSet(range, resultSet);
this.context.getEmitter().emit(resultSet);
this.context.getEmitter().emit(this.context.getLsif().getEdgeBuilder().refersTo(range, resultSet));
}
return resultSet;
}
public Range enlistRange(Document docVertex, org.eclipse.lsp4j.Range lspRange) {
Repository repo = Repository.getInstance();
Range range = repo.findRange(docVertex.getUri(), lspRange);
if (range == null) {
range = this.context.getLsif().getVertexBuilder().range(lspRange);
repo.addRange(docVertex, lspRange, range);
this.context.getEmitter().emit(range);
this.context.getEmitter().emit(this.context.getLsif().getEdgeBuilder().contains(docVertex, range));
}
return range;
}
public HoverResult enlistHoverResult(Hover hover) {
Repository repo = Repository.getInstance();
int contentHash = hover.getContents().hashCode();
HoverResult hoverResult = repo.findHoverResultByHashCode(contentHash);
if (hoverResult == null) {
hoverResult = this.context.getLsif().getVertexBuilder().hoverResult(hover);
this.context.getEmitter().emit(hoverResult);
repo.addHoverResult(contentHash, hoverResult);
}
return hoverResult;
}
public Range enlistRange(String uri, org.eclipse.lsp4j.Range lspRange) {
return this.enlistRange(this.enlistDocument(uri), lspRange);
}
}

Просмотреть файл

@ -0,0 +1,104 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.List;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.ReferenceContext;
import org.eclipse.lsp4j.ReferenceParams;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ReferenceItem;
import com.microsoft.java.lsif.core.internal.protocol.ReferenceResult;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
public class ReferencesVisitor extends ProtocolVisitor {
public ReferencesVisitor() {
}
@Override
public boolean visit(SimpleType type) {
emitReferences(type.getStartPosition(), type.getLength());
return false;
}
@Override
public boolean visit(SimpleName node) {
emitReferences(node.getStartPosition(), node.getLength());
return false;
}
public void emitReferences(int startPosition, int length) {
try {
org.eclipse.lsp4j.Range fromRange = JDTUtils.toRange(this.getContext().getTypeRoot(), startPosition,
length);
if (fromRange == null) {
return;
}
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
List<Range> ranges = getReferenceRanges(fromRange.getStart().getLine(),
fromRange.getStart().getCharacter());
if (ranges == null || ranges.size() == 0) {
return;
}
// Source range:
Range sourceRange = this.enlistRange(this.getContext().getDocVertex(), fromRange);
// Result set
ResultSet resultSet = this.enlistResultSet(sourceRange);
// ReferenceResult
ReferenceResult refResult = lsif.getVertexBuilder().referenceResult();
emitter.emit(refResult);
emitter.emit(lsif.getEdgeBuilder().references(resultSet, refResult));
for (Range r : ranges) {
emitter.emit(lsif.getEdgeBuilder().referenceItem(refResult, r, ReferenceItem.REFERENCE));
}
} catch (
CoreException ex) {
LanguageServerIndexerPlugin.logException("Exception in visit references ", ex);
}
}
private List<Range> getReferenceRanges(int line, int character) {
List<Location> locations = getReferenceLocations(line, character);
return locations.stream().map(loc -> this.enlistRange(loc.getUri(), loc.getRange())).filter(r -> r != null)
.collect(Collectors.toList());
}
private List<Location> getReferenceLocations(int line, int character) {
ReferenceParams params = new ReferenceParams(new ReferenceContext(true));
params.setTextDocument(new TextDocumentIdentifier(this.getContext().getDocVertex().getUri()));
params.setPosition(new Position(line, character));
org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler proxy = new org.eclipse.jdt.ls.core.internal.handlers.ReferencesHandler(
this.getContext().getPreferenceManger());
List<Location> references = proxy.findReferences(params, new NullProgressMonitor());
return references;
}
}

Просмотреть файл

@ -0,0 +1,104 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
package com.microsoft.java.lsif.core.internal.visitors;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.handlers.NavigateToTypeDefinitionHandler;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import com.microsoft.java.lsif.core.internal.LanguageServerIndexerPlugin;
import com.microsoft.java.lsif.core.internal.emitter.Emitter;
import com.microsoft.java.lsif.core.internal.indexer.LsifService;
import com.microsoft.java.lsif.core.internal.protocol.Document;
import com.microsoft.java.lsif.core.internal.protocol.Range;
import com.microsoft.java.lsif.core.internal.protocol.ResultSet;
import com.microsoft.java.lsif.core.internal.protocol.TypeDefinitionResult;
public class TypeDefinitionVisitor extends ProtocolVisitor {
public TypeDefinitionVisitor() {
}
@Override
public boolean visit(SimpleName node) {
emitTypeDefinition(node.getStartPosition(), node.getLength());
return false;
}
@Override
public boolean visit(SingleVariableDeclaration node) {
Type declarationType = node.getType();
emitTypeDefinition(declarationType.getStartPosition(), declarationType.getLength());
return false;
}
@Override
public boolean visit(SimpleType node) {
emitTypeDefinition(node.getStartPosition(), node.getLength());
return false;
}
private void emitTypeDefinition(int startPosition, int length) {
try {
org.eclipse.lsp4j.Range fromRange = JDTUtils.toRange(this.getContext().getTypeRoot(), startPosition,
length);
if (fromRange == null) {
return;
}
Location targetLocation = computeTypeDefinitionNavigation(fromRange.getStart().getLine(),
fromRange.getStart().getCharacter());
if (targetLocation == null) {
return;
}
Emitter emitter = this.getContext().getEmitter();
LsifService lsif = this.getContext().getLsif();
Document docVertex = this.getContext().getDocVertex();
// Definition start position
// Source range:
Range sourceRange = this.enlistRange(docVertex, fromRange);
// Target range:
org.eclipse.lsp4j.Range toRange = targetLocation.getRange();
Document targetDocument = this.enlistDocument(targetLocation.getUri());
Range targetRange = this.enlistRange(targetDocument, toRange);
// Result set
ResultSet resultSet = this.enlistResultSet(sourceRange);
// Link resultSet & typeDefinitionResult
TypeDefinitionResult defResult = lsif.getVertexBuilder().typeDefinitionResult(targetRange.getId());
emitter.emit(defResult);
emitter.emit(lsif.getEdgeBuilder().typeDefinition(resultSet, defResult));
} catch (CoreException e) {
LanguageServerIndexerPlugin.log(e);
}
}
private Location computeTypeDefinitionNavigation(int line, int column) {
TextDocumentPositionParams documentSymbolParams = new TextDocumentPositionParams(
new TextDocumentIdentifier(this.getContext().getDocVertex().getUri()), new Position(line, column));
NavigateToTypeDefinitionHandler proxy = new NavigateToTypeDefinitionHandler();
List<? extends Location> typeDefinition = proxy.typeDefinition(documentSymbolParams, new NullProgressMonitor());
return typeDefinition != null && typeDefinition.size() > 0 ? typeDefinition.get(0) : null;
}
}

1
com.microsoft.java.lsif.product/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
distro/

Просмотреть файл

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.microsoft.java.lsif.product</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

Просмотреть файл

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

Просмотреть файл

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

Просмотреть файл

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="Java Language Server" uid="languageServer.product" id="com.microsoft.java.lsif.core.product" application="com.microsoft.java.lsif.core.id1" version="1.0.0" useFeatures="false" includeLaunchers="true">
<configIni use="default">
</configIni>
<launcherArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
<launcher>
<win useIco="false">
<bmp/>
</win>
</launcher>
<vm>
</vm>
<plugins>
<plugin id="com.ibm.icu.base"/>
<plugin id="com.microsoft.java.lsif.core"/>
<plugin id="javax.xml"/>
<plugin id="org.eclipse.ant.core"/>
<plugin id="org.eclipse.buildship.core"/>
<plugin id="org.eclipse.compare.core"/>
<plugin id="org.eclipse.core.commands"/>
<plugin id="org.eclipse.core.contenttype"/>
<plugin id="org.eclipse.core.expressions"/>
<plugin id="org.eclipse.core.filesystem"/>
<plugin id="org.eclipse.core.jobs"/>
<plugin id="org.eclipse.core.net"/>
<plugin id="org.eclipse.core.net.linux.x86_64" fragment="true"/>
<plugin id="org.eclipse.core.net.win32.x86_64" fragment="true"/>
<plugin id="org.eclipse.core.resources"/>
<plugin id="org.eclipse.core.runtime"/>
<plugin id="org.eclipse.core.variables"/>
<plugin id="org.eclipse.debug.core"/>
<plugin id="org.eclipse.equinox.app"/>
<plugin id="org.eclipse.equinox.common"/>
<plugin id="org.eclipse.equinox.preferences"/>
<plugin id="org.eclipse.equinox.registry"/>
<plugin id="org.eclipse.equinox.security"/>
<plugin id="org.eclipse.equinox.security.linux.x86_64" fragment="true"/>
<plugin id="org.eclipse.equinox.security.macosx" fragment="true"/>
<plugin id="org.eclipse.equinox.security.win32.x86_64" fragment="true"/>
<plugin id="org.eclipse.jdt.compiler.apt" fragment="true"/>
<plugin id="org.eclipse.jdt.compiler.tool" fragment="true"/>
<plugin id="org.eclipse.jdt.core"/>
<plugin id="org.eclipse.jdt.launching"/>
<plugin id="org.eclipse.jdt.launching.macosx"/>
<plugin id="org.eclipse.m2e.core"/>
<plugin id="org.eclipse.m2e.jdt"/>
<plugin id="org.eclipse.m2e.lifecyclemapping.defaults"/>
<plugin id="org.eclipse.m2e.maven.runtime"/>
<plugin id="org.eclipse.m2e.workspace.cli"/>
<plugin id="org.eclipse.osgi"/>
<plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/>
<plugin id="org.eclipse.osgi.services"/>
<plugin id="org.eclipse.text"/>
<plugin id="org.eclipse.xtext.xbase.lib"/>
</plugins>
<configurations>
<plugin id="com.microsoft.java.lsif.core" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.jdt.core" autoStart="false" startLevel="0" />
<plugin id="org.eclipse.jdt.launching" autoStart="false" startLevel="0" />
</configurations>
<preferencesInfo>
<targetfile overwrite="false"/>
</preferencesInfo>
<cssInfo>
</cssInfo>
</product>

Просмотреть файл

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>0.1.4-SNAPSHOT</version>
<groupId>com.microsoft.java.lsif</groupId>
<artifactId>parent</artifactId>
</parent>
<artifactId>com.microsoft.java.lsif.product</artifactId>
<packaging>eclipse-repository</packaging>
<name>${base.name} :: Product</name>
<properties>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>archive-repository</goal>
</goals>
</execution>
</executions>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
<compress>false</compress>
<skipArchive>true</skipArchive>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<formats>
<macosx>tar.gz</macosx>
</formats>
<products>
<product>
<id>languageServer.product</id>
</product>
</products>
</configuration>
<executions>
<execution>
<id>create-distributions</id>
<goals>
<goal>materialize-products</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-config-mac</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/repository/config_mac</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/products/languageServer.product/macosx/cocoa/x86_64/Eclipse.app/Contents/Eclipse/configuration</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-config-win</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/repository/config_win</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/products/languageServer.product/win32/win32/x86_64/configuration</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-config-linux</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/repository/config_linux</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/products/languageServer.product/linux/gtk/x86_64/configuration</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>server-distro</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<!-- get major.minor.incremental from this pom, then use ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}
to use the x.y.z version without the -SNAPSHOT suffix -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<phase>validate</phase>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
<configuration>
<versionString>${project.version}</versionString>
</configuration>
</execution>
</executions>
</plugin>
<!-- generate .sha256 file -->
<plugin>
<groupId>net.ju-n.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>files</goal>
</goals>
</execution>
</executions>
<configuration>
<quiet>true</quiet>
<csvSummary>false</csvSummary>
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
<fileSets>
<fileSet>
<directory>${project.basedir}/distro/</directory>
<includes>
<include>**/*.gz</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</plugin>
<!-- clean leftovers from previous runs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/distro/</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>pack-for-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<outputDirectory>distro</outputDirectory>
<!-- define custom output filename -->
<finalName>jdt-language-server-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}-${timestamp}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<tarLongFileMode>posix</tarLongFileMode>
<descriptors>
<descriptor>publish-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>fast</id>
<!--
Enable faster builds by targeting a single TP environment.
Run the Maven command with specific environment properties:
- On MacOS : mvn clean verify -Pfast -Denvironment.os=macosx -Denvironment.ws=cocoa -Denvironment.arch=x86_64
- On Win32 : mvn clean verify -Pfast -Denvironment.os=win32 -Denvironment.ws=win32 -Denvironment.arch=x86
- On Win64 : mvn clean verify -Pfast -Denvironment.os=win32 -Denvironment.ws=win32 -Denvironment.arch=x86_64
- On Linux : mvn clean verify -Pfast -Denvironment.os=linux -Denvironment.ws=gtk -Denvironment.arch=x86_64
-->
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<environments>
<environment>
<os>${environment.os}</os>
<ws>${environment.ws}</ws>
<arch>${environment.arch}</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Просмотреть файл

@ -0,0 +1,26 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>publish</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/target/repository</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>config_linux/**</include>
<include>config_mac/**</include>
<include>config_win/**</include>
<include>features/**</include>
<include>plugins/**</include>
</includes>
<excludes>
<exclude>**/*.pack.gz</exclude>
</excludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
</assembly>

4
com.microsoft.java.lsif.target/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,4 @@
bin/
target/
.settings
.project

Просмотреть файл

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Java Language Server Indexer Target Definition" sequenceNumber="113">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.mockito.mockito-all" version="1.9.5"/>
<repository location="http://download.eclipse.org/scout/releases/4.0/testing"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.7.0.v20170129-0911"/>
<unit id="com.google.gson.source" version="2.7.0.v20170129-0911"/>
<unit id="com.ibm.icu.base" version="58.2.0.v20170418-1837"/>
<unit id="org.apache.commons.io" version="2.2.0.v201405211200"/>
<unit id="org.apache.commons.lang3" version="3.1.0.v201403281430"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
<repository location="http://download.eclipse.org/tools/orbit/R-builds/R20170516192513/repository"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.buildship.feature.group" version="3.0.0.v20181205-1821"/>
<repository location="http://download.eclipse.org/buildship/updates/e410/releases/3.x/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.m2e.feature.feature.group" version="1.10.0.20181127-2120"/>
<repository location="http://download.eclipse.org/technology/m2e/releases/1.10/1.10.0.20181127-2120/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.equinox.core.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.core.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.p2.core.feature.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jdt.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2018-12/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.lsp4j.sdk.feature.group" version="0.6.0.v20181130-0905"/>
<repository location="http://download.eclipse.org/lsp4j/updates/releases/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtend.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2018-12/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.jboss.tools.maven.apt.core" version="0.0.0"/>
<repository location="http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt/1.5.2-2018-12-24_15-46-05-H18/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.ls.core" version="0.0.0"/>
<repository location="http://download.eclipse.org/jdtls/snapshots/repository/0.35.0.201903142358/"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
</target>

Просмотреть файл

@ -0,0 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.java.lsif</groupId>
<artifactId>parent</artifactId>
<version>0.1.4-SNAPSHOT</version>
</parent>
<artifactId>com.microsoft.java.lsif.tp</artifactId>
<name>${base.name} :: Target Platform</name>
<packaging>eclipse-target-definition</packaging>
</project>

9
javaConfig.json Normal file
Просмотреть файл

@ -0,0 +1,9 @@
{
"projects": [
"com.microsoft.java.lsif.target",
"com.microsoft.java.lsif.core",
"com.microsoft.java.lsif.product"
],
"targetPlatform": "com.microsoft.java.lsif.target/com.microsoft.java.lsif.tp.target"
}

292
mvnw поставляемый Normal file
Просмотреть файл

@ -0,0 +1,292 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
wget "$jarUrl" -O "$wrapperJarPath"
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
curl -o "$wrapperJarPath" "$jarUrl"
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

161
mvnw.cmd поставляемый Normal file
Просмотреть файл

@ -0,0 +1,161 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
echo Found %WRAPPER_JAR%
) else (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
echo Finished downloading %WRAPPER_JAR%
)
@REM End of extension
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

357
pom.xml Normal file
Просмотреть файл

@ -0,0 +1,357 @@
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.java.lsif</groupId>
<artifactId>parent</artifactId>
<name>${base.name} :: Parent</name>
<version>0.1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<base.name>Java Language Server Indexer</base.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>1.3.0</tycho-version>
<tycho-extras-version>${tycho-version}</tycho-extras-version>
<tycho.scmUrl>scm:git:https://github.com/eclipse/eclipse.jdt.ls.git</tycho.scmUrl>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<coverage.filter>com.microsoft.java.lsif.*</coverage.filter>
<jacoco.destFile>${project.build.directory}/jacoco.exec</jacoco.destFile>
<sonar.jacoco.reportPath>${jacoco.destFile}</sonar.jacoco.reportPath>
<!-- To handle OSX-specific settings -->
<os.testArgs></os.testArgs>
<!-- skip for local builds, set it to true on Eclipse.org infrastructure -->
<cbi.jarsigner.skip>true</cbi.jarsigner.skip>
<generateSourceRef>true</generateSourceRef>
</properties>
<modules>
<module>com.microsoft.java.lsif.target</module>
<module>com.microsoft.java.lsif.core</module>
<module>com.microsoft.java.lsif.product</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>fizzed-watcher-maven-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<watches>
<watch>
<directory>com.microsoft.java.lsif.core/src</directory>
</watch>
</watches>
<goals>
<goal>clean</goal>
<goal>verify</goal>
</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<?m2e execute onConfiguration?>
<id>get-libs</id>
<goals>
<goal>copy</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<skip>false</skip>
<outputDirectory>${basedir}/lib/</outputDirectory>
<!-- baseVersion is to avoid SNAPSHOT dependencies being copied with
ever daily changing timestamp -->
<useBaseVersion>true</useBaseVersion>
</configuration>
</plugin>
<plugin>
<!-- make sure lib dir is removed after clean to avoid "dirty" build -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/lib</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<sourceReferences>
<generate>${generateSourceRef}</generate>
</sourceReferences>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-sourceref-jgit</artifactId>
<version>${tycho-extras-version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Those 4 mojos are for signing and packing -->
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pack200a-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>pack200-normalize</id>
<goals>
<goal>normalize</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.cbi.maven.plugins</groupId>
<artifactId>eclipse-jarsigner-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pack200b-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>pack200-pack</id>
<goals>
<goal>pack</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>p2-metadata</id>
<goals>
<goal>p2-metadata</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<defaultP2Metadata>false</defaultP2Metadata>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<target>
<artifact>
<groupId>com.microsoft.java.lsif</groupId>
<artifactId>com.microsoft.java.lsif.tp</artifactId>
<version>${project.version}</version>
</artifact>
</target>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
<includePackedArtifacts>false</includePackedArtifacts>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>oss.sonatype.org</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<profiles>
<profile>
<id>plugin</id>
<activation>
<!-- Enable jacoco only on plugin projects -->
<file>
<exists>META-INF/MANIFEST.MF</exists>
</file>
</activation>
<properties>
<jacoco.destFile>${project.basedir}/../target/jacoco.exec</jacoco.destFile>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<goals>
<goal>plugin-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<sessionId>${project.artifactId}</sessionId>
<includes>
<include>${coverage.filter}</include>
</includes>
<!-- Merge reports from all executions -->
<append>true</append>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>eclipse-sign</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<includePackedArtifacts>true</includePackedArtifacts>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pack200a-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>pack200-normalize</id>
<goals>
<goal>normalize</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.cbi.maven.plugins</groupId>
<artifactId>eclipse-jarsigner-plugin</artifactId>
<version>1.1.4</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pack200b-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>pack200-pack</id>
<goals>
<goal>pack</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>p2-metadata</id>
<goals>
<goal>p2-metadata</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<defaultP2Metadata>false</defaultP2Metadata>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>update-site</id>
<modules>
<module>com.microsoft.java.lsif.repository</module>
</modules>
</profile>
<profile>
<id>no-git</id>
<activation>
<file>
<missing>../.git</missing>
</file>
</activation>
<properties>
<generateSourceRef>false</generateSourceRef>
</properties>
</profile>
</profiles>
</project>