Compare commits
82 Commits
28684dcaba
...
Release
Author | SHA1 | Date | |
---|---|---|---|
|
a63af12365 | ||
|
4971e0762c | ||
|
f072e26e1d | ||
|
1e3fa2d315 | ||
|
119ced125d | ||
|
306204d436 | ||
|
bdc0b8a2b6 | ||
|
ecd57ceec7 | ||
|
1803fec36a | ||
|
c3d2252476 | ||
|
1dfa30e05e | ||
|
b08c921933 | ||
|
252f64a2bb | ||
|
7143126741 | ||
|
de2595cf62 | ||
|
58a895b581 | ||
|
0740f95c26 | ||
|
b192e33615 | ||
|
4219678db6 | ||
|
12781de581 | ||
|
89af1759ff | ||
|
1e117600f9 | ||
|
6f457479aa | ||
|
3b0b97841e | ||
|
fbf8704af6 | ||
|
dc896a453d | ||
|
5d41a19705 | ||
|
ae2461b99d | ||
|
234e6eed1a | ||
|
9ea1bff5f4 | ||
|
a4060225e1 | ||
|
2a72aa3a57 | ||
|
cabb7258aa | ||
|
25a1876b8f | ||
|
d9177cbdf2 | ||
|
c0b7f55491 | ||
|
6d0f243c80 | ||
|
bc09039e73 | ||
|
6d6786d3b7 | ||
|
d470a93645 | ||
|
535e121c0f | ||
|
077abb2c09 | ||
|
2b62965c44 | ||
|
a9eee2e4cf | ||
|
c47e8f4a9d | ||
|
ac99140020 | ||
|
3ee03cc788 | ||
|
80f533913c | ||
|
05ef4123f0 | ||
|
57f41cf534 | ||
|
04894b3667 | ||
|
63a2876959 | ||
|
24d01f756b | ||
|
cda180fbb8 | ||
|
ca020b2929 | ||
|
463fdc97a3 | ||
|
dd91476f04 | ||
|
e3a4a981ba | ||
|
acd5d5f09c | ||
|
b6bf0d8b17 | ||
|
2de2617a8d | ||
|
1cc5f8a4fd | ||
|
58e31a8bea | ||
|
cbeaa12d9c | ||
|
2f08a2acb6 | ||
|
856f7f4bd0 | ||
|
5bc8683665 | ||
|
2056e5504c | ||
|
a540a3f54a | ||
|
bdf3e890a5 | ||
|
46e4be9ff5 | ||
|
64124daa61 | ||
|
5da122db9c | ||
|
236be16fda | ||
|
2c6ccf0c48 | ||
|
3038cd7e68 | ||
|
d56d06f752 | ||
|
a447cd3f39 | ||
|
0173dd86da | ||
|
214e80cfa2 | ||
|
d5d562cee1 | ||
|
a236add9f6 |
6
.idea/JavaTXLanguageServer.iml
generated
Normal file
6
.idea/JavaTXLanguageServer.iml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="AdditionalModuleElements">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
</component>
|
||||||
|
</module>
|
42
Clients/Intellij/.gitignore
vendored
Normal file
42
Clients/Intellij/.gitignore
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
3
Clients/Intellij/.idea/.gitignore
generated
vendored
Normal file
3
Clients/Intellij/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
17
Clients/Intellij/.idea/gradle.xml
generated
Normal file
17
Clients/Intellij/.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
Clients/Intellij/.idea/misc.xml
generated
Normal file
7
Clients/Intellij/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Clients/Intellij/.idea/vcs.xml
generated
Normal file
6
Clients/Intellij/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
28
Clients/Intellij/build.gradle
Normal file
28
Clients/Intellij/build.gradle
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.jetbrains.intellij.platform' version '2.2.1'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'org.example'
|
||||||
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url "https://jitpack.io" }
|
||||||
|
|
||||||
|
intellijPlatform {
|
||||||
|
defaultRepositories()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
|
implementation "com.github.Ballerina-Platform.lsp4intellij:lsp4intellij:master-SNAPSHOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
BIN
Clients/Intellij/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
Clients/Intellij/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
Clients/Intellij/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
Clients/Intellij/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Thu Feb 20 15:20:24 CET 2025
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
234
Clients/Intellij/gradlew
vendored
Executable file
234
Clients/Intellij/gradlew
vendored
Executable file
@@ -0,0 +1,234 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
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
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
Clients/Intellij/gradlew.bat
vendored
Normal file
89
Clients/Intellij/gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
2
Clients/Intellij/settings.gradle
Normal file
2
Clients/Intellij/settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = 'Intellij'
|
||||||
|
|
17
Clients/Intellij/src/main/java/org/example/Main.java
Normal file
17
Clients/Intellij/src/main/java/org/example/Main.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||||
|
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||||
|
// to see how IntelliJ IDEA suggests fixing it.
|
||||||
|
System.out.printf("Hello and welcome!");
|
||||||
|
|
||||||
|
for (int i = 1; i <= 5; i++) {
|
||||||
|
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
||||||
|
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
|
||||||
|
System.out.println("i = " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
76
Clients/Intellij/src/resources/META-INF/plugin.xml
Normal file
76
Clients/Intellij/src/resources/META-INF/plugin.xml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<!--
|
||||||
|
an example how you can configure an plugin xml with you plugin
|
||||||
|
see also jetbrains documentation: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
|
||||||
|
<idea-plugin>
|
||||||
|
<id>your.plugin.namespace</id>
|
||||||
|
<name>Your Plugin Name</name>
|
||||||
|
<vendor>your company/org</vendor>
|
||||||
|
<description>a description of your plugin</description>
|
||||||
|
|
||||||
|
<!-- Product and plugin compatibility requirements -->
|
||||||
|
<!-- https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html -->
|
||||||
|
<depends>com.intellij.modules.platform</depends>
|
||||||
|
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<!-- register a preloading activity. You need to init IntellijLanguageClient with your config, see readme -->
|
||||||
|
<preloadingActivity implementation="your.plugin.MyPreloadingActivity" id="your.plugin.MyPreloadingActivity"/>
|
||||||
|
|
||||||
|
<!-- register intellijLanguageClient as a Service OR as a plugin component (see readme)... -->
|
||||||
|
<applicationService serviceImplementation="org.wso2.lsp4intellij.IntellijLanguageClient"/>
|
||||||
|
|
||||||
|
<!-- register a listener on editor events, required for lsp file sync -->
|
||||||
|
<editorFactoryListener implementation="org.wso2.lsp4intellij.listeners.LSPEditorListener"/>
|
||||||
|
<fileDocumentManagerListener implementation="org.wso2.lsp4intellij.listeners.LSPFileDocumentManagerListener"/>
|
||||||
|
|
||||||
|
<!-- for displaying notifications by lsp -->
|
||||||
|
<notificationGroup id="lsp" displayType="STICKY_BALLOON"/>
|
||||||
|
|
||||||
|
<!-- for displaying progress notifications by lsp in the Event Log -->
|
||||||
|
<notificationGroup id="LSPProgressNotification" displayType="NONE" />
|
||||||
|
|
||||||
|
<!-- for displaying the statusbar icon -->
|
||||||
|
<statusBarWidgetFactory implementation="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
|
||||||
|
id="org.wso2.lsp4intellij.statusbar.LSPServerStatusWidgetFactory"
|
||||||
|
order="first" />
|
||||||
|
|
||||||
|
<!-- needed for completion -->
|
||||||
|
<completion.contributor implementationClass="org.wso2.lsp4intellij.contributors.LSPCompletionContributor"
|
||||||
|
id="org.wso2.lsp4intellij.contributors.LSPCompletionContributor" language="YOUR_LANGUAGE_ID"/>
|
||||||
|
<!-- needed for completion as well as signature help -->
|
||||||
|
<typedHandler implementation="org.wso2.lsp4intellij.listeners.LSPTypedHandler"
|
||||||
|
id="LSPTypedHandler"/>
|
||||||
|
|
||||||
|
<!-- needed for code diagnostics -->
|
||||||
|
<externalAnnotator id="LSPAnnotator" language="YOUR_LANGUAGE_ID"
|
||||||
|
implementationClass="org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator"/>
|
||||||
|
|
||||||
|
<!-- needed for Workspace Symbols -->
|
||||||
|
<gotoSymbolContributor implementation="org.wso2.lsp4intellij.contributors.symbol.LSPSymbolContributor"
|
||||||
|
id="LSPSymbolContributor"/>
|
||||||
|
|
||||||
|
<!-- needed for renaming -->
|
||||||
|
<renameHandler implementation="org.wso2.lsp4intellij.contributors.rename.LSPRenameHandler" id="LSPRenameHandler" order="first"/>
|
||||||
|
<renamePsiElementProcessor implementation="org.wso2.lsp4intellij.contributors.rename.LSPRenameProcessor" id="LSPRenameProcessor" order="first"/>
|
||||||
|
|
||||||
|
<!-- needed for folding support -->
|
||||||
|
<lang.foldingBuilder language="YOUR_LANGUAGE_ID" implementationClass="org.wso2.lsp4intellij.contributors.LSPFoldingRangeProvider" id="LSPFoldingRangeProvider" order="first" />
|
||||||
|
</extensions>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<!-- needed for hover -->
|
||||||
|
<action id="org.intellij.sdk.action.QuickDocAction" class="org.wso2.lsp4intellij.actions.LSPQuickDocAction">
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<!-- needed for find references -->
|
||||||
|
<action class="org.wso2.lsp4intellij.actions.LSPReferencesAction" id="LSPFindUsages">
|
||||||
|
<keyboard-shortcut first-keystroke="shift alt F7" keymap="$default"/>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
|
<applicationListeners>
|
||||||
|
<!-- required for lsp file sync -->
|
||||||
|
<listener class="org.wso2.lsp4intellij.listeners.VFSListener"
|
||||||
|
topic="com.intellij.openapi.vfs.VirtualFileListener"/>
|
||||||
|
<listener class="org.wso2.lsp4intellij.listeners.LSPProjectManagerListener"
|
||||||
|
topic="com.intellij.openapi.project.ProjectManagerListener"/>
|
||||||
|
</applicationListeners>
|
||||||
|
</idea-plugin>
|
Binary file not shown.
@@ -9,7 +9,9 @@
|
|||||||
"categories": [
|
"categories": [
|
||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
"activationEvents": [],
|
"activationEvents": [
|
||||||
|
"onLanguage:java"
|
||||||
|
],
|
||||||
"main": "./out/extension.js",
|
"main": "./out/extension.js",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
|
@@ -10,28 +10,34 @@ import {
|
|||||||
TransportKind
|
TransportKind
|
||||||
} from 'vscode-languageclient/node';
|
} from 'vscode-languageclient/node';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This method is called when your extension is activated
|
// This method is called when your extension is activated
|
||||||
// Your extension is activated the very first time the command is executed
|
// Your extension is activated the very first time the command is executed
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const workspaceFolder = context.extensionPath;
|
||||||
const serverOptions: ServerOptions = {
|
const serverOptions: ServerOptions = {
|
||||||
run: {
|
run: {
|
||||||
command: 'java',
|
command: 'java',
|
||||||
args: ['-jar', "C:\\Users\\ruben\\JavaTXLanguageServer\\JavaTXLanguageServer\\LanguageServer\\target\\JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe
|
args: ['-jar', workspaceFolder + "/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe
|
||||||
},
|
},
|
||||||
debug: {
|
debug: {
|
||||||
command: 'java',
|
command: 'java',
|
||||||
args: ['-jar', "C:\\Users\\ruben\\JavaTXLanguageServer\\JavaTXLanguageServer\\LanguageServer\\target\\JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe für Debug
|
args: ['-jar', workspaceFolder + "/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe für Debug
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("SERVER CREATED.")
|
console.log("SERVER CREATED.")
|
||||||
|
console.log(workspaceFolder)
|
||||||
// Clientoptionen: definiere, welche Dateitypen der Client unterstützt
|
// Clientoptionen: definiere, welche Dateitypen der Client unterstützt
|
||||||
const clientOptions: LanguageClientOptions = {
|
const clientOptions: LanguageClientOptions = {
|
||||||
documentSelector: [{ scheme: 'file', language: 'java' }],
|
documentSelector: [{ scheme: 'file', language: 'java' }],
|
||||||
synchronize: {
|
synchronize: {
|
||||||
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.java')
|
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.jav')
|
||||||
},
|
},
|
||||||
revealOutputChannelOn: 4
|
revealOutputChannelOn: 4
|
||||||
};
|
};
|
||||||
|
@@ -20,6 +20,22 @@
|
|||||||
<artifactId>antlr4</artifactId>
|
<artifactId>antlr4</artifactId>
|
||||||
<version>4.11.1</version>
|
<version>4.11.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.17</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
@@ -72,8 +88,8 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>23</source>
|
<source>21</source>
|
||||||
<target>23</target>
|
<target>21</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package de.dhbw;
|
package de.dhbw;
|
||||||
|
|
||||||
|
import org.apache.log4j.LogManager;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||||
@@ -14,17 +16,20 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
public class JavaTXLanguageServer implements LanguageServer {
|
public class JavaTXLanguageServer implements LanguageServer {
|
||||||
|
private static final Logger logger = LogManager.getLogger(JavaTXLanguageServer.class);
|
||||||
private LanguageClient client;
|
private LanguageClient client;
|
||||||
|
|
||||||
public void connect(LanguageClient client) {
|
public void connect(LanguageClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
textDocumentService.setClient(client);
|
textDocumentService.setClient(client);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final JavaTXTextDocumentService textDocumentService = new JavaTXTextDocumentService();
|
private final JavaTXTextDocumentService textDocumentService = new JavaTXTextDocumentService();
|
||||||
private final JavaTXWorkspaceService workspaceService = new JavaTXWorkspaceService();
|
private final JavaTXWorkspaceService workspaceService = new JavaTXWorkspaceService();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTrace(SetTraceParams params) {
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Configure the Features of the LanguageServer
|
* Configure the Features of the LanguageServer
|
||||||
* */
|
* */
|
||||||
@@ -33,12 +38,12 @@ public class JavaTXLanguageServer implements LanguageServer {
|
|||||||
ServerCapabilities capabilities = new ServerCapabilities();
|
ServerCapabilities capabilities = new ServerCapabilities();
|
||||||
capabilities.setDocumentFormattingProvider(true);
|
capabilities.setDocumentFormattingProvider(true);
|
||||||
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
||||||
capabilities.setHoverProvider(true);
|
capabilities.setHoverProvider(false);
|
||||||
capabilities.setInlayHintProvider(true);
|
capabilities.setInlayHintProvider(true);
|
||||||
|
capabilities.setCodeActionProvider(true);
|
||||||
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
||||||
capabilities.setCompletionProvider(new CompletionOptions(true, List.of()));
|
capabilities.setCompletionProvider(new CompletionOptions(true, List.of()));
|
||||||
|
capabilities.setWorkspaceSymbolProvider(false);
|
||||||
capabilities.setWorkspaceSymbolProvider(true);
|
|
||||||
|
|
||||||
return CompletableFuture.supplyAsync(() -> new InitializeResult(capabilities));
|
return CompletableFuture.supplyAsync(() -> new InitializeResult(capabilities));
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
package de.dhbw;
|
package de.dhbw;
|
||||||
|
|
||||||
|
import org.apache.log4j.LogManager;
|
||||||
import org.antlr.v4.runtime.Token;
|
import org.apache.log4j.Logger;
|
||||||
import org.eclipse.lsp4j.launch.LSPLauncher;
|
import org.eclipse.lsp4j.launch.LSPLauncher;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,10 +13,13 @@ import java.util.HashSet;
|
|||||||
* */
|
* */
|
||||||
public class JavaTXLanguageServerLauncher {
|
public class JavaTXLanguageServerLauncher {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(JavaTXLanguageServerLauncher.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
JavaTXLanguageServer server = new JavaTXLanguageServer();
|
JavaTXLanguageServer server = new JavaTXLanguageServer();
|
||||||
|
|
||||||
|
logger.debug("Created Server.");
|
||||||
var launcher = LSPLauncher.createServerLauncher(server, System.in, System.out);
|
var launcher = LSPLauncher.createServerLauncher(server, System.in, System.out);
|
||||||
LanguageClient client = launcher.getRemoteProxy();
|
LanguageClient client = launcher.getRemoteProxy();
|
||||||
|
|
||||||
|
@@ -1,13 +1,16 @@
|
|||||||
package de.dhbw;
|
package de.dhbw;
|
||||||
|
|
||||||
import de.dhbw.compiler.languageServerInterface.LanguageServerInterface;
|
import com.google.common.base.Stopwatch;
|
||||||
|
import de.dhbw.compiler.languageServerInterface.ParserInterface;
|
||||||
|
import de.dhbw.compiler.languageServerInterface.model.ParserError;
|
||||||
import de.dhbw.helper.CodeSnippetOptions;
|
import de.dhbw.helper.CodeSnippetOptions;
|
||||||
import de.dhbw.helper.TypeFinder;
|
import de.dhbw.helper.TextHelper;
|
||||||
import de.dhbw.model.ParseError.DiagnoseErrorListener;
|
import de.dhbw.helper.TypeResolver;
|
||||||
|
import de.dhbw.model.LSPVariable;
|
||||||
import de.dhbw.model.SnippetWithName;
|
import de.dhbw.model.SnippetWithName;
|
||||||
import de.dhbw.parser.Java17Lexer;
|
import de.dhbw.model.Type;
|
||||||
import de.dhbw.parser.Java17Parser;
|
import org.apache.log4j.LogManager;
|
||||||
import de.dhbw.parser.Java17ParserBaseListener;
|
import org.apache.log4j.Logger;
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
@@ -17,23 +20,21 @@ import java.util.*;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import org.antlr.v4.runtime.CharStreams;
|
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
|
||||||
import org.antlr.v4.runtime.CharStream;
|
|
||||||
import org.antlr.v4.runtime.tree.ParseTree;
|
|
||||||
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Handles Actions in Documents, such as Autocompletion, Change-Events and Syntax-Checks
|
* Handles Actions in Documents, such as Autocompletion, Change-Events and Syntax-Checks
|
||||||
*
|
*/
|
||||||
* */
|
|
||||||
public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.TextDocumentService {
|
public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.TextDocumentService {
|
||||||
|
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(JavaTXTextDocumentService.class);
|
||||||
LanguageClient client;
|
LanguageClient client;
|
||||||
|
HashMap<String, List<InlayHint>> globalInlayHintMap = new HashMap<>();
|
||||||
String currentTextDocument;
|
Boolean calculate = false;
|
||||||
|
HashMap<String, List<Diagnostic>> globalDiagnosticsMap = new HashMap<>();
|
||||||
|
HashMap<String, String> textDocuments = new HashMap<>();
|
||||||
CodeSnippetOptions codeSnippetOptions = new CodeSnippetOptions();
|
CodeSnippetOptions codeSnippetOptions = new CodeSnippetOptions();
|
||||||
|
TextHelper textHelper = new TextHelper();
|
||||||
|
TypeResolver typeResolver = new TypeResolver();
|
||||||
|
|
||||||
public void setClient(LanguageClient client) {
|
public void setClient(LanguageClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
@@ -41,12 +42,12 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Handles Completion Events.
|
||||||
* Handles Completion Events
|
* In this case you can select codeSnippets.
|
||||||
*
|
*
|
||||||
* @param params the completion Context
|
* @param params the completion Context
|
||||||
* @return the Auto-Completion Items that will be displayed
|
* @return the Auto-Completion Items that will be displayed
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(CompletionParams params) {
|
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(CompletionParams params) {
|
||||||
List<CompletionItem> completions = new ArrayList<>();
|
List<CompletionItem> completions = new ArrayList<>();
|
||||||
@@ -66,62 +67,71 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Handles didOpen-Event.
|
||||||
* Handles didOpen Events
|
* Puts the Text-Document in the text-Document Hashmap
|
||||||
*
|
*
|
||||||
* @param params the Context of the newly opened Document
|
* @param params the Context of the newly opened Document
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void didOpen(DidOpenTextDocumentParams params) {
|
public void didOpen(DidOpenTextDocumentParams params) {
|
||||||
|
textDocuments.put(params.getTextDocument().getUri(), params.getTextDocument().getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Handles didChange-Event.
|
||||||
* Handles didChange
|
* updates textDocument-State on Server and run Syntax-Check. If an Error is found it will get displayed as a Diagnostic.
|
||||||
*
|
*
|
||||||
* @param params the Context of the Changed Document, including the incremental change as well as the whole Document
|
* @param params the Context of the Changed Document, including the incremental change as well as the whole Document
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void didChange(DidChangeTextDocumentParams params) {
|
public void didChange(DidChangeTextDocumentParams params) {
|
||||||
|
logger.info("DIDCHANGE-EVENT");
|
||||||
|
|
||||||
AtomicReference<String> summedUp = new AtomicReference<>("");
|
AtomicReference<String> summedUp = new AtomicReference<>("");
|
||||||
params.getContentChanges().forEach(el -> summedUp.set(summedUp.get() + el.getText()));
|
params.getContentChanges().forEach(el -> summedUp.set(summedUp.get() + el.getText()));
|
||||||
currentTextDocument = summedUp.get();
|
textDocuments.put(params.getTextDocument().getUri(), summedUp.get());
|
||||||
DiagnoseErrorListener errorListener = new DiagnoseErrorListener();
|
|
||||||
String input = summedUp.get();
|
String input = summedUp.get();
|
||||||
CharStream charStream = CharStreams.fromString(input);
|
|
||||||
|
|
||||||
Java17Lexer lexer = new Java17Lexer(charStream);
|
ParserInterface parserInterface = new ParserInterface();
|
||||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
|
||||||
|
|
||||||
Java17Parser parser = new Java17Parser(tokens);
|
List<ParserError> parserErrors = parserInterface.getParseErrors(input);
|
||||||
parser.removeErrorListeners();
|
|
||||||
parser.addErrorListener(errorListener);
|
|
||||||
|
|
||||||
|
|
||||||
ParseTree tree = parser.sourceFile();
|
logger.info("Found " + parserErrors.size() + " Errors.");
|
||||||
ParseTreeWalker walker = new ParseTreeWalker();
|
|
||||||
Java17ParserBaseListener listener = new Java17ParserBaseListener();
|
|
||||||
walker.walk(listener, tree);
|
|
||||||
|
|
||||||
PublishDiagnosticsParams diagnosticsParams = new PublishDiagnosticsParams(params.getTextDocument().getUri(), errorListener.getErrorMessages());
|
List<Diagnostic> diagnostics = parserErrors.stream().map(el -> {
|
||||||
|
Range errorRange = new Range(
|
||||||
|
new Position(el.getLine() - 1, el.getCharPositionInLine()), // Startposition
|
||||||
|
new Position(el.getLine() - 1, el.getEndCharPosition()) // Endposition
|
||||||
|
);
|
||||||
|
return new Diagnostic(
|
||||||
|
errorRange,
|
||||||
|
el.getMsg(),
|
||||||
|
DiagnosticSeverity.Error,
|
||||||
|
"JavaTX Language Server"
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
|
||||||
|
PublishDiagnosticsParams diagnosticsParams = new PublishDiagnosticsParams(params.getTextDocument().getUri(), diagnostics);
|
||||||
client.publishDiagnostics(diagnosticsParams);
|
client.publishDiagnostics(diagnosticsParams);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Handles a Formatting-Event
|
* Handles a Formatting-Event
|
||||||
*
|
*
|
||||||
* @param params the Context of the Formatting
|
* @param params the Context of the Formatting
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormattingParams params) {
|
public CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormattingParams params) {
|
||||||
|
logger.info("FORMAT-EVENT");
|
||||||
|
|
||||||
List<TextEdit> edits = new ArrayList<>();
|
List<TextEdit> edits = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
String[] lines = currentTextDocument.split("\n");
|
String[] lines = textDocuments.get(params.getTextDocument().getUri()).split("\n");
|
||||||
StringBuilder formattedText = new StringBuilder();
|
StringBuilder formattedText = new StringBuilder();
|
||||||
|
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
@@ -138,40 +148,91 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didClose(DidCloseTextDocumentParams params) {
|
public void didClose(DidCloseTextDocumentParams params) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didSave(DidSaveTextDocumentParams didSaveTextDocumentParams) {
|
public void didSave(DidSaveTextDocumentParams didSaveTextDocumentParams) {
|
||||||
//Irgendwie so machen das man nur dan inlayHints bekommt wenn man das DOkument speichert.
|
calculate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<InlayHint>> inlayHint(InlayHintParams params) {
|
public CompletableFuture<List<InlayHint>> inlayHint(InlayHintParams params) {
|
||||||
|
logger.info("The Client requested Inlay-Hints.");
|
||||||
|
|
||||||
TypeFinder typeFinder = new TypeFinder();
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
ArrayList<Diagnostic> diagnostics = new ArrayList<>();
|
||||||
|
var sWatch = Stopwatch.createUnstarted();
|
||||||
|
sWatch.start();
|
||||||
try {
|
try {
|
||||||
//TODO: change to get current Textdocument String
|
|
||||||
|
|
||||||
var languageServer = new LanguageServerInterface();
|
ArrayList<LSPVariable> typesOfMethodAndParameters = typeResolver.infereInput(textDocuments.get(params.getTextDocument().getUri()));
|
||||||
var typesOfMethods = typeFinder.infereMethodType(currentTextDocument);
|
|
||||||
List<InlayHint> typeHint = new ArrayList<>();
|
List<InlayHint> typeHint = new ArrayList<>();
|
||||||
|
|
||||||
for (var typeOfMethod : typesOfMethods) {
|
for (var variable : typesOfMethodAndParameters) {
|
||||||
|
|
||||||
InlayHint inlayHint = new InlayHint();
|
InlayHint inlayHint = new InlayHint();
|
||||||
inlayHint.setLabel(":" + typeOfMethod.getType());
|
|
||||||
inlayHint.setPosition(new Position(typeOfMethod.getLine()-1, typeOfMethod.getCharPosition()+1));
|
String typeDisplay = "";
|
||||||
inlayHint.setKind(InlayHintKind.Type);
|
for(Type type : variable.getPossibleTypes()){
|
||||||
typeHint.add(inlayHint);
|
typeDisplay += " | " + type.getType().replaceAll("GTV ", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return CompletableFuture.completedFuture(typeHint);
|
inlayHint.setLabel(typeDisplay.length() > 2 ? typeDisplay.substring(2) : typeDisplay);
|
||||||
|
inlayHint.setPosition(new Position(variable.getLine() - 1, variable.getCharPosition()));
|
||||||
|
inlayHint.setKind(InlayHintKind.Parameter);
|
||||||
|
inlayHint.setPaddingRight(true);
|
||||||
|
inlayHint.setPaddingRight(true);
|
||||||
|
typeHint.add(inlayHint);
|
||||||
|
|
||||||
|
|
||||||
|
//Diagnostics of Types
|
||||||
|
for (var typ : variable.getPossibleTypes()) {
|
||||||
|
Range errorRange = new Range(
|
||||||
|
new Position(variable.getLine() - 1, variable.getCharPosition()), // Startposition
|
||||||
|
new Position(variable.getLine() - 1, textHelper.getEndingCharOfStartingChar(variable.getLine() - 1, variable.getCharPosition(), textDocuments.get(params.getTextDocument().getUri()))) // Endposition
|
||||||
|
);
|
||||||
|
Diagnostic diagnostic = new Diagnostic(
|
||||||
|
errorRange,
|
||||||
|
//TODO: REMOVE! Temporary Fix because GTV, like TPH can be thrown away in the TypeResolver
|
||||||
|
typ.getType().replaceAll("GTV ", ""),
|
||||||
|
DiagnosticSeverity.Hint,
|
||||||
|
"JavaTX Language Server"
|
||||||
|
);
|
||||||
|
diagnostic.setCode(typ.isGeneric() ? "GENERIC" : "TYPE");
|
||||||
|
|
||||||
|
diagnostics.add(diagnostic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("Returning [" + typeHint.size() + "] Inlay-Hints.");
|
||||||
|
|
||||||
|
|
||||||
|
globalDiagnosticsMap.put(params.getTextDocument().getUri(), diagnostics);
|
||||||
|
globalInlayHintMap.put(params.getTextDocument().getUri(), typeHint);
|
||||||
|
|
||||||
|
PublishDiagnosticsParams diagnosticsParams = new PublishDiagnosticsParams(params.getTextDocument().getUri(), diagnostics);
|
||||||
|
client.publishDiagnostics(diagnosticsParams);
|
||||||
|
sWatch.stop();
|
||||||
|
logger.info("Finished Calculating in [" + sWatch.elapsed().toSeconds() + "s]");
|
||||||
|
|
||||||
|
return typeHint;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return CompletableFuture.completedFuture(Collections.emptyList());
|
sWatch.stop();
|
||||||
|
logger.info("Calculating returned an Error after [" + sWatch.elapsed().toSeconds() + "s]");
|
||||||
|
String stacktrace = "";
|
||||||
|
|
||||||
|
for (var i : e.getStackTrace()) {
|
||||||
|
stacktrace += i.toString() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.error("Error trying to get Inlay-Hints and Diagnostics for Client:\n" + e.getMessage() + "\n" + stacktrace);
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void willSave(WillSaveTextDocumentParams params) {
|
public void willSave(WillSaveTextDocumentParams params) {
|
||||||
TextDocumentService.super.willSave(params);
|
TextDocumentService.super.willSave(params);
|
||||||
@@ -179,53 +240,53 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<TextEdit>> willSaveWaitUntil(WillSaveTextDocumentParams params) {
|
public CompletableFuture<List<TextEdit>> willSaveWaitUntil(WillSaveTextDocumentParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<DocumentLink>> documentLink(DocumentLinkParams params) {
|
public CompletableFuture<List<DocumentLink>> documentLink(DocumentLinkParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<DocumentLink> documentLinkResolve(DocumentLink params) {
|
public CompletableFuture<DocumentLink> documentLinkResolve(DocumentLink params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new DocumentLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<ColorInformation>> documentColor(DocumentColorParams params) {
|
public CompletableFuture<List<ColorInformation>> documentColor(DocumentColorParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<ColorPresentation>> colorPresentation(ColorPresentationParams params) {
|
public CompletableFuture<List<ColorPresentation>> colorPresentation(ColorPresentationParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
|
public CompletableFuture<List<FoldingRange>> foldingRange(FoldingRangeRequestParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<CallHierarchyItem>> prepareCallHierarchy(CallHierarchyPrepareParams params) {
|
public CompletableFuture<List<CallHierarchyItem>> prepareCallHierarchy(CallHierarchyPrepareParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<CallHierarchyIncomingCall>> callHierarchyIncomingCalls(CallHierarchyIncomingCallsParams params) {
|
public CompletableFuture<List<CallHierarchyIncomingCall>> callHierarchyIncomingCalls(CallHierarchyIncomingCallsParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<CallHierarchyOutgoingCall>> callHierarchyOutgoingCalls(CallHierarchyOutgoingCallsParams params) {
|
public CompletableFuture<List<CallHierarchyOutgoingCall>> callHierarchyOutgoingCalls(CallHierarchyOutgoingCallsParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<SelectionRange>> selectionRange(SelectionRangeParams params) {
|
public CompletableFuture<List<SelectionRange>> selectionRange(SelectionRangeParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -235,153 +296,194 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<SemanticTokens, SemanticTokensDelta>> semanticTokensFullDelta(SemanticTokensDeltaParams params) {
|
public CompletableFuture<Either<SemanticTokens, SemanticTokensDelta>> semanticTokensFullDelta(SemanticTokensDeltaParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Either.forLeft(new SemanticTokens()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<SemanticTokens> semanticTokensRange(SemanticTokensRangeParams params) {
|
public CompletableFuture<SemanticTokens> semanticTokensRange(SemanticTokensRangeParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new SemanticTokens());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<Moniker>> moniker(MonikerParams params) {
|
public CompletableFuture<List<Moniker>> moniker(MonikerParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem unresolved) {
|
public CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem unresolved) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new CompletionItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returns the whole Word of the selected Character - Currently not correctly working
|
|
||||||
*
|
|
||||||
* @param line the line of the Character
|
|
||||||
* @param character the character in the line
|
|
||||||
* @param document the Document-Content as String
|
|
||||||
*
|
|
||||||
* @return the String containing the Word
|
|
||||||
* */
|
|
||||||
public String getWordOfLineAndCharacter(int line, int character, String document) {
|
|
||||||
var textArr = document.replace(";", " ; ").replace("{", " { ").replace("}", " } ").split("\n");
|
|
||||||
var selectedLine = textArr[line];
|
|
||||||
|
|
||||||
var hoverWord = "";
|
|
||||||
|
|
||||||
var index = 0;
|
|
||||||
for (String word : selectedLine.split(" ")) {
|
|
||||||
index += word.length();
|
|
||||||
|
|
||||||
if (index - word.length() <= character && index >= character) {
|
|
||||||
hoverWord = word.replace(" ", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hoverWord;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Handles a Hover-Event
|
|
||||||
*
|
|
||||||
* @param params the Context of the Hovering
|
|
||||||
* */
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Hover> hover(HoverParams params) {
|
public CompletableFuture<Hover> hover(HoverParams params) {
|
||||||
|
return CompletableFuture.completedFuture(new Hover());
|
||||||
|
|
||||||
String hoverText = getWordOfLineAndCharacter(params.getPosition().getLine(), params.getPosition().getCharacter(), currentTextDocument);
|
|
||||||
|
|
||||||
|
|
||||||
MarkupContent markupContent = new MarkupContent();
|
|
||||||
markupContent.setKind("markdown");
|
|
||||||
markupContent.setValue(hoverText);
|
|
||||||
|
|
||||||
|
|
||||||
return CompletableFuture.completedFuture(new Hover(markupContent));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<SignatureHelp> signatureHelp(SignatureHelpParams params) {
|
public CompletableFuture<SignatureHelp> signatureHelp(SignatureHelpParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new SignatureHelp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> declaration(DeclarationParams params) {
|
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> declaration(DeclarationParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(DefinitionParams params) {
|
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(DefinitionParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams params) {
|
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> implementation(ImplementationParams params) {
|
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> implementation(ImplementationParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
|
public CompletableFuture<List<? extends Location>> references(ReferenceParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams params) {
|
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams params) {
|
public CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActionParams params) {
|
public CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActionParams params) {
|
||||||
return null;
|
logger.info("Client requested Insert at Line [" + params.getRange().getStart().getLine() + "] and from Char [" + params.getRange().getStart().getCharacter() + "] to [" + params.getRange().getEnd().getCharacter() + "].");
|
||||||
|
List<Either<Command, CodeAction>> actions = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
List<Diagnostic> diagnosticInCurrentDocument = params.getContext().getDiagnostics();
|
||||||
|
logger.info("Document has currently [" + diagnosticInCurrentDocument.size() + "] Diagnostics.");
|
||||||
|
Range requestedRange = params.getRange();
|
||||||
|
|
||||||
|
//All Diagnostics that are in range of the hover -> All Diagnostics of the selected Variable and thus all Types of the Variable
|
||||||
|
List<Diagnostic> diagnosticsOverlappingHover = diagnosticInCurrentDocument.stream()
|
||||||
|
.filter(diagnostic -> rangesOverlap(diagnostic.getRange(), requestedRange)).toList();
|
||||||
|
|
||||||
|
Range rangeOfInsert = params.getRange();
|
||||||
|
String documentUri = params.getTextDocument().getUri();
|
||||||
|
|
||||||
|
|
||||||
|
for (Diagnostic typeDiagnostic : diagnosticsOverlappingHover) {
|
||||||
|
try {
|
||||||
|
String typeWithReplacedVariable = typeDiagnostic.getMessage() +
|
||||||
|
" " +
|
||||||
|
textHelper.getTextOfChars(
|
||||||
|
textDocuments.get(params.getTextDocument().getUri()),
|
||||||
|
rangeOfInsert.getStart().getLine(),
|
||||||
|
rangeOfInsert.getStart().getCharacter(),
|
||||||
|
rangeOfInsert.getEnd().getCharacter()
|
||||||
|
);
|
||||||
|
|
||||||
|
ArrayList<TextEdit> listOfChanges = new ArrayList<>();
|
||||||
|
|
||||||
|
if (typeDiagnostic.getCode().getLeft().equals("GENERIC")) {
|
||||||
|
for (var diagnostic : globalDiagnosticsMap.get(params.getTextDocument().getUri())) {
|
||||||
|
|
||||||
|
if (diagnostic.getMessage().contains(typeDiagnostic.getMessage()) || typeDiagnostic.getMessage().contains(diagnostic.getMessage())) {
|
||||||
|
String genericType = diagnostic.getMessage() +
|
||||||
|
" " +
|
||||||
|
textHelper.getTextOfChars(
|
||||||
|
textDocuments.get(params.getTextDocument().getUri()),
|
||||||
|
diagnostic.getRange().getStart().getLine(),
|
||||||
|
diagnostic.getRange().getStart().getCharacter(),
|
||||||
|
diagnostic.getRange().getEnd().getCharacter()
|
||||||
|
);
|
||||||
|
listOfChanges.add(new TextEdit(diagnostic.getRange(), genericType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
listOfChanges.add(new TextEdit(rangeOfInsert, typeWithReplacedVariable));
|
||||||
|
}
|
||||||
|
|
||||||
|
var isTypeImported = false;
|
||||||
|
|
||||||
|
if (!typeDiagnostic.getCode().getLeft().equalsIgnoreCase("generic")) {
|
||||||
|
isTypeImported = typeResolver.isTypeImported(textDocuments.get(params.getTextDocument().getUri()), typeDiagnostic.getMessage());
|
||||||
|
}
|
||||||
|
if (!isTypeImported && !typeDiagnostic.getMessage().equals("void") && !typeDiagnostic.getCode().getLeft().equals("GENERIC")) {
|
||||||
|
Range importRange = new Range(new Position(0, 0), new Position(0, 0));
|
||||||
|
|
||||||
|
var typeWithoutGenerics = typeDiagnostic.getMessage().contains("<") ? typeDiagnostic.getMessage().substring(0, typeDiagnostic.getMessage().indexOf('<')) : typeDiagnostic.getMessage();
|
||||||
|
listOfChanges.add(new TextEdit(importRange, "import " + typeWithoutGenerics + ";\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Returning [" + listOfChanges.size() + "] Changes for the Document.");
|
||||||
|
|
||||||
|
Map<String, List<TextEdit>> changes = new HashMap<>();
|
||||||
|
changes.put(documentUri, listOfChanges);
|
||||||
|
|
||||||
|
WorkspaceEdit edit = new WorkspaceEdit();
|
||||||
|
edit.setChanges(changes);
|
||||||
|
|
||||||
|
CodeAction action = new CodeAction("Insert " + typeDiagnostic.getMessage());
|
||||||
|
action.setKind(CodeActionKind.QuickFix);
|
||||||
|
action.setEdit(edit);
|
||||||
|
actions.add(Either.forRight(action));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error creating Actions, returning empty List. The Error was:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletableFuture.completedFuture(actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean rangesOverlap(Range range1, Range range2) {
|
||||||
|
int start1 = range1.getStart().getLine() * 1000 + range1.getStart().getCharacter();
|
||||||
|
int end1 = range1.getEnd().getLine() * 1000 + range1.getEnd().getCharacter();
|
||||||
|
int start2 = range2.getStart().getLine() * 1000 + range2.getStart().getCharacter();
|
||||||
|
int end2 = range2.getEnd().getLine() * 1000 + range2.getEnd().getCharacter();
|
||||||
|
|
||||||
|
return start1 <= end2 && start2 <= end1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<CodeAction> resolveCodeAction(CodeAction unresolved) {
|
public CompletableFuture<CodeAction> resolveCodeAction(CodeAction unresolved) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new CodeAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
|
public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<CodeLens> resolveCodeLens(CodeLens unresolved) {
|
public CompletableFuture<CodeLens> resolveCodeLens(CodeLens unresolved) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new CodeLens());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends TextEdit>> rangeFormatting(DocumentRangeFormattingParams params) {
|
public CompletableFuture<List<? extends TextEdit>> rangeFormatting(DocumentRangeFormattingParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
|
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
|
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new WorkspaceEdit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<LinkedEditingRanges> linkedEditingRange(LinkedEditingRangeParams params) {
|
public CompletableFuture<LinkedEditingRanges> linkedEditingRange(LinkedEditingRangeParams params) {
|
||||||
return null;
|
return CompletableFuture.completedFuture(new LinkedEditingRanges());
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,8 +1,14 @@
|
|||||||
package de.dhbw;
|
package de.dhbw;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.DidChangeConfigurationParams;
|
import org.apache.log4j.LogManager;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.eclipse.lsp4j.*;
|
||||||
|
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||||
import org.eclipse.lsp4j.services.WorkspaceService;
|
import org.eclipse.lsp4j.services.WorkspaceService;
|
||||||
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -11,7 +17,7 @@ import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
|||||||
* */
|
* */
|
||||||
public class JavaTXWorkspaceService implements WorkspaceService {
|
public class JavaTXWorkspaceService implements WorkspaceService {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(JavaTXWorkspaceService.class);
|
||||||
@Override
|
@Override
|
||||||
public void didChangeConfiguration(DidChangeConfigurationParams didChangeConfigurationParams) {
|
public void didChangeConfiguration(DidChangeConfigurationParams didChangeConfigurationParams) {
|
||||||
|
|
||||||
@@ -19,7 +25,6 @@ public class JavaTXWorkspaceService implements WorkspaceService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {
|
public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {
|
||||||
// Reagiere auf Änderungen im Dateisystem
|
|
||||||
System.out.println("Dateiänderungen im Arbeitsbereich: " + params.getChanges());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -5,7 +5,7 @@ import de.dhbw.compiler.bytecode.Codegen;
|
|||||||
import de.dhbw.compiler.environment.CompilationEnvironment;
|
import de.dhbw.compiler.environment.CompilationEnvironment;
|
||||||
import de.dhbw.compiler.environment.DirectoryClassLoader;
|
import de.dhbw.compiler.environment.DirectoryClassLoader;
|
||||||
import de.dhbw.compiler.exceptions.DebugException;
|
import de.dhbw.compiler.exceptions.DebugException;
|
||||||
import de.dhbw.compiler.languageServerInterface.LanguageServerTransferObject;
|
import de.dhbw.compiler.languageServerInterface.model.LanguageServerTransferObject;
|
||||||
import de.dhbw.compiler.parser.JavaTXParser;
|
import de.dhbw.compiler.parser.JavaTXParser;
|
||||||
import de.dhbw.compiler.parser.NullToken;
|
import de.dhbw.compiler.parser.NullToken;
|
||||||
import de.dhbw.compiler.parser.scope.GenericsRegistry;
|
import de.dhbw.compiler.parser.scope.GenericsRegistry;
|
||||||
@@ -57,7 +57,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import de.dhbw.parser.Java17Parser;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
import org.apache.commons.io.output.NullOutputStream;
|
import org.apache.commons.io.output.NullOutputStream;
|
||||||
|
|
||||||
public class JavaTXCompiler {
|
public class JavaTXCompiler {
|
||||||
@@ -406,7 +406,8 @@ public class JavaTXCompiler {
|
|||||||
unify.unifyParallel(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, urm, usedTasks);
|
unify.unifyParallel(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, urm, usedTasks);
|
||||||
logFile.write("RES_FINAL: " + li.getResults().toString() + "\n");
|
logFile.write("RES_FINAL: " + li.getResults().toString() + "\n");
|
||||||
logFile.flush();
|
logFile.flush();
|
||||||
return new LanguageServerTransferObject(li.getResults(), sf, ASTTypePrinter.print(sf));
|
generateBytecode(sf, li.getResults());
|
||||||
|
return new LanguageServerTransferObject(li.getResults(), sf, ASTTypePrinter.print(sf), generatedGenerics);
|
||||||
}
|
}
|
||||||
/* UnifyResultModel End */
|
/* UnifyResultModel End */
|
||||||
else {
|
else {
|
||||||
@@ -433,7 +434,8 @@ public class JavaTXCompiler {
|
|||||||
}
|
}
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
}
|
}
|
||||||
return new LanguageServerTransferObject(results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()), sf, ASTTypePrinter.print(sf));
|
generateBytecode(sf, results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()));
|
||||||
|
return new LanguageServerTransferObject(results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()), sf, ASTTypePrinter.print(sf), generatedGenerics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResultSet> typeInference(File file) throws ClassNotFoundException, IOException {
|
public List<ResultSet> typeInference(File file) throws ClassNotFoundException, IOException {
|
||||||
|
@@ -8,16 +8,13 @@ import java.util.*;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import de.dhbw.compiler.core.JavaTXCompiler;
|
import de.dhbw.compiler.core.JavaTXCompiler;
|
||||||
import de.dhbw.compiler.syntaxtree.ClassOrInterface;
|
|
||||||
import de.dhbw.compiler.syntaxtree.factory.ASTFactory;
|
|
||||||
|
|
||||||
import de.dhbw.compiler.exceptions.DebugException;
|
import de.dhbw.compiler.exceptions.DebugException;
|
||||||
import de.dhbw.compiler.exceptions.NotImplementedException;
|
import de.dhbw.compiler.exceptions.NotImplementedException;
|
||||||
import de.dhbw.compiler.parser.JavaTXParser;
|
|
||||||
|
|
||||||
import de.dhbw.compiler.parser.scope.GatherNames;
|
import de.dhbw.compiler.parser.scope.GatherNames;
|
||||||
import de.dhbw.compiler.parser.scope.JavaClassRegistry;
|
import de.dhbw.compiler.parser.scope.JavaClassRegistry;
|
||||||
import de.dhbw.parser.Java17Parser;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stellt die Java-Environment dar und speichert alle Binarys, Librarys und Sourcefiles im zu kompilierenden Projekt Sie erstellt anhand dieser Informationen die JavaClassNameRegistry
|
* Stellt die Java-Environment dar und speichert alle Binarys, Librarys und Sourcefiles im zu kompilierenden Projekt Sie erstellt anhand dieser Informationen die JavaClassNameRegistry
|
||||||
|
@@ -1,24 +1,27 @@
|
|||||||
package de.dhbw.compiler.languageServerInterface;
|
package de.dhbw.compiler.languageServerInterface;
|
||||||
|
|
||||||
import de.dhbw.compiler.syntaxtree.SourceFile;
|
import de.dhbw.compiler.languageServerInterface.model.LanguageServerTransferObject;
|
||||||
import de.dhbw.compiler.syntaxtree.visual.ASTTypePrinter;
|
|
||||||
import de.dhbw.compiler.typeinference.result.ResultSet;
|
|
||||||
import de.dhbw.compiler.core.JavaTXCompiler;
|
import de.dhbw.compiler.core.JavaTXCompiler;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of an Interface for the Language-Server to get the Resultset and abstract Syntax.
|
* Implementation of an Interface for the Language-Server to get the Resultset and abstract Syntax.
|
||||||
* */
|
*/
|
||||||
public class LanguageServerInterface {
|
public class LanguageServerInterface {
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(LanguageServerInterface.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get final Result Set
|
* get final Result Set
|
||||||
* */
|
*/
|
||||||
public LanguageServerTransferObject getResultSetAndAbstractSyntax(String input) throws IOException, ClassNotFoundException {
|
public LanguageServerTransferObject getResultSetAndAbstractSyntax(String input) throws IOException, ClassNotFoundException {
|
||||||
|
|
||||||
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
||||||
|
int RETRYCOUNT = 50;
|
||||||
|
for (int i = 0; i < RETRYCOUNT; i++) {
|
||||||
|
try {
|
||||||
File tempSourcefile = File.createTempFile("temp", ".java");
|
File tempSourcefile = File.createTempFile("temp", ".java");
|
||||||
tempSourcefile.deleteOnExit();
|
tempSourcefile.deleteOnExit();
|
||||||
|
|
||||||
@@ -28,7 +31,14 @@ public class LanguageServerInterface {
|
|||||||
|
|
||||||
JavaTXCompiler tx = new JavaTXCompiler(tempSourcefile);
|
JavaTXCompiler tx = new JavaTXCompiler(tempSourcefile);
|
||||||
var test = tx.getResultSetAndAbstractSyntax(tempSourcefile);
|
var test = tx.getResultSetAndAbstractSyntax(tempSourcefile);
|
||||||
|
log.debug("JAVA-TX LANGUAGE SERVER INTERFACE RESULTED IN THE FOLLOWING: \n" + test.getResultSets().toString());
|
||||||
System.setOut(System.out);
|
System.setOut(System.out);
|
||||||
return test;
|
return test;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("ERROR FETCHING COMPILER RESULTS: \n" + e.getMessage());
|
||||||
|
log.warn("NEW RETRY. RETRYCOUNT IS: " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new RuntimeException("ERROR FETCHING COMPILER RESULTS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
package de.dhbw.compiler.languageServerInterface;
|
||||||
|
|
||||||
|
import de.dhbw.compiler.languageServerInterface.model.CustomParserErrorHandler;
|
||||||
|
import de.dhbw.compiler.languageServerInterface.model.ParserError;
|
||||||
|
import de.dhbw.compiler.parser.antlr.Java17Lexer;
|
||||||
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
|
import de.dhbw.compiler.parser.antlr.Java17ParserBaseListener;
|
||||||
|
import org.antlr.v4.runtime.CharStream;
|
||||||
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
import org.antlr.v4.runtime.tree.ParseTree;
|
||||||
|
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ParserInterface {
|
||||||
|
|
||||||
|
public List<ParserError> getParseErrors(String input){
|
||||||
|
|
||||||
|
CustomParserErrorHandler errorListener = new CustomParserErrorHandler();
|
||||||
|
CharStream charStream = CharStreams.fromString(input);
|
||||||
|
|
||||||
|
Java17Lexer lexer = new Java17Lexer(charStream);
|
||||||
|
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||||
|
|
||||||
|
Java17Parser parser = new Java17Parser(tokens);
|
||||||
|
parser.removeErrorListeners();
|
||||||
|
parser.addErrorListener(errorListener);
|
||||||
|
|
||||||
|
|
||||||
|
ParseTree tree = parser.sourceFile();
|
||||||
|
ParseTreeWalker walker = new ParseTreeWalker();
|
||||||
|
Java17ParserBaseListener listener = new Java17ParserBaseListener();
|
||||||
|
walker.walk(listener, tree);
|
||||||
|
|
||||||
|
return errorListener.getErrorMessages();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
package de.dhbw.compiler.languageServerInterface.model;
|
||||||
|
|
||||||
|
import de.dhbw.compiler.languageServerInterface.model.ParserError;
|
||||||
|
import org.antlr.v4.runtime.*;
|
||||||
|
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||||
|
import org.antlr.v4.runtime.dfa.DFA;
|
||||||
|
import org.eclipse.lsp4j.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CustomParserErrorHandler implements ANTLRErrorListener {
|
||||||
|
private final List<ParserError> errorMessages = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
|
||||||
|
int endCharPosition = charPositionInLine;
|
||||||
|
if (offendingSymbol instanceof Token) {
|
||||||
|
Token offendingToken = (Token) offendingSymbol;
|
||||||
|
endCharPosition = charPositionInLine + offendingToken.getText().length();
|
||||||
|
}
|
||||||
|
|
||||||
|
ParserError parserError = new ParserError(line, charPositionInLine, endCharPosition, msg);
|
||||||
|
errorMessages.add(parserError);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reportAmbiguity(Parser parser, DFA dfa, int i, int i1, boolean b, BitSet bitSet, ATNConfigSet atnConfigSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reportAttemptingFullContext(Parser parser, DFA dfa, int i, int i1, BitSet bitSet, ATNConfigSet atnConfigSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reportContextSensitivity(Parser parser, DFA dfa, int i, int i1, int i2, ATNConfigSet atnConfigSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ParserError> getErrorMessages() {
|
||||||
|
return errorMessages;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,21 +1,29 @@
|
|||||||
package de.dhbw.compiler.languageServerInterface;
|
package de.dhbw.compiler.languageServerInterface.model;
|
||||||
|
|
||||||
import de.dhbw.compiler.syntaxtree.SourceFile;
|
import de.dhbw.compiler.syntaxtree.SourceFile;
|
||||||
|
import de.dhbw.compiler.target.generate.GenericsResult;
|
||||||
import de.dhbw.compiler.typeinference.result.ResultSet;
|
import de.dhbw.compiler.typeinference.result.ResultSet;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class LanguageServerTransferObject {
|
public class LanguageServerTransferObject {
|
||||||
List<ResultSet> resultSets;
|
List<ResultSet> resultSets;
|
||||||
SourceFile Ast;
|
SourceFile Ast;
|
||||||
String printedAst;
|
String printedAst;
|
||||||
public LanguageServerTransferObject(List<ResultSet> resultSets, SourceFile Ast, String printedAst) {
|
Map<SourceFile, List<GenericsResult>> generatedGenerics = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
public LanguageServerTransferObject(List<ResultSet> resultSets, SourceFile Ast, String printedAst, Map<SourceFile, List<GenericsResult>> generatedGenerics) {
|
||||||
this.resultSets = resultSets;
|
this.resultSets = resultSets;
|
||||||
this.Ast = Ast;
|
this.Ast = Ast;
|
||||||
this.printedAst = printedAst;
|
this.printedAst = printedAst;
|
||||||
|
this.generatedGenerics = generatedGenerics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResultSet> getResultSets() {return resultSets;}
|
public List<ResultSet> getResultSets() {return resultSets;}
|
||||||
public SourceFile getAst() {return Ast;}
|
public SourceFile getAst() {return Ast;}
|
||||||
public String getPrintedAst() {return printedAst;}
|
public String getPrintedAst() {return printedAst;}
|
||||||
|
public Map<SourceFile, List<GenericsResult>> getGeneratedGenerics() {return generatedGenerics;}
|
||||||
}
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
package de.dhbw.compiler.languageServerInterface.model;
|
||||||
|
|
||||||
|
public class ParserError {
|
||||||
|
|
||||||
|
private int line;
|
||||||
|
private int charPositionInLine;
|
||||||
|
private int endCharPosition;
|
||||||
|
String msg;
|
||||||
|
|
||||||
|
public ParserError(int line, int charPositionInLine, int endCharPosition, String msg) {
|
||||||
|
this.line = line;
|
||||||
|
this.charPositionInLine = charPositionInLine;
|
||||||
|
this. endCharPosition = endCharPosition;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEndCharPosition() {
|
||||||
|
return endCharPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndCharPosition(int endCharPosition) {
|
||||||
|
this.endCharPosition = endCharPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCharPositionInLine(int charPositionInLine) {
|
||||||
|
this.charPositionInLine = charPositionInLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLine(int line) {
|
||||||
|
this.line = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCharPositionInLine() {
|
||||||
|
return charPositionInLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLine() {
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
package de.dhbw.compiler.languageServerInterface.model;
|
||||||
|
|
||||||
|
import de.dhbw.compiler.typeinference.unify.UnifyResultEvent;
|
||||||
|
import de.dhbw.compiler.typeinference.unify.UnifyResultListener;
|
||||||
|
import de.dhbw.helper.TypeResolver;
|
||||||
|
|
||||||
|
public class ResultSetListener implements UnifyResultListener {
|
||||||
|
|
||||||
|
TypeResolver typeResolver;
|
||||||
|
|
||||||
|
public ResultSetListener(TypeResolver typeResolver){
|
||||||
|
this.typeResolver = typeResolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNewTypeResultFound(UnifyResultEvent evt) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,21 +1,12 @@
|
|||||||
package de.dhbw.compiler.parser;
|
package de.dhbw.compiler.parser;
|
||||||
|
|
||||||
import de.dhbw.compiler.environment.CompilationEnvironment;
|
import de.dhbw.compiler.parser.antlr.Java17Lexer;
|
||||||
import de.dhbw.compiler.parser.SyntaxTreeGenerator.SyntaxTreeGenerator;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
|
|
||||||
import de.dhbw.compiler.parser.scope.JavaClassRegistry;
|
|
||||||
import de.dhbw.compiler.syntaxtree.SourceFile;
|
|
||||||
|
|
||||||
import de.dhbw.parser.Java17Lexer;
|
|
||||||
import de.dhbw.parser.Java17Parser;
|
|
||||||
import org.antlr.v4.runtime.CharStream;
|
import org.antlr.v4.runtime.CharStream;
|
||||||
import org.antlr.v4.runtime.CharStreams;
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class JavaTXParser {
|
public class JavaTXParser {
|
||||||
public static Java17Parser.SourceFileContext parse(File source) throws IOException, ClassNotFoundException {
|
public static Java17Parser.SourceFileContext parse(File source) throws IOException, ClassNotFoundException {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package de.dhbw.compiler.parser.SyntaxTreeGenerator;
|
package de.dhbw.compiler.parser.SyntaxTreeGenerator;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -14,11 +13,9 @@ import de.dhbw.compiler.core.JavaTXCompiler;
|
|||||||
import de.dhbw.compiler.syntaxtree.*;
|
import de.dhbw.compiler.syntaxtree.*;
|
||||||
import de.dhbw.compiler.syntaxtree.statement.*;
|
import de.dhbw.compiler.syntaxtree.statement.*;
|
||||||
import de.dhbw.compiler.syntaxtree.type.Void;
|
import de.dhbw.compiler.syntaxtree.type.Void;
|
||||||
import de.dhbw.compiler.target.tree.expression.TargetUnaryOp;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
import de.dhbw.compiler.target.generate.StatementToTargetExpression;
|
|
||||||
import de.dhbw.parser.Java17Parser;
|
|
||||||
import org.antlr.v4.runtime.Token;
|
import org.antlr.v4.runtime.Token;
|
||||||
import de.dhbw.parser.Java17Parser.*;
|
import de.dhbw.compiler.parser.antlr.Java17Parser.*;
|
||||||
import de.dhbw.compiler.exceptions.NotImplementedException;
|
import de.dhbw.compiler.exceptions.NotImplementedException;
|
||||||
import de.dhbw.compiler.parser.NullToken;
|
import de.dhbw.compiler.parser.NullToken;
|
||||||
|
|
||||||
|
@@ -17,13 +17,11 @@ import de.dhbw.compiler.parser.NullToken;
|
|||||||
import de.dhbw.compiler.syntaxtree.*;
|
import de.dhbw.compiler.syntaxtree.*;
|
||||||
import de.dhbw.compiler.syntaxtree.Record;
|
import de.dhbw.compiler.syntaxtree.Record;
|
||||||
import de.dhbw.compiler.syntaxtree.statement.*;
|
import de.dhbw.compiler.syntaxtree.statement.*;
|
||||||
import de.dhbw.parser.Java17Parser;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
import de.dhbw.parser.Java17Parser.*;
|
import de.dhbw.compiler.parser.antlr.Java17Parser.*;
|
||||||
import org.antlr.v4.runtime.CommonToken;
|
import org.antlr.v4.runtime.CommonToken;
|
||||||
import org.antlr.v4.runtime.Token;
|
import org.antlr.v4.runtime.Token;
|
||||||
|
|
||||||
import com.google.common.graph.ElementOrder.Type;
|
|
||||||
|
|
||||||
import de.dhbw.compiler.environment.PackageCrawler;
|
import de.dhbw.compiler.environment.PackageCrawler;
|
||||||
import de.dhbw.compiler.exceptions.NotImplementedException;
|
import de.dhbw.compiler.exceptions.NotImplementedException;
|
||||||
import de.dhbw.compiler.exceptions.TypeinferenceException;
|
import de.dhbw.compiler.exceptions.TypeinferenceException;
|
||||||
|
@@ -16,8 +16,8 @@ import de.dhbw.compiler.syntaxtree.type.RefType;
|
|||||||
import de.dhbw.compiler.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
import de.dhbw.compiler.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||||
import de.dhbw.compiler.syntaxtree.type.SuperWildcardType;
|
import de.dhbw.compiler.syntaxtree.type.SuperWildcardType;
|
||||||
import de.dhbw.compiler.syntaxtree.type.TypePlaceholder;
|
import de.dhbw.compiler.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbw.parser.Java17Parser;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
import de.dhbw.parser.Java17Parser.*;
|
import de.dhbw.compiler.parser.antlr.Java17Parser.*;
|
||||||
import org.antlr.v4.runtime.Token;
|
import org.antlr.v4.runtime.Token;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@@ -1,12 +1,9 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 by ANTLR 4.13.1
|
||||||
import org.antlr.v4.runtime.Lexer;
|
import org.antlr.v4.runtime.Lexer;
|
||||||
import org.antlr.v4.runtime.CharStream;
|
import org.antlr.v4.runtime.CharStream;
|
||||||
import org.antlr.v4.runtime.Token;
|
|
||||||
import org.antlr.v4.runtime.TokenStream;
|
|
||||||
import org.antlr.v4.runtime.*;
|
import org.antlr.v4.runtime.*;
|
||||||
import org.antlr.v4.runtime.atn.*;
|
import org.antlr.v4.runtime.atn.*;
|
||||||
import org.antlr.v4.runtime.dfa.DFA;
|
import org.antlr.v4.runtime.dfa.DFA;
|
||||||
import org.antlr.v4.runtime.misc.*;
|
|
||||||
|
|
||||||
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"})
|
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"})
|
||||||
public class Java17Lexer extends Lexer {
|
public class Java17Lexer extends Lexer {
|
@@ -1,12 +1,12 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
||||||
import org.antlr.v4.runtime.atn.*;
|
import org.antlr.v4.runtime.atn.*;
|
||||||
import org.antlr.v4.runtime.dfa.DFA;
|
import org.antlr.v4.runtime.dfa.DFA;
|
||||||
import org.antlr.v4.runtime.*;
|
import org.antlr.v4.runtime.*;
|
||||||
import org.antlr.v4.runtime.misc.*;
|
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
||||||
import org.antlr.v4.runtime.tree.*;
|
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
||||||
|
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
|
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"})
|
||||||
public class Java17Parser extends Parser {
|
public class Java17Parser extends Parser {
|
@@ -1,4 +1,4 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
||||||
|
|
||||||
import org.antlr.v4.runtime.ParserRuleContext;
|
import org.antlr.v4.runtime.ParserRuleContext;
|
||||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
import org.antlr.v4.runtime.tree.ErrorNode;
|
@@ -1,4 +1,4 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
||||||
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
|
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,4 +1,4 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
||||||
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,4 +1,4 @@
|
|||||||
package de.dhbw.parser;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
package de.dhbw.compiler.parser.antlr;// Generated from C:/Users/ruben/IdeaProjects/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1
|
||||||
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -5,11 +5,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import de.dhbw.compiler.core.JavaTXCompiler;
|
import de.dhbw.compiler.core.JavaTXCompiler;
|
||||||
import de.dhbw.compiler.environment.PackageCrawler;
|
import de.dhbw.compiler.environment.PackageCrawler;
|
||||||
import de.dhbw.compiler.exceptions.NotImplementedException;
|
import de.dhbw.compiler.exceptions.NotImplementedException;
|
||||||
import de.dhbw.parser.Java17Parser;
|
import de.dhbw.compiler.parser.antlr.Java17Parser;
|
||||||
|
|
||||||
|
|
||||||
public class GatherNames {
|
public class GatherNames {
|
||||||
|
87
LanguageServer/src/main/java/de/dhbw/helper/TextHelper.java
Normal file
87
LanguageServer/src/main/java/de/dhbw/helper/TextHelper.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package de.dhbw.helper;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TextHelper {
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(TextHelper.class);
|
||||||
|
|
||||||
|
public Integer getClassPositionForGeneric(Integer line, String input, Integer startChar){
|
||||||
|
log.info("Calculating Position of Class-Generic Variable at Line [" + line + "] and Char [" + startChar + "].");
|
||||||
|
|
||||||
|
String[] lines = input.split("\n");
|
||||||
|
|
||||||
|
if(lines.length < line){
|
||||||
|
log.warn("Returning hardcoded Value because the requested Line [" + line + "] does not exist in Text Document.");
|
||||||
|
return startChar+3;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] linesInChar = lines[line].split("");
|
||||||
|
|
||||||
|
|
||||||
|
var index = startChar;
|
||||||
|
var found = false;
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = startChar; i < linesInChar.length; i++) {
|
||||||
|
|
||||||
|
|
||||||
|
if(linesInChar[i].contains("{")){
|
||||||
|
index = i;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!found){
|
||||||
|
index = linesInChar.length-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int j = index; j <= linesInChar.length; j--){
|
||||||
|
if(!linesInChar[j].isEmpty() && !linesInChar[j].equals(" ")){
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEndingCharOfStartingChar(Integer line, Integer startChar, String input){
|
||||||
|
log.info("Calculating ending-Position for Variable at Line [" + line + "] and Char [" + startChar + "].");
|
||||||
|
List<String> endingChars = List.of("(", ")", " ", "{", "}", ";", ",");
|
||||||
|
|
||||||
|
String[] lines = input.split("\n");
|
||||||
|
|
||||||
|
if(lines.length < line){
|
||||||
|
log.warn("Returning hardcoded Value because the requested Line [" + line + "] does not exist in Text Document.");
|
||||||
|
return startChar+3;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] linesInChar = lines[line].split("");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var index = startChar;
|
||||||
|
for (int i = startChar; i < linesInChar.length; i++) {
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if(endingChars.contains(linesInChar[i])){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return index-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTextOfChars(String textDocument, Integer line, Integer charStart, Integer charEnd){
|
||||||
|
String[] splittedText = textDocument.split("\n");
|
||||||
|
return splittedText[line].substring(charStart, charEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,111 +0,0 @@
|
|||||||
package de.dhbw.helper;
|
|
||||||
|
|
||||||
import de.dhbw.compiler.languageServerInterface.LanguageServerInterface;
|
|
||||||
import de.dhbw.compiler.languageServerInterface.LanguageServerTransferObject;
|
|
||||||
import de.dhbw.model.MethodNameWithType;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper-Class for finding the Type of a selected Word
|
|
||||||
*/
|
|
||||||
public class TypeFinder {
|
|
||||||
|
|
||||||
LanguageServerInterface languageServer;
|
|
||||||
|
|
||||||
public TypeFinder() {
|
|
||||||
languageServer = new LanguageServerInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* find the concrete Type of all TPHs and return the outcome as Hashmap.
|
|
||||||
*/
|
|
||||||
public HashMap<String, ArrayList<String>> findAvailableTypes(LanguageServerTransferObject resultSet) throws IOException, ClassNotFoundException {
|
|
||||||
|
|
||||||
HashMap<String, ArrayList<String>> typePlaceholderTypes = new HashMap<>();
|
|
||||||
|
|
||||||
resultSet.getResultSets().forEach(conSet -> {
|
|
||||||
for (var constraint : conSet.results) {
|
|
||||||
|
|
||||||
var typeNameString = constraint.getLeft().toString();
|
|
||||||
|
|
||||||
ArrayList<String> finalTypes = new ArrayList<>();
|
|
||||||
Queue<String> queue = new LinkedList<>();
|
|
||||||
|
|
||||||
if (typeNameString.contains("TPH ")) {
|
|
||||||
queue.add(typeNameString);
|
|
||||||
} else {
|
|
||||||
finalTypes.add(typeNameString);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
while (!queue.isEmpty()) {
|
|
||||||
var nextType = queue.remove();
|
|
||||||
resultSet.getResultSets().forEach(el -> el.results.forEach(el2 -> {
|
|
||||||
|
|
||||||
if (el2.getLeft().toString().equals(nextType)) {
|
|
||||||
if (el2.getRight().toString().toLowerCase().contains("TPH")) {
|
|
||||||
queue.add(el2.getRight().toString());
|
|
||||||
} else {
|
|
||||||
finalTypes.add(el2.getRight().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
typePlaceholderTypes.put(typeNameString, finalTypes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return typePlaceholderTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String findTypeOfMethod(LanguageServerTransferObject transferObj, String methodName) throws IOException, ClassNotFoundException {
|
|
||||||
|
|
||||||
var typeHashMap = findAvailableTypes(transferObj);
|
|
||||||
|
|
||||||
|
|
||||||
for (var method : transferObj.getAst().getAllMethods()) {
|
|
||||||
if (method.name.equals(methodName)) {
|
|
||||||
if (method.getReturnType().toString().contains("TPH ")) {
|
|
||||||
StringBuilder possibleTypes = new StringBuilder();
|
|
||||||
|
|
||||||
for(var type : typeHashMap.get(method.getReturnType().toString())){
|
|
||||||
possibleTypes.append(" | ").append(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return possibleTypes.toString().substring(3);
|
|
||||||
}else{
|
|
||||||
return method.getReturnType().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "java.lang.Object";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<MethodNameWithType> infereMethodType(String input) throws IOException, ClassNotFoundException {
|
|
||||||
var transferObj = languageServer.getResultSetAndAbstractSyntax(input);
|
|
||||||
//Für RefTypes und so dann entsprechend InstanceOf durch den Syntaxbaum denke ich
|
|
||||||
ArrayList<MethodNameWithType> methodNameWithTypeList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (var method : transferObj.getAst().getAllMethods()) {
|
|
||||||
var type = findTypeOfMethod(transferObj, method.name);
|
|
||||||
methodNameWithTypeList.add(new MethodNameWithType(method.name, type, method.getOffset().getLine(), method.getOffset().getStartIndex()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return methodNameWithTypeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
241
LanguageServer/src/main/java/de/dhbw/helper/TypeResolver.java
Normal file
241
LanguageServer/src/main/java/de/dhbw/helper/TypeResolver.java
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
package de.dhbw.helper;
|
||||||
|
|
||||||
|
import de.dhbw.compiler.languageServerInterface.LanguageServerInterface;
|
||||||
|
import de.dhbw.compiler.languageServerInterface.model.LanguageServerTransferObject;
|
||||||
|
import de.dhbw.compiler.syntaxtree.ClassOrInterface;
|
||||||
|
import de.dhbw.compiler.syntaxtree.Method;
|
||||||
|
import de.dhbw.compiler.syntaxtree.SourceFile;
|
||||||
|
import de.dhbw.compiler.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||||
|
import de.dhbw.compiler.target.generate.GenericsResult;
|
||||||
|
import de.dhbw.compiler.typeinference.result.ResultSet;
|
||||||
|
import de.dhbw.model.*;
|
||||||
|
import org.apache.log4j.LogManager;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper-Class for finding the Type of a selected Word
|
||||||
|
*/
|
||||||
|
public class TypeResolver {
|
||||||
|
|
||||||
|
HashMap<Integer, LanguageServerTransferObject> dataCache = new HashMap<>();
|
||||||
|
LanguageServerInterface languageServer;
|
||||||
|
private static final Logger logger = LogManager.getLogger(TypeResolver.class);
|
||||||
|
|
||||||
|
|
||||||
|
private List<ResultSet> currentResults = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<ResultSet> getCurrentResults() {
|
||||||
|
return currentResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentResults(List<ResultSet> currentResults) {
|
||||||
|
this.currentResults = currentResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addToCurrentResults(List<ResultSet> additionalResults) {
|
||||||
|
this.currentResults.addAll(additionalResults);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeResolver() {
|
||||||
|
languageServer = new LanguageServerInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private LanguageServerTransferObject getCacheOrCalculate(String input) throws IOException, ClassNotFoundException {
|
||||||
|
logger.info("Trying to find cached Compiler-Answer for input with key [" + input.hashCode() + "].");
|
||||||
|
if (dataCache.containsKey(input.hashCode())) {
|
||||||
|
logger.info("Found Cache for the Input with key [" + input.hashCode() + "].");
|
||||||
|
return dataCache.get(input.hashCode());
|
||||||
|
} else {
|
||||||
|
logger.info("Could not find Cache for Input with key [" + input.hashCode() + "]. Using Compiler Interface and Saving the Answer in Cache.");
|
||||||
|
var transferObject = languageServer.getResultSetAndAbstractSyntax(input);
|
||||||
|
dataCache.put(input.hashCode(), transferObject);
|
||||||
|
return transferObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTypeImported(String input, String type) {
|
||||||
|
try {
|
||||||
|
var transferObject = getCacheOrCalculate(input);
|
||||||
|
var abstractSyntax = transferObject.getAst();
|
||||||
|
|
||||||
|
var isAlreadyImported = false;
|
||||||
|
for (var importStatement : abstractSyntax.getImports()) {
|
||||||
|
isAlreadyImported = !isAlreadyImported && importStatement.toString().equals(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isAlreadyImported;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getAvailableTypes(List<ResultSet> resultSets, Method method) {
|
||||||
|
logger.info("Searching for resulting Types of Placeholder [" + method.getReturnType().toString() + "].");
|
||||||
|
ArrayList<String> normalType = new ArrayList<>();
|
||||||
|
|
||||||
|
resultSets.forEach(conSet -> {
|
||||||
|
if (method.getReturnType().toString().toLowerCase().contains("tph ")) {
|
||||||
|
normalType.add(conSet.resolveType(method.getReturnType()).resolvedType.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return new ArrayList<>(normalType.stream().filter(el -> !el.contains("TPH ")).map(el -> new Type(el, false)).toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getAvailableGenericTypes(List<GenericsResult> genericsResult, Method method) {
|
||||||
|
logger.info("Searching for resulting Types of Placeholder [" + method.getReturnType().toString() + "].");
|
||||||
|
ArrayList<String> genericTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
genericsResult.forEach(conSet -> {
|
||||||
|
if (method.getReturnType().toString().toLowerCase().contains("tph ")) {
|
||||||
|
genericTypes.add(conSet.resolveTarget(method.getReturnType()).name().replaceAll("GTV ", ""));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return new ArrayList<>(genericTypes.stream().filter(el -> !el.contains("TPH ")).map(el -> new Type(el, true)).toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getAvailableGenericTypes(List<GenericsResult> genericsResult, RefTypeOrTPHOrWildcardOrGeneric parameter) {
|
||||||
|
logger.info("Searching for resulting Types of Placeholder [" + parameter.toString() + "].");
|
||||||
|
|
||||||
|
ArrayList<String> paramTypes = new ArrayList<>();
|
||||||
|
genericsResult.forEach(conSet -> {
|
||||||
|
if (parameter.toString().toLowerCase().contains("tph ")) {
|
||||||
|
paramTypes.add(conSet.resolveTarget(parameter).name());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ArrayList<>(paramTypes.stream().filter(el -> !el.contains("TPH ")).map(el -> new Type(el, true)).toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getAvailableTypes(List<ResultSet> resultSets, RefTypeOrTPHOrWildcardOrGeneric parameter) {
|
||||||
|
logger.info("Searching for resulting Types of Placeholder [" + parameter.toString() + "].");
|
||||||
|
|
||||||
|
ArrayList<String> paramTypes = new ArrayList<>();
|
||||||
|
resultSets.forEach(conSet -> {
|
||||||
|
if (parameter.toString().toLowerCase().contains("tph ")) {
|
||||||
|
paramTypes.add(conSet.resolveType(parameter).resolvedType.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return new ArrayList<>(paramTypes.stream().filter(el -> !el.contains("TPH ")).map(el -> new Type(el, false)).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> filterOutDuplicates(List<Type> typeListOne, List<Type> typeListTwo) {
|
||||||
|
|
||||||
|
ArrayList<Type> filteredArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
typeListOne.forEach(el -> {
|
||||||
|
boolean found = false;
|
||||||
|
for(Type typeInListTwo : typeListTwo) {
|
||||||
|
found = found || typeInListTwo.getType().equals(el.getType());
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
filteredArrayList.add(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return filteredArrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> filterOutDuplicates(List<Type> typeListOne) {
|
||||||
|
HashMap<String, Type> hashMap = new HashMap<>();
|
||||||
|
typeListOne.forEach(el -> {
|
||||||
|
hashMap.put(el.getType(), el);
|
||||||
|
});
|
||||||
|
return new ArrayList<>(hashMap.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getClassGenerics(Map<SourceFile, List<GenericsResult>> genericsResult, Method method, ClassOrInterface clazz) {
|
||||||
|
ArrayList<Type> genericTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
genericsResult.forEach(((key, value) -> value.forEach(genericResultSet -> {
|
||||||
|
|
||||||
|
var result = genericResultSet.resolveTarget(method.getReturnType());
|
||||||
|
|
||||||
|
|
||||||
|
var genericResult = genericResultSet.getBounds(method.getReturnType(), clazz, method);
|
||||||
|
if (result != null && genericResult != null) {
|
||||||
|
genericResult.forEach(res -> {
|
||||||
|
if (res != null && !res.isOnMethod()) {
|
||||||
|
genericTypes.add(new Type("<" + result.name() + (res.bound().toString().equals("java.lang.Object") ? ">" : " extends " + res.bound().toString() + ">"), true));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
})));
|
||||||
|
|
||||||
|
return genericTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zum Erhalt für sowohl Parameter als auch Methoden.
|
||||||
|
*/
|
||||||
|
public ArrayList<LSPVariable> infereInput(String input) throws IOException, ClassNotFoundException {
|
||||||
|
logger.info("Infering Types for Input.");
|
||||||
|
|
||||||
|
var transferObj = languageServer.getResultSetAndAbstractSyntax(input);
|
||||||
|
ArrayList<LSPVariable> methodsWithParametersLSPVariableList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Hier noch irgendwie die Klasse rausfinden oder durchgehen.
|
||||||
|
//GENERICS OF CLASS
|
||||||
|
for (var method : transferObj.getAst().getAllMethods()) {
|
||||||
|
|
||||||
|
|
||||||
|
for (var clazz : transferObj.getAst().getClasses()) {
|
||||||
|
ArrayList<Type> genericTypes = getClassGenerics(transferObj.getGeneratedGenerics(), method, clazz);
|
||||||
|
TextHelper helper = new TextHelper();
|
||||||
|
methodsWithParametersLSPVariableList.add(new LSPClass("test", genericTypes, clazz.getOffset().getLine(), helper.getClassPositionForGeneric(clazz.getOffset().getLine() - 1, input, clazz.getOffset().getStopIndex()), clazz.getOffset().getStopIndex()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var method : transferObj.getAst().getAllMethods()) {
|
||||||
|
var types = getAvailableTypes(transferObj.getResultSets(), method);
|
||||||
|
var generics = getAvailableGenericTypes(transferObj.getGeneratedGenerics().values().stream().flatMap(List::stream).collect(Collectors.toList()), method);
|
||||||
|
|
||||||
|
if (!types.isEmpty()) {
|
||||||
|
methodsWithParametersLSPVariableList.add(new LSPMethod(method.name, filterOutDuplicates(types), method.getOffset().getLine(), method.getOffset().getCharPositionInLine(), method.getOffset().getStopIndex()));
|
||||||
|
}
|
||||||
|
if (!generics.isEmpty()) {
|
||||||
|
ArrayList<Type> typesThatAreGeneric = filterOutDuplicates(generics, types);
|
||||||
|
typesThatAreGeneric.forEach(el -> el.setType("<" + el.getType() + "> " + el.getType()));
|
||||||
|
methodsWithParametersLSPVariableList.add(new LSPMethod(method.name, filterOutDuplicates(typesThatAreGeneric), method.getOffset().getLine(), method.getOffset().getCharPositionInLine(), method.getOffset().getStopIndex()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var param : method.getParameterList()) {
|
||||||
|
ArrayList<Type> typeParam = getAvailableTypes(transferObj.getResultSets(), param.getType());
|
||||||
|
ArrayList<Type> genericParam = getAvailableGenericTypes(transferObj.getGeneratedGenerics().values().stream().flatMap(List::stream).collect(Collectors.toList()), param.getType());
|
||||||
|
|
||||||
|
if (!typeParam.isEmpty()) {
|
||||||
|
methodsWithParametersLSPVariableList.add(new LSPParameter(method.name, filterOutDuplicates(typeParam), param.getOffset().getLine(), param.getOffset().getCharPositionInLine(), param.getOffset().getStopIndex()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!genericParam.isEmpty()) {
|
||||||
|
ArrayList<Type> typesThatAreGeneric = filterOutDuplicates(genericParam, typeParam);
|
||||||
|
methodsWithParametersLSPVariableList.add(new LSPMethod(method.name, filterOutDuplicates(typesThatAreGeneric), method.getOffset().getLine(), param.getOffset().getCharPositionInLine(), param.getOffset().getStopIndex()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return methodsWithParametersLSPVariableList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
9
LanguageServer/src/main/java/de/dhbw/model/LSPClass.java
Normal file
9
LanguageServer/src/main/java/de/dhbw/model/LSPClass.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package de.dhbw.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LSPClass extends LSPVariable{
|
||||||
|
public LSPClass(String name, ArrayList<Type> possibleTypes, int line, int charPosition, int endPosition) {
|
||||||
|
super(name, possibleTypes, line, charPosition, endPosition);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
package de.dhbw.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LSPMethod extends LSPVariable {
|
||||||
|
public LSPMethod(String name, ArrayList<Type> type, int line, int charPosition, int endPosition) {
|
||||||
|
super(name, type, line, charPosition, endPosition);
|
||||||
|
}
|
||||||
|
}
|
10
LanguageServer/src/main/java/de/dhbw/model/LSPParameter.java
Normal file
10
LanguageServer/src/main/java/de/dhbw/model/LSPParameter.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package de.dhbw.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LSPParameter extends LSPMethod {
|
||||||
|
|
||||||
|
public LSPParameter(String name, ArrayList<Type> type, int line, int charPosition, int endPosition) {
|
||||||
|
super(name, type, line, charPosition, endPosition);
|
||||||
|
}
|
||||||
|
}
|
59
LanguageServer/src/main/java/de/dhbw/model/LSPVariable.java
Normal file
59
LanguageServer/src/main/java/de/dhbw/model/LSPVariable.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package de.dhbw.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class LSPVariable { String name;
|
||||||
|
ArrayList<Type> possibleTypes;
|
||||||
|
int line;
|
||||||
|
int charPosition;
|
||||||
|
int endPosition;
|
||||||
|
boolean needsInference;
|
||||||
|
|
||||||
|
public LSPVariable(String name, ArrayList<Type> possibleTypes, int line, int charPosition, int endPosition) {
|
||||||
|
this.name = name;
|
||||||
|
this.possibleTypes = possibleTypes;
|
||||||
|
this.line = line;
|
||||||
|
this.charPosition = charPosition;
|
||||||
|
this.endPosition = endPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEndPosition() {
|
||||||
|
return endPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndPosition(int endPosition) {
|
||||||
|
this.endPosition = endPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Type> getPossibleTypes() {
|
||||||
|
return possibleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPossibleTypes(ArrayList<Type> possibleTypes) {
|
||||||
|
this.possibleTypes = possibleTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLine() {
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLine(int line) {
|
||||||
|
this.line = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCharPosition() {
|
||||||
|
return charPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCharPosition(int charPosition) {
|
||||||
|
this.charPosition = charPosition;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,43 +0,0 @@
|
|||||||
package de.dhbw.model;
|
|
||||||
|
|
||||||
public class MethodNameWithType {
|
|
||||||
String name;
|
|
||||||
String type;
|
|
||||||
int line;
|
|
||||||
int charPosition;
|
|
||||||
|
|
||||||
public MethodNameWithType(String name, String type, int line, int charPosition) {
|
|
||||||
this.name = name;
|
|
||||||
this.type = type;
|
|
||||||
this.line = line;
|
|
||||||
this.charPosition = charPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
public int getLine() {
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
public void setLine(int line) {
|
|
||||||
this.line = line;
|
|
||||||
}
|
|
||||||
public int getCharPosition() {
|
|
||||||
return charPosition;
|
|
||||||
}
|
|
||||||
public void setCharPosition(int charPosition) {
|
|
||||||
this.charPosition = charPosition;
|
|
||||||
}
|
|
||||||
}
|
|
27
LanguageServer/src/main/java/de/dhbw/model/Type.java
Normal file
27
LanguageServer/src/main/java/de/dhbw/model/Type.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package de.dhbw.model;
|
||||||
|
|
||||||
|
public class Type {
|
||||||
|
String type;
|
||||||
|
boolean generic;
|
||||||
|
|
||||||
|
public Type(String type, boolean generic){
|
||||||
|
this.type = type;
|
||||||
|
this.generic = generic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeneric(boolean generic) {
|
||||||
|
this.generic = generic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGeneric() {
|
||||||
|
return generic;
|
||||||
|
}
|
||||||
|
}
|
9
LanguageServer/src/main/resources/log4j.properties
Normal file
9
LanguageServer/src/main/resources/log4j.properties
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Root Logger
|
||||||
|
log4j.rootLogger=DEBUG, FILE
|
||||||
|
|
||||||
|
# File Appender
|
||||||
|
log4j.appender.FILE=org.apache.log4j.FileAppender
|
||||||
|
log4j.appender.FILE.File=C:/Users/ruben/Desktop/log.txt
|
||||||
|
log4j.appender.FILE.Append=true
|
||||||
|
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n
|
@@ -1,23 +1,36 @@
|
|||||||
import de.dhbw.compiler.languageServerInterface.LanguageServerInterface;
|
import de.dhbw.compiler.languageServerInterface.LanguageServerInterface;
|
||||||
import de.dhbw.helper.TypeFinder;
|
import de.dhbw.helper.TextHelper;
|
||||||
|
import de.dhbw.helper.TypeResolver;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CompilerInterfaceTest {
|
public class CompilerInterfaceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAbstractSyntaxAsString() throws IOException, ClassNotFoundException {
|
public void testAbstractSyntaxAsString() throws IOException, ClassNotFoundException {
|
||||||
LanguageServerInterface languageServer = new LanguageServerInterface();
|
LanguageServerInterface languageServer = new LanguageServerInterface();
|
||||||
var res = languageServer.getResultSetAndAbstractSyntax("import java.lang.Integer; public class test{\n" +
|
var res = languageServer.getResultSetAndAbstractSyntax("import java.lang.Integer;\n import java.lang.String;\n" +
|
||||||
" \n" +
|
"public class test{\n" +
|
||||||
" public main( test){\n" +
|
"public main(test){" +
|
||||||
" Integer i = test; " +
|
"if(0>1){" +
|
||||||
" return i;\n" +
|
"return \"w\";" +
|
||||||
" }\n" +
|
"}" +
|
||||||
|
"Integer i = 0;" +
|
||||||
|
"return i;" +
|
||||||
|
"}" +
|
||||||
"}");
|
"}");
|
||||||
|
|
||||||
System.out.println("TEST OUTPUT:");
|
System.out.println("TEST OUTPUT:");
|
||||||
|
|
||||||
|
ArrayList<String> allTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
res.getResultSets().forEach(el -> allTypes.add(el.resolveType(res.getAst().getAllMethods().get(0).getReturnType()).resolvedType.toString()));
|
||||||
|
var results = res.getGeneratedGenerics().entrySet().iterator().next();
|
||||||
|
|
||||||
|
|
||||||
System.out.println(res.getResultSets().toString());
|
System.out.println(res.getResultSets().toString());
|
||||||
|
|
||||||
|
|
||||||
@@ -25,11 +38,26 @@ public class CompilerInterfaceTest {
|
|||||||
System.out.println(res.getPrintedAst());
|
System.out.println(res.getPrintedAst());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConstraintTypes() throws IOException, ClassNotFoundException {
|
||||||
|
LanguageServerInterface languageServer = new LanguageServerInterface();
|
||||||
|
TypeResolver typeResolver = new TypeResolver();
|
||||||
|
|
||||||
|
|
||||||
|
var res = typeResolver.infereInput("import java.lang.Integer; public class test{\n" +
|
||||||
|
" \n" +
|
||||||
|
" public main(testa){\n" +
|
||||||
|
" return testa;\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}");
|
||||||
|
res.forEach(el -> el.getPossibleTypes().forEach(el2 -> System.out.println(el2.getType() + " " + (el2.isGeneric() ? "GENERIC" : "NO GENERIC"))));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTypeFinder() throws IOException, ClassNotFoundException {
|
public void testTypeFinder() throws IOException, ClassNotFoundException {
|
||||||
TypeFinder typeFinder = new TypeFinder();
|
TypeResolver typeResolver = new TypeResolver();
|
||||||
var inferedMethods = typeFinder.infereMethodType("import java.lang.Integer; import java.lang.String;" +
|
var inferedMethods = typeResolver.infereInput("import java.lang.Integer;\n import java.lang.String;\n" +
|
||||||
"public class test{"+
|
"public class test{\n" +
|
||||||
"public main(test){" +
|
"public main(test){" +
|
||||||
"if(0>1){" +
|
"if(0>1){" +
|
||||||
"return \"w\";" +
|
"return \"w\";" +
|
||||||
@@ -40,7 +68,67 @@ public class CompilerInterfaceTest {
|
|||||||
"}"
|
"}"
|
||||||
);
|
);
|
||||||
|
|
||||||
inferedMethods.forEach(el -> System.out.println(el.getName() + ": " + el.getType()));
|
inferedMethods.forEach(el -> System.out.println(el.getName() + ": " + el.getPossibleTypes() + " | " + el.getLine() + " " + el.getCharPosition()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGenericTypes() throws IOException, ClassNotFoundException {
|
||||||
|
TypeResolver typeResolver = new TypeResolver();
|
||||||
|
var inferedMethods = typeResolver.infereInput("import java.lang.Integer; public class test{\n" +
|
||||||
|
" \n" +
|
||||||
|
" public main(testa){\n" +
|
||||||
|
" return testa;\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
|
||||||
|
inferedMethods.forEach(el -> System.out.println(el.getName() + ": " + el.getPossibleTypes() + " | " + el.getLine() + " " + el.getCharPosition()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTypeFinderParameter() throws IOException, ClassNotFoundException {
|
||||||
|
TypeResolver typeResolver = new TypeResolver();
|
||||||
|
var inferedMethods = typeResolver.infereInput("import java.lang.Integer;\n" +
|
||||||
|
"import java.lang.String; \n" +
|
||||||
|
"public class test{\n" +
|
||||||
|
" public main(test, test2){\n" +
|
||||||
|
" if(1>0){\n" +
|
||||||
|
" return test;\n" +
|
||||||
|
" }\n" +
|
||||||
|
" String i = test;\n" +
|
||||||
|
" return 1;\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
|
||||||
|
inferedMethods.forEach(el -> System.out.println(el.getName() + ": " + el.getPossibleTypes()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCharEnding() throws IOException, ClassNotFoundException {
|
||||||
|
TextHelper textHelper = new TextHelper();
|
||||||
|
var endingChar = textHelper.getEndingCharOfStartingChar(3,13,"import java.lang.Integer;\n" +
|
||||||
|
"import java.lang.String; \n" +
|
||||||
|
"public class test{\n" +
|
||||||
|
" public main(test, test2){\n" +
|
||||||
|
" if(1>0){\n" +
|
||||||
|
" return test;\n" +
|
||||||
|
" }\n" +
|
||||||
|
" String i = test;\n" +
|
||||||
|
" return 1;\n" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
|
||||||
|
Assert.assertEquals(15, (int) endingChar);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,6 @@ public class JavaTXLanguageDocumentServiceTest {
|
|||||||
public void testWordExtraction() {
|
public void testWordExtraction() {
|
||||||
JavaTXTextDocumentService service = new JavaTXTextDocumentService();
|
JavaTXTextDocumentService service = new JavaTXTextDocumentService();
|
||||||
|
|
||||||
assertEquals(service.getWordOfLineAndCharacter(0,0, "test"),"test");
|
//assertEquals(service.getWordOfLineAndCharacter(0,0, "test"),"test");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
README.md
21
README.md
@@ -5,10 +5,11 @@ It uses the LSP4J Framework in Version 0.23.1.
|
|||||||
## Functionality
|
## Functionality
|
||||||
Currently the Language Server has the following functionalities:
|
Currently the Language Server has the following functionalities:
|
||||||
- Syntax-Check
|
- Syntax-Check
|
||||||
- Hovereffect that displays the current hovered Word
|
|
||||||
- Autocomplete for ForLoops and Main Method.
|
- Autocomplete for ForLoops and Main Method.
|
||||||
- Basic Autoformatting (removing every Space at the End of the Line)
|
- Basic Autoformatting (removing every Space at the End of the Line)
|
||||||
- Display Type of Methods with TypeInference
|
- Display Type of Methods and Parameters with TypeInference
|
||||||
|
- Select Type of typinfered Type and replace it (including Generics)
|
||||||
|
- Give Hint of all possible Types to Select from (including Generics)
|
||||||
|
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
@@ -16,7 +17,7 @@ Currently the Language Server has the following functionalities:
|
|||||||
.
|
.
|
||||||
├── Client/
|
├── Client/
|
||||||
│ ├── VisualStudioCode -> Containing the Client for VS Code. In this Case a Extension.
|
│ ├── VisualStudioCode -> Containing the Client for VS Code. In this Case a Extension.
|
||||||
│ ├── Eclipse
|
│ ├── Emacs
|
||||||
│ ├── Intellij
|
│ ├── Intellij
|
||||||
│ └── ...
|
│ └── ...
|
||||||
└── LanguageServer/
|
└── LanguageServer/
|
||||||
@@ -40,8 +41,18 @@ Currently the Language Server has the following functionalities:
|
|||||||
To use this Language Server you have to follow this steps:
|
To use this Language Server you have to follow this steps:
|
||||||
1. Package the LanguageServer with ```maven:package```.
|
1. Package the LanguageServer with ```maven:package```.
|
||||||
2. Open the VS-Code Client and run ```npm install```.
|
2. Open the VS-Code Client and run ```npm install```.
|
||||||
3. change Path in ```extensions.ts``` to absolute Path of your packaged Jar-File that you packaged in Step 1. (Line 20 and 24)
|
|
||||||
4. run ```npm run compile```
|
4. run ```npm run compile```
|
||||||
5. Go to Debug and Run the Extension.
|
5. Go to Debug and Run the Extension.
|
||||||
6. Press F1 and execute the Hello World Command.
|
6. Press F1 and execute the Hello World Command.
|
||||||
7. You can create .java Files which will be analysed by the Language Server.
|
7. You can create .jav Files which will be analysed by the Language Server.
|
||||||
|
|
||||||
|
## Known Problems and what to do
|
||||||
|
|
||||||
|
1. If the TypeInference does not display any Typehints or Typeselection, restart the IDE including the Extension thus deleting the Cache.
|
||||||
|
2. Selecting a Generic will Result in a Class-Generic extending Object, wich is not legal in Java. Delete the extends Statement.
|
||||||
|
3. Selecting a Generic after another Generic is selected results in illegal Syntax. Delete the newly greated Generic and add the Generic Name and if needet its extension into the other Declaration.
|
||||||
|
|
||||||
|
## Logic
|
||||||
|
The Language Server in itself can be used for any Client. The Clients task is to start the Langauge Server and handle the Communication with it.
|
||||||
|
|
||||||
|

|
167
docs/diagram.drawio
Normal file
167
docs/diagram.drawio
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<mxfile host="65bd71144e" scale="10" border="0">
|
||||||
|
<diagram id="u07XxLFaEpzG2f9e_3K5" name="Page-1">
|
||||||
|
<mxGraphModel dx="2184" dy="1340" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="2000" pageHeight="1169" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0"/>
|
||||||
|
<mxCell id="1" parent="0"/>
|
||||||
|
<mxCell id="27" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="250" y="180" width="220" height="590" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="25" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="500" y="180" width="650" height="590" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="2" value="JavaTX Compiler Interface" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="340" y="280" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="3" value="LSP-Typefinder" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="760" y="280" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="4" value="" style="endArrow=classic;html=1;exitX=0;exitY=0.25;exitDx=0;exitDy=0;entryX=1;entryY=0.25;entryDx=0;entryDy=0;" parent="1" source="3" target="2" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="640" y="380" as="sourcePoint"/>
|
||||||
|
<mxPoint x="690" y="330" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="5" value="input : String" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="4" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.4244" y="-1" relative="1" as="geometry">
|
||||||
|
<mxPoint x="74" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="6" value="" style="endArrow=classic;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="2" target="3" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="550" y="390" as="sourcePoint"/>
|
||||||
|
<mxPoint x="600" y="340" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="7" value="ResultSet and AST : LSP-DTO" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="6" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.0333" relative="1" as="geometry">
|
||||||
|
<mxPoint x="15" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="8" value="JavaTX<br>DocumentService" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="760" y="440" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="9" value="" style="endArrow=classic;html=1;entryX=0.25;entryY=1;entryDx=0;entryDy=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;" parent="1" source="8" target="3" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="800" y="430" as="sourcePoint"/>
|
||||||
|
<mxPoint x="850" y="380" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="10" value="input: string" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="9" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.1333" y="1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="11" value="" style="endArrow=classic;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" parent="1" source="3" target="8" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="860" y="420" as="sourcePoint"/>
|
||||||
|
<mxPoint x="910" y="370" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="13" value="types :<br>List&lt;NameWithType&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="11" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.3667" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="14" value="NameWithType contains the Name, the Type and the Position of the Variable" style="shape=note2;boundedLbl=1;whiteSpace=wrap;html=1;size=12;verticalAlign=top;align=center;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="980" y="350" width="140" height="80" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="15" value="" style="endArrow=none;dashed=1;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="14" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="910" y="380" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1000" y="480" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="16" value="JavaTX<br>LanguageServer" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="760" y="560" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="17" value="" style="endArrow=classic;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;startArrow=classic;startFill=1;" parent="1" source="16" target="8" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="740" y="570" as="sourcePoint"/>
|
||||||
|
<mxPoint x="790" y="520" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="19" value="Initialises the Language Server and select the Features" style="shape=note2;boundedLbl=1;whiteSpace=wrap;html=1;size=12;verticalAlign=top;align=center;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="980" y="490" width="120" height="70" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="20" value="" style="endArrow=none;dashed=1;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="16" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="910" y="525" as="sourcePoint"/>
|
||||||
|
<mxPoint x="980" y="535" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="21" value="JavaTX<br>LanugaeServer<br>Launcher" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="760" y="670" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="22" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;startArrow=classic;startFill=1;" parent="1" source="21" target="16" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="680" y="710" as="sourcePoint"/>
|
||||||
|
<mxPoint x="730" y="660" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="23" value="Starts the LanguageServer with Sys.In and Sys.Out<br>Also gives the LanguageServer its Client-Reference" style="shape=note2;boundedLbl=1;whiteSpace=wrap;html=1;size=12;verticalAlign=top;align=center;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="550" y="550" width="120" height="110" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="24" value="" style="endArrow=none;dashed=1;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=0;exitY=0;exitDx=120;exitDy=46;exitPerimeter=0;" parent="1" source="23" target="21" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="890" y="600" as="sourcePoint"/>
|
||||||
|
<mxPoint x="990" y="545" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="26" value="LanguageServer" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="520" y="180" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="28" value="JavaTXCompiler" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="270" y="180" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="29" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1180" y="530" width="460" height="240" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="30" value="extension.ts" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1250" y="670" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="31" value="" style="endArrow=classic;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="30" target="21" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1020" y="740" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1070" y="690" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="32" value="starts" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="31" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.3103" y="2" relative="1" as="geometry">
|
||||||
|
<mxPoint x="92" y="-2" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="33" value="" style="endArrow=none;dashed=1;html=1;entryX=0.652;entryY=0.333;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="29" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1370" y="700" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1420" y="650" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="34" value="" style="endArrow=none;dashed=1;html=1;entryX=0.25;entryY=1;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="30" target="38" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1380" y="710" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1570.25" y="529.8399999999999" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="35" value="" style="endArrow=none;dashed=1;html=1;entryX=0.167;entryY=0.667;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="39" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1370" y="700" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1669.7000000000003" y="600.05" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="36" value="LanguageServerClient for Visual Studio Code" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1175" y="530" width="270" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="37" value="..." style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1470" y="575" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="38" value="..." style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1510" y="605" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="39" value="..." style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1550" y="670" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
BIN
docs/diagram.png
Normal file
BIN
docs/diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
Reference in New Issue
Block a user