Giter Club home page Giter Club logo

java-language-server's Introduction

Language Server for Java using the Java compiler API

A Java language server based on v3.0 of the protocol and implemented using the Java compiler API.

Installation (VS Code)

Install from the VS Code marketplace

Installation (other editors)

Vim (with vim-lsc)

  • Checkout this repository
  • Run ./scripts/link_{linux|mac|windows}.sh
  • Run mvn package -DskipTests
  • Add the vim plugin natebosch/vim-lsc to your vimrc
  • Add vim-lsc configuration:
    let g:lsc_server_commands = {'java': '<path-to-java-language-server>/java-language-server/dist/lang_server_{linux|mac|windows}.sh'}
  • See the vim-lsc README for other configuration options.

Note: This tool is not compatible with vim-lsp as it only supports LSPv2.0.

KDE Kate

  • Checkout this repository
  • Run ./scripts/link_{linux|mac|windows}.sh
  • Run mvn package -DskipTests
  • Open your Kate editor
  • Go to Settings > Configure Kate... > LSP Client > User Server Settings
  • Add this lines to your User Server Settings:
{
    "servers":
    {
        "java":
        {
            "command": ["bash","<path-to-java-language-server>/java-language-server/dist/lang_server_{linux|mac|windows}.sh"],
            "url": "https://github.com/georgewfraser/java-language-server",
            "highlightingModeRegex": "^Java$"
        }
    }
}

Sublime 3 (with LSP)

  • Checkout this repository
  • Run ./scripts/link_{linux|mac|windows}.sh
  • Run mvn package -DskipTests
  • Open your Sublime 3
  • Install Package Control (if missing)
  • Install the LSP Package (if missing)
  • In Sublime, go to Preferences > Package Settings > LSP > Settings
  • Add this lines to your LSP Settings:
{
    "clients":
    {
        "jls":
        {
            "enabled": true,
            "command": ["bash", "<path-to-java-language-server>/java-language-server/dist/lang_server_{linux|mac|windows}.sh"],
            "scopes": ["source.java"],
            "syntaxes": ["Packages/Java/Java.sublime-syntax"],
            "languageId": "java"
        }
    }
}

Features

Javadoc

Javadoc

Signature help

Signature help

Autocomplete symbols (with auto-import)

Auto import 1

Auto import 2

Autocomplete members

Autocomplete members

Go-to-definition

Goto 1

Goto 2

Find symbols

Find workspace symbols

Find document symbols

Lint

Error highlight

Type information on hover

Type hover

Find references

Find references 1

Find references 2

Debug

Debug test

Usage

The language server will provide autocomplete and other features using:

  • .java files anywhere in your workspace
  • Java platform classes
  • External dependencies specified using pom.xml, Bazel, or settings

Settings

If the language server doesn't detect your external dependencies automatically, you can specify them using .vscode/settings.json

{
    "java.externalDependencies": [
        "junit:junit:jar:4.12:test", // Maven format
        "junit:junit:4.12" // Gradle-style format is also allowed
    ]
}

If all else fails, you can specify the Java class path and the locations of source jars manually:

{
    "java.classPath": [
        "lib/some-dependency.jar"
    ],
    "java.docPath": [
        "lib/some-dependency-sources.jar"
    ]
}

You can generate a list of external dependencies using your build tool:

  • Maven: mvn dependency:list
  • Gradle: gradle dependencies

The Java language server will look for the dependencies you specify in java.externalDependencies in your Maven and Gradle caches ~/.m2 and ~/.gradle. You should use your build tool to download the library and source jars of all your dependencies so that the Java language server can find them:

  • Maven
    • mvn dependency:resolve for compilation and autocomplete
    • mvn dependency:resolve -Dclassifier=sources for inline Javadoc help
  • Gradle
    • gradle dependencies for compilation and autocomplete
    • Include classifier: sources in your build.gradle for inline Javadoc help, for example:
      dependencies {
          testCompile group: 'junit', name: 'junit', version: '4.+'
          testCompile group: 'junit', name: 'junit', version: '4.+', classifier: 'sources'
      }
      

Design

The Java language server uses the Java compiler API to implement language features like linting, autocomplete, and smart navigation, and the language server protocol to communicate with text editors like VSCode.

Incremental updates

The Java compiler API provides incremental compilation at the level of files: you can create a long-lived instance of the Java compiler, and as the user edits, you only need to recompile files that have changed. The Java language server optimizes this further by focusing compilation on the region of interest by erasing irrelevant code. For example, suppose we want to provide autocomplete after print in the below code:

class Printer {
    void printFoo() {
        System.out.println("foo");
    }
    void printBar() {
        System.out.println("bar");
    }
    void main() {
        print // Autocomplete here
    }
}

None of the code inside printFoo() and printBar() is relevant to autocompleting print. Before servicing the autocomplete request, the Java language server erases the contents of these methods:

class Printer {
    void printFoo() {

    }
    void printBar() {

    }
    void main() {
        print // Autocomplete here
    }
}

For most requests, the vast majority of code can be erased, dramatically speeding up compilation.

Logs

The java service process will output a log file to stderr, which is visible in VSCode using View / Output, under "Java".

Contributing

Installing

Before installing locally, you need to install prerequisites: npm, maven, protobuf. For example on Mac OS, you can install these using Brew:

brew install npm maven protobuf

You also need to have Java 13 installed. Point the JAVA_HOME environment variable to it. For example, on Mac OS:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/

Assuming you have these prerequisites, you should be able to install locally using:

npm install -g vsce
npm install
./scripts/build.sh

Editing

Please run ./configure before your first commit to install a pre-commit hook that formats the code.

java-language-server's People

Contributors

brianduff avatar brown avatar chaostheorie avatar dependabot[bot] avatar derkoe avatar dradtke avatar draftcode avatar ecita avatar georgewfraser avatar ghostgold avatar grimkriegor avatar hatstand avatar kaklakariada avatar languitar avatar leighmcculloch avatar mastergeekmx avatar mattn avatar michael-hardeman avatar neilpeirce avatar orionlee avatar phgn0 avatar rafaeldeoliveira avatar secondsun avatar stupid-genius avatar tert0z avatar theothertomelliott avatar tillerino avatar tomboyo avatar trett avatar xndcn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-language-server's Issues

Update Maven dependency versions

When upgrading a library that makes breaking changes (in a pom.xml for a Maven project), the editor does not seem to have awareness of the version change.

For instance, if an import is no longer available in the new version, an error to the effect that "The import cannot be resolved" is expected (IntelliJ does this). However, the editor still treats it as a valid import.

vscode-javac could benefit from VS Code's language service protocol

@georgewfraser I stumble over your plugin in the market place and it is quite cool. I looked at the source code to understand how you provided the Java smartness. Nice idea to reuse tools.jar from the JDK.

I noticed that you came up with our own JSON protocol to talk to your Java process. I would like to point you to two GitHub repositories we maintain to ease such integration:

https://github.com/Microsoft/vscode-languageserver-protocol
https://github.com/Microsoft/vscode-languageserver-node

The first one is basically a JSON-RPC protocol specification that can be implemented by language servers in the programming language of their choice. The second one provides client and server implementations in node. Even if your server is implemented in a language different than node you could still profit from implementing the protocol since you get the client for free. The npm vscode-languageclient module basically wires up the protocol to VSCode's API based on capabilities returned from the server.

The following issue list implementers of the protocol in different languages: microsoft/language-server-protocol#8

If you want to look for a simple example on how that works in action you can have a look at https://github.com/Microsoft/vscode-languageserver-node-example. Please note that the client in this example starts the server as a node process. However the client library supports starting any kind of server as well.

Some background about me: I am a developer in VS Code responsible for language service integration.

If you are interested in making use of the protocol and the client library I am happy to answer questions and to help.

Can't get it to work

I have a repository that contains several projects in subdirectories. I added a javaconfig.json for each which looks like this:

{
  "sourcePath": ["src"],
  "classPathFile": "classpath.txt",
  "outputDirectory": "bin"
}

Since the project is not using Maven I added the classpath.txt manually with this content:

C:\Users\felix\.p2\pool\plugins\org.junit_4.12.0.v201504281640\junit.jar

(it would be easier if I could specify this right in javaconfig.json or if you also looked at the environment variable CLASSPATH)

No matter in which file I go, I do not get rich IntelliSense and goto symbol yields "We have no symbol information for this file".

Proxy support

I work behind a corporate proxy and couldn't get the extension to work.

I've found no way to configure proxy to communicate, so I believe it doesn't support it now, am I right?

Start to publish 0.1.0

Right now vscode-javac is not publish to anywhere, in order to pull it in as a dependency to package with the distribution, we have to download the repo and build locally.
Is there anything that's blocking publishing 0.1? Can we setup a circle build (so that it can also run checks before merging changes into master) and maybe start to publish to bintray?

Couldn't start client Language support for Java

I'm using a macOS Sierra, and JDK 8u101 (I don't bother with updating it so often).
As you can see on my Terminal I'm using JDK_PATH, and javac path is correctly set.
screen shot 2016-11-02 at 16 06 33 2
Yet I still get an error Couldn't start client Language support for Java.
Does it really require a newest version of JDK?

Why my JAVA_HOME env not work?

I has set my JAVA_HOME to my jdk1.8 install path, and checked it in my cmd window, it is right.
But when I open my VSCode, it is not work.
like this:
Alt imgsshow

Error

Missing header Content-Length in input "iten Stadt.\n */\n public void swap(final String[] roundTrip, final int town1, final int town2) {\n if (roundTrip[town1] == null || roundTrip[town2] == null) {\n throw new IllegalArgumentException(\"Mindestens eine der beiden Städte ist nicht bekannt\");\n }\n String speicherTown = roundTrip[town1];\n roundTrip[town1] = roundTrip[town2];\n roundTrip[town2] = speicherTown;\n }\n\n /\n * Die F
Close
com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 3357 path $.params.textDocument.text

NoClassDefFoundError when running ./scripts/install.sh

I'm not using VSCode, so I'm trying to build this with ./scripts/install.sh, but I get this:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetE
xception: null
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.NoClassDefFoundError: workspace/out/com/example/Test (wrong name: com/example/Test)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.maven.surefire.util.DefaultScanResult.loadClass(DefaultScanResult.java:131)
        at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:95)
        at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:194)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:92)
        ... 9 more

build failed.

I did build vscode-javac on mac.
My mac installed java 1.8.

How to resolve it?

I ran mvn compile.

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building javac-services 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ javac-services ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /workspace/github/github/vscode-javac/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ javac-services ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 48 source files to /workspace/github/github/vscode-javac/target/classes
[INFO] /workspace/github/github/vscode-javac/src/main/java/org/javacs/JavaLanguageServer.java: /workspace/github/github/vscode-javac/src/main/java/org/javacs/JavaLanguageServer.java uses or overrides a deprecated API.
[INFO] /workspace/github/github/vscode-javac/src/main/java/org/javacs/JavaLanguageServer.java: Recompile with -Xlint:deprecation for details.
[INFO] /workspace/github/github/vscode-javac/src/main/java/org/javacs/Javadocs.java: /workspace/github/github/vscode-javac/src/main/java/org/javacs/Javadocs.java uses unchecked or unsafe operations.
[INFO] /workspace/github/github/vscode-javac/src/main/java/org/javacs/Javadocs.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] /workspace/github/github/vscode-javac/src/main/java/org/javacs/ClassPathIndex.java:[18,16] sun.misc.Launcher is internal proprietary API and may be removed in a future release
[WARNING] /workspace/github/github/vscode-javac/src/main/java/org/javacs/ClassPathIndex.java:[46,27] sun.misc.Launcher is internal proprietary API and may be removed in a future release
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[29,32] cannot find symbol
  symbol:   class StringUtils
  location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[31,32] cannot find symbol
  symbol:   class StringUtils
  location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PrimitiveTypeDesc.java:[28,32] cannot find symbol
  symbol:   class StringUtils
  location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/JavacHolder.java:[263,17] cannot find symbol
  symbol:   variable skipAnnotationProcessing
  location: variable compiler of type com.sun.tools.javac.main.JavaCompiler
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[62,44] cannot find symbol
  symbol:   variable StringUtils
  location: class org.javacs.pubapi.TypeDesc
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[71,20] cannot find symbol
  symbol:   variable StringUtils
  location: class org.javacs.pubapi.TypeDesc
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[178,26] cannot find symbol
  symbol:   variable StringUtils
  location: class org.javacs.pubapi.PubApi
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[300,22] cannot find symbol
  symbol:   variable StringUtils
  location: class org.javacs.pubapi.PubApi
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PrimitiveTypeDesc.java:[46,16] cannot find symbol
  symbol:   variable StringUtils
  location: class org.javacs.pubapi.PrimitiveTypeDesc
[INFO] 9 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.566 s
[INFO] Finished at: 2017-10-18T16:10:32+09:00
[INFO] Final Memory: 17M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project javac-services: Compilation failure: Compilation failure:
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[29,32] cannot find symbol
[ERROR] symbol:   class StringUtils
[ERROR] location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[31,32] cannot find symbol
[ERROR] symbol:   class StringUtils
[ERROR] location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PrimitiveTypeDesc.java:[28,32] cannot find symbol
[ERROR] symbol:   class StringUtils
[ERROR] location: package com.sun.tools.javac.util
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/JavacHolder.java:[263,17] cannot find symbol
[ERROR] symbol:   variable skipAnnotationProcessing
[ERROR] location: variable compiler of type com.sun.tools.javac.main.JavaCompiler
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[62,44] cannot find symbol
[ERROR] symbol:   variable StringUtils
[ERROR] location: class org.javacs.pubapi.TypeDesc
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/TypeDesc.java:[71,20] cannot find symbol
[ERROR] symbol:   variable StringUtils
[ERROR] location: class org.javacs.pubapi.TypeDesc
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[178,26] cannot find symbol
[ERROR] symbol:   variable StringUtils
[ERROR] location: class org.javacs.pubapi.PubApi
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PubApi.java:[300,22] cannot find symbol
[ERROR] symbol:   variable StringUtils
[ERROR] location: class org.javacs.pubapi.PubApi
[ERROR] /workspace/github/github/vscode-javac/src/main/java/org/javacs/pubapi/PrimitiveTypeDesc.java:[46,16] cannot find symbol
[ERROR] symbol:   variable StringUtils
[ERROR] location: class org.javacs.pubapi.PrimitiveTypeDesc
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

JSON schema (IntelliSense) for javaconfig.json

I'm getting

Unable to load schema from 'c:\Users\felix\.vscode\extensions\georgewfraser.vscode-javac-0.0.5\lib\javaconfig.schema.json': Not Found. The requested location could not be found.

goto defenition only works on .java files.

I made 2 files. One is called Test.java the other one Test.pde (The extention used by processing www.processing.org).

This is the code:

class Test {    
    void foo() {
        String s = "dfsdf";
    }
}

The language mode is for both set at java.

screen shot 2017-08-08 at 16 49 27

The goto defenition only works for the file with the java extention.
screen shot 2017-08-08 at 16 49 49

(As in that brings me to String.class where I can view the code)

Duplicate class errors (without classes and sources both present)

I kept getting, Duplicate class errors. similar to #14 but I believe it is different,

In the gradle-based (Android) project, It happens to most of the classes, except the class in the initial open editor window. E.g., if SomeClass.java is the initial open editor window upon startup, it parses okay. However, if the same SomeClass.java is not the initial open editor window, when I subsequently open it, I get Duplicate class errors.

Unlike the scenario in #14, the "outputDirectory" does not point to any generated classes either. (It points to build/vscode-classes, which is empty, and not being used by the gradle build).

javac-services.0.log did not produce any helpful messages either, only stating it is linting the file:

INFO    ?   main    2016-10-08T17:27:01.179Z    org.javacs.JavaLanguageServer#doLint    Lint AntennaPod\core\src\main\java\de\danoeh\antennapod\core\service\playback\PlaybackService.java

vscode developer tools panel did not give any messages either.

Thoughts?

Bug with reindent lines

If you have a comment in the code that contains a curly brace then reindentation gives wrong results.

to reproduce: paste this somewhere in your code (not at the bottom).

            // {
            // {
            // {  

And then use the reindent lines command.

} has no problem for me.

Infinite Loading on error suggestion

When I hover over highlighted errors and wait for a suggestion, the tooltip freezes with a "Loading" message (see attached image). Below are some messages from the Java Console when I start the project in code:

[Info - 6:04:59 PM] Connection closed [Warn - 6:04:59 PM] Unexpected params 'java.lang.Void@762ca2b4' for 'public default void org.eclipse.lsp4j.services.LanguageServer.initialized()' is ignored [Warn - 6:04:59 PM] Unsupported notification method: $/setTraceNotification [Info - 6:04:59 PM] Lint file:///Users/m/git/******/src/main/java/***/*****/******/dbpojo/Test.java [Info - 6:04:59 PM] Emit effective pom for /Users/m/git/moppet/pom.xml to /var/folders/16/jklb51p1409_wpyx8t78y8bm0000gn/T/effective-pom2290539182353371595.xml [Info - 6:05:08 PM] Emit classpath to /var/folders/16/jklb51p1409_wpyx8t78y8bm0000gn/T/classpath2404906236906906885.txt

Here's some information about my configuration:

  • Mac OS Sierra 10.12.5
  • Java 1.8.0_131
  • I also have Language Support for Java by Red Hat installed. But it seems to be the same result without it.
  • Maven 4.0.0

vscodeproblem

Classpath Issues on Windows

Hi,

I generated classpath.txt by Maven but still getting undefined symbols for a Spring Boot project, on Windows. (Path separator ";" File separator "")

Everything works for jdk and project local classes.

Demo Spring Boot Project:
demo.zip

[ERROR] Java language support requires Java 8

Encontered error message while opening java files. And it didn't work.

Here is the full error message:

Java language support requires Java 8 (using c:\Program Files\Java\jdk1.8.0_92\bin\java.exe)

I'm using Windows 10 x64 with jdk 1.8. "c:\Program Files\Java\jdk1.8.0_92" is the root directory of jdk.

java.io.IOException: Cannot run program "mvn"

I am pretty sure mvn is in my Path (using VSCode with Windows)

Exception details:

java.io.IOException: Cannot run program "mvn" (in directory "c:\enlistments\CentOS\project\common\java\master"): CreateProcess error=2, The system cannot find the file specified
java.lang.RuntimeException: java.io.IOException: Cannot run program "mvn" (in directory "c:\enlistments\CentOS\project\common\java\master"): CreateProcess error=2, The system cannot find the file specified
at org.javacs.JavaLanguageServer.buildClassPath(JavaLanguageServer.java:562)
at org.javacs.JavaLanguageServer.readIfConfig(JavaLanguageServer.java:525)
at org.javacs.JavaLanguageServer.doFindConfig(JavaLanguageServer.java:494)
at org.javacs.JavaLanguageServer$$Lambda$55/134310351.apply(Unknown Source)
at java.util.HashMap.computeIfAbsent(HashMap.java:1118)
at org.javacs.JavaLanguageServer.findConfig(JavaLanguageServer.java:489)
at org.javacs.JavaLanguageServer.findCompiler(JavaLanguageServer.java:454)
at org.javacs.JavaLanguageServer.doLint(JavaLanguageServer.java:310)
at org.javacs.JavaLanguageServer.access$400(JavaLanguageServer.java:31)
at org.javacs.JavaLanguageServer$1.didOpen(JavaLanguageServer.java:200)
at io.typefox.lsapi.services.transport.server.LanguageServerEndpoint._doAccept(LanguageServerEndpoint.xtend:198)
at io.typefox.lsapi.services.transport.server.LanguageServerEndpoint.doAccept(LanguageServerEndpoint.xtend:194)
at io.typefox.lsapi.services.transport.server.LanguageServerEndpoint.accept(LanguageServerEndpoint.xtend:114)
at io.typefox.lsapi.services.transport.server.LanguageServerEndpoint.accept(LanguageServerEndpoint.xtend)
at io.typefox.lsapi.services.transport.AbstractLanguageEndpoint.handleMessage(LanguageEndpoint.xtend:67)
at io.typefox.lsapi.services.transport.AbstractLanguageEndpoint.lambda$connect$4(LanguageEndpoint.xtend:61)
at io.typefox.lsapi.services.transport.AbstractLanguageEndpoint$$Lambda$51/1597655940.accept(Unknown Source)
at io.typefox.lsapi.services.json.StreamMessageReader$1.apply(StreamMessageReader.java:45)
at io.typefox.lsapi.services.json.StreamMessageReader$1.apply(StreamMessageReader.java:43)
at io.typefox.lsapi.services.json.StreamMessageReader.handleMessage(StreamMessageReader.xtend:128)
at io.typefox.lsapi.services.json.StreamMessageReader.listen(StreamMessageReader.xtend:61)
at io.typefox.lsapi.services.transport.AbstractLanguageEndpoint.connect(LanguageEndpoint.xtend:60)
at org.javacs.Main.run(Main.java:150)
at org.javacs.Main.main(Main.java:69)

Gradle/Android issues

Hi! I was trying to setup your plugin to work with an Android project with Gradle. (I don't know gradle that well so bear with me) In the readme.md, I think this line is wrong:

ext.destFile = file("javaconfig.json")
        ext.config = [
            sourcePath: sourceSets.collect{ it.java.srcDirs }.flatten().collect{ relativePath(it) },
>>>            classPathFile: relativePath(tasks.getByPath(':vscodeClasspathFile').outputs.files.singleFile),
            outputDirectory: relativePath(new File(buildDir, 'vscode-classes'))
        ]

Upon removing : from the :vsCodeClasspathFile the gradle task finished successfully. If I leave it there:

$ ./gradlew vscode

FAILURE: Build failed with an exception.

* Where:
Build file '/home/nmilosev/Projects/android/alfaevid/android/app/build.gradle' line: 52

* What went wrong:
A problem occurred evaluating project ':app'.
> Task with path ':vscodeClasspathFile' not found in project ':app'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.628 secs

Also I think it's a good idea to specify in the readme where to put your tasks in an android project - it should be under android { }.

Also the javaconfig.json file is a bit wrong:

{
    "sourcePath": [
        "app/src/androidTest/java",
        "app/src/debug/java",
        "app/src/main/java",
        "app/src/release/java",
        "app/src/test/java",
        "app/src/testDebug/java",
        "app/src/testRelease/java"
    ],
    "classPathFile": "app/build/classpath.txt",
    "outputDirectory": "app/build/vscode-classes"
}

and it should be:

{
    "sourcePath": [
        "src/androidTest/java",
        "src/debug/java",
        "src/main/java",
        "src/release/java",
        "src/test/java",
        "src/testDebug/java",
        "src/testRelease/java"
    ],
    "classPathFile": "build/classpath.txt",
    "outputDirectory": "build/vscode-classes"
}

When these little problems are fixed, the plugin works fantastically fast and well, dare I say faster than OmniSharp

Thanks for the plugin, works great so far!

source set-specific javaconfig.json

Thanks for posting the gradle task for generating a javaconfig.json. One shortcoming is that it only grabs compile dependencies, and skips over other dependency groups, like testCompile.

It's straightforward to add in these other dependency groups to the generated classpath.txt. But as an extension, is it possible to make these classpaths source-set specific?

That is, if I have the following build.gradle:

dependencies {
    compile 'com.google.guava:guava:20.0'
    compile 'junit:junit:4.12'
}

and two source sets, src/main/java & src/test/java, can we have some set of javaconfig.jsons specify different classpaths for these source sets? That is, it would have the guava jar on the main set's classpath and the guava and junit jars on the test set's classpath.

cannot find symbol - unresolved dependencies.

Build output

/Users/roey/Development/graphiti/hadoop/src/main/java/HelloWorld.java:6: error: cannot find symbol
        JSONParser parser = new JSONParser();
        ^
  symbol:   class JSONParser
  location: class HelloWorld
/Users/roey/Development/graphiti/hadoop/src/main/java/HelloWorld.java:6: error: cannot find symbol
        JSONParser parser = new JSONParser();
                                ^
  symbol:   class JSONParser
  location: class HelloWorld
2 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.019 secs

Code

src/main/java/HelloWorld.java

package com.arachnys.graphiti;

import com.google.gson.JsonArray;

public class HelloWorld {
   public static void main(String[] args) {

        JSONParser parser = new JSONParser();
        System.out.println("Hello, World");

   }
}

build.gradle

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'application'

mainClassName = "com.arachnys.graphiti.HelloWorld"

repositories {
    mavenCentral()
}

dependencies {
    compile "com.google.code.gson:gson:1.7.2"
}

task vscodeClasspathFile {
    description 'Generates classpath file for the Visual Studio Code java plugin'
    ext.destFile = file("$buildDir/classpath.txt")
    outputs.file destFile
    doLast {
        def classpathString = configurations.compile.collect{ it.absolutePath }.join(File.pathSeparator)
        if (!destFile.parentFile.exists()) {
            destFile.parentFile.mkdirs()
        }
        assert destFile.parentFile.exists()
        destFile.text = classpathString
    }
}

task vscodeJavaconfigFile(dependsOn: vscodeClasspathFile) {
    description 'Generates javaconfig.json file for the Visual Studio Code java plugin'

    def relativePath = { File f ->
        f.absolutePath - "${project.rootDir.absolutePath}/"
    }
    ext.destFile = file("javaconfig.json")
    ext.config = [
        sourcePath: sourceSets.collect{ it.java.srcDirs }.flatten().collect{ relativePath(it) },
        classPathFile: relativePath(tasks.getByPath('vscodeClasspathFile').outputs.files.singleFile),
        outputDirectory: relativePath(new File(buildDir, 'vscode-classes'))
    ]
    doLast {
        def jsonContent = groovy.json.JsonOutput.toJson(ext.config)
        destFile.text = groovy.json.JsonOutput.prettyPrint(jsonContent)
    }
}

task vscode(dependsOn: vscodeJavaconfigFile) {
    description 'Generates config files for the Visual Studio Code java plugin'
    group 'vscode'
}

Generated after gradle vscode

javaconfig.json

{
    "sourcePath": [
        "src/main/java",
        "src/test/java"
    ],
    "classPathFile": "build/classpath.txt",
    "outputDirectory": "build/vscode-classes"
}

build/classpath.txt

File exists:

/Users/roey/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/1.7.2/112366d8158749e25532ebce162232c6e0fb20a5/gson-1.7.2.jar

Duplicate Class Errors

Hi,

I am getting duplicate class errors for some of my classes, (named UserGroup and User) although they are unique within the namespace and compiles cleanly.

Internal error

From @Ayman17 on April 10, 2017 4:46

  • VSCode Version: Code 1.11.1 (d9484d12b38879b7f4cdd1150efeb2fd2c1fbf39, 2017-04-06T13:55:56.395Z)
  • OS Version: Linux x64 4.4.0-72-generic
  • Extensions:
Extension Author Version
include-autocomplete ajshort 0.0.2
code-gnu-global austin 0.2.1
java-run caolin 1.1.4
vscode-astyle chiehyu 0.6.2
javadebugger donjayamanne 0.0.2
jupyter donjayamanne 1.0.0
python donjayamanne 0.6.0
replace-smart-characters DrMattSm 0.0.2
java-debug DSnake 0.0.2
vscode-great-icons emmanuelbeziat 1.1.47
eppz-code eppz 1.0.36
javac-linter faustinoaq 1.2.2
code-runner formulahendry 0.6.15
vscode-javac georgewfraser 0.0.31
CppSnippets hars 0.0.7
code-template-replace heekei 0.1.2
Python-autopep8 himanoa 1.0.2
beautify HookyQR 1.0.2
hopscotch idleberg 0.1.4
vscode-flake8 jaysonsantos 0.0.4
csharpextensions jchannon 1.3.0
theme-material-theme jprestidge 1.0.1
docomment k--kato 0.0.14
clangcomplete kube 0.0.6
live-code-runner lablup 1.2.0
csharpfixformat Leopotam 0.0.20
MagicPython magicstack 1.0.9
vscode-clang mitaki28 0.2.2
quicksnippet mousetraps 0.0.1
cpptools ms-vscode 0.10.5
Theme-MarkdownKit ms-vscode 0.1.4
java redhat 0.1.0
python tht13 0.2.3
java-imports-snippets tushortz 0.0.1
java-snippets tushortz 0.0.1
python-extended-snippets tushortz 0.0.1
cmake-tools vector-of-bool 0.9.4
clang-format xaver 1.2.1

Steps to Reproduce:

1.when open vcode this internal error expose
"[Info - 9:09:10 AM] Connection closed
[Error - 9:09:10 AM] Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:87)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:203)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:139)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:68)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:49)
... 11 more
Caused by: java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
at sun.nio.fs.UnixPath.(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at java.nio.file.Paths.get(Paths.java:84)
at org.javacs.JavaLanguageServer.initialize(JavaLanguageServer.java:59)
... 16 more

[Error - 9:09:10 AM] Server initialization failed.
Message: Internal error, please look at the server's logs.
Code: -32603
"

Copied from original issue: microsoft/vscode#24393

Upgrade to ls-api 0.2.0-SNAPSHOT

We had to change the signatures of the service methods to return a CompletableFuture because at first we misunderstood how synchronization should be handled in the protocol. See TypeFox/ls-api#5 for more details.

We bumped the version so you don't get broken immediately, but you should upgrade if you can. We will publish the SNAPSHOT tomorrow morning (Europe).

Unable to build the maven project as there are compile error

Class LanguageDescriptionImpl is missing, did you have to compile a dependency manually to get it to work?

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.072 s
[INFO] Finished at: 2016-09-15T00:04:06+02:00
[INFO] Final Memory: 18M/284M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project javac
-services: Compilation failure: Compilation failure:
[ERROR] /home/forzaken/dev/projects/vscode-javac/src/main/java/org/javacs/JavaLanguageServer.java:[83,9] cannot find symbol
[ERROR] symbol: class LanguageDescriptionImpl
[ERROR] location: class org.javacs.JavaLanguageServer
[ERROR] /home/forzaken/dev/projects/vscode-javac/src/main/java/org/javacs/JavaLanguageServer.java:[83,44] cannot find symbol
[ERROR] symbol: class LanguageDescriptionImpl
[ERROR] location: class org.javacs.JavaLanguageServer
[ERROR] -> [Help 1]

can't resolve classes from react-native android project

I am usng hte react native cli to scaffold out a project.
see more at:
https://www.npmjs.com/package/react-native-cli
setup the project using these commands:

> npm install -g react-native-cli
> react-native init AwesomeApp

Then I attempt modify the android section of the file AwesomeApp/android/app/main/build.gradle with the suggested tasks.

apply plugin: "com.android.application"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
      task vscodeClasspathFile {
        description 'Generates classpath file for the Visual Studio Code java plugin'
        ext.destFile = file("$buildDir/classpath.txt")
        outputs.file destFile
        doLast {
            def classpathString = configurations.compile.collect{ it.absolutePath }.join(File.pathSeparator)
            if (!destFile.parentFile.exists()) {
                destFile.parentFile.mkdirs()
            }
            assert destFile.parentFile.exists()
            destFile.text = classpathString
        }
    }

    task vscodeJavaconfigFile(dependsOn: vscodeClasspathFile) {
        description 'Generates javaconfig.json file for the Visual Studio Code java plugin'

        def relativePath = { File f ->
            f.absolutePath - "${project.rootDir.absolutePath}/"
        }
        ext.destFile = file("javaconfig.json")
        ext.config = [
            sourcePath: sourceSets.collect{ it.java.srcDirs }.flatten().collect{ relativePath(it) },
            classPathFile: relativePath(tasks.getByPath('vscodeClasspathFile').outputs.files.singleFile),
            outputDirectory: relativePath(new File(buildDir, 'vscode-classes'))
        ]
        doLast {
            def jsonContent = groovy.json.JsonOutput.toJson(ext.config)
            destFile.text = groovy.json.JsonOutput.prettyPrint(jsonContent)
        }
    }

    task vscode(dependsOn: vscodeJavaconfigFile) {
        description 'Generates config files for the Visual Studio Code java plugin'
        group 'vscode'
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.rn1"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

However I still get the error import com.facebook...... cannot be resolved.

How can I fix this?

Allow for arbitrary jars in settings.json

I've come across this extension in my long quest to replace Android Studio with a more lightweight solution.

None of the various Java plugins on Atom/Vim/VSCode worked well for my project, with every autodetection feature collapsing on itself.
Except for this extension, which magically picks up almost everything correctly.

This brings me to an issue with the settings.json only configuration: there is no way to define JARs as external dependencies: For my project to work correctly, I need to reference android.jar. I have no problem hardcoding the Android Jar version in a workspace settings.json, as it doesn't change often.

Unfortunately, the android sdk does not come as a maven/gradle artifact, so I can't use that syntax.
Ideally, I'd like to add "java.externalDependencies": ["${ANDROID_HOME}/platforms/android-26/android.jar"] to my settings.json, and commit that in the workspace for everybody to use.
(Env var support would be nice, but I could live without it)

Is there something I'm missing?

Thanks for the great work on this extension. It works much better for my use case than redhat's.

Exception happens with Java 8 on Windows

java.lang.RuntimeException: java.net.MalformedURLException: unknown protocol: c
	at org.javacs.ChildFirstClassLoader.parse(ChildFirstClassLoader.java:34)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
	at org.javacs.ChildFirstClassLoader.parseClassPath(ChildFirstClassLoader.java:26)
	at org.javacs.ChildFirstClassLoader.fromClassPath(ChildFirstClassLoader.java:40)
	at org.javacs.LangTools.createLangToolsClassLoader(LangTools.java:25)
	at org.javacs.Main.main(Main.java:72)
Caused by: java.net.MalformedURLException: unknown protocol: c
	at java.net.URL.<init>(URL.java:600)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at org.javacs.ChildFirstClassLoader.parse(ChildFirstClassLoader.java:32)
	... 11 more

it happens at this point while urlString is classpath:

try {
            if (urlString.startsWith("/")) return Paths.get(urlString).toUri().toURL();
            else return new URL(urlString);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }

I check the LangTools class and it says for Java 9 . Can Java 9 build successfully?

Make javaconfig.json optional and try to read other config files

Eclipse generates a .project for a java project. The presence of this file could also indicate the root of a Java project. Along with it, Eclipse generates a .classpath, which is an XML file like this:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

It contains both the sourcePath setting (<classpathentry kind="src"/>), the outputDirectory (<classpathentry kind="output"/>) and the actual class paths (<classpathentry kind="con">). Eclipse does not have a feature to automatically export these into a text file this extension understands, support for this file would make it super easy to contribute to projects that use Eclipse.

Similarly, maybe we can take the presence of a pom.xml as the indication of a java project root aswell and get classpaths for Maven projects directly from the extension without someone having to add this configuration to their pom.xml?

Would do a PR :)

Can't generate classpath.txt using suggested gradle script

I get this error:

λ ./gradlew vscode

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\gjudd\Develop\Mobility\WebAPI\WebAPI\cg-java-client\build.gradle' line: 46

* What went wrong:
A problem occurred evaluating root project 'cg-java-client'.
> Could not get unknown property 'sourceSets' for task ':vscodeJavaconfigFile' of type org.gradle.api.DefaultTask.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.073 secs

This is the script I pasted in (from the docs):

task vscodeClasspathFile {
    description 'Generates classpath file for the Visual Studio Code java plugin'
    ext.destFile = file("$buildDir/classpath.txt")
    outputs.file destFile
    doLast {
        def classpathString = configurations.compile.collect{ it.absolutePath }.join(File.pathSeparator)
        if (!destFile.parentFile.exists()) {
            destFile.parentFile.mkdirs()
        }
        assert destFile.parentFile.exists()
        destFile.text = classpathString
    }
}

task vscodeJavaconfigFile(dependsOn: vscodeClasspathFile) {
    description 'Generates javaconfig.json file for the Visual Studio Code java plugin'

    def relativePath = { File f ->
        f.absolutePath - "${project.rootDir.absolutePath}/"
    }
    ext.destFile = file("javaconfig.json")
    ext.config = [
        sourcePath: sourceSets.collect{ it.java.srcDirs }.flatten().collect{ relativePath(it) },
        classPathFile: relativePath(tasks.getByPath('vscodeClasspathFile').outputs.files.singleFile),
        outputDirectory: relativePath(new File(buildDir, 'vscode-classes'))
    ]
    doLast {
        def jsonContent = groovy.json.JsonOutput.toJson(ext.config)
        destFile.text = groovy.json.JsonOutput.prettyPrint(jsonContent)
    }
}

task vscode(dependsOn: vscodeJavaconfigFile) {
    description 'Generates config files for the Visual Studio Code java plugin'
    group 'vscode'
}

I don't know much about gradle or java for that matter. I've got a multi project gradle setup - that could be causing the problem. Any help would be much appreciated.

javadoc charset error

qq 20170830234458
qq 20170830234508
I have 2 java file using utf8 and chinese comments, and I found the chinese comment show error text

macOS High Sierra: Maven repository packages not found

Dependencies from Maven are not found on my macOS. Visual Code (1.18.1) complains "package does not exist". The mvn command line executes without complaints. See sample screenshot below. (The same configuration works well on Debian Linux.)
Trying to point java.configuration.maven.userSettings to Maven settings.xml didn't change anything.

screen shot 2017-11-23 at 21 11 41

Use "@" for find symbol instead of "#"

When I type Cmd+Shift+O, the find symbol interaction launches. This shows the "@" symbol at the beginning and then shows a message saying "Unfortunately we have no symbol information for the file". But, when typing "#", the message "type to search for symbols" is shown.

Support Java 9

Java Language Support extension version 0.0.41
Visual Studio Code version 1.12.1
OS: ubuntu 12.04 LTS i386 [32-bit]

With JDK 9 early access release installed on my linux box, the extension fails to load with the "Java language support requires Java 8 (using /my/path/to/java-9/bin/java)" error.

Any plans to make this extension work with JDK 9?

Thanks in advance.

"duplicate class:" error on windows VSCode

On large projects, some classes are highlighted all red with this error.

I am not really sure what is going on, but I am pretty sure I don't have duplicate classes in my project.

Standalone Version

Would it be possible to separate out just the langserver so that it can be used with other clients?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.