Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deprecated]Improve the standalone java file support #843

Conversation

testforstephen
Copy link
Contributor

Signed-off-by: Jinbo Wang [email protected]

Below are the thoughts on improving the support for standalone Java file.

  • The opening standalone file is an external Java file. (Not belonging to any workspace root).
    I'd like to keep the current behavior. Link the external file to the default project, and use the default project to manage it. And jdt.ls will take it as single file. That means if the file only used the standard jdk library, Run/Debug works well. But if it used other dependency or class file, jdt build will fail and Run/Debug doesn't work. This behavior is same as the javac build policy.
    When use javac to compile a single file, if it only used JDK library, build succeeded.
    image
    If it used other dependency, javac will try to resolve them from current working directory (cwd), if not found, build failed.
    image
    If all dependencies could be resolved in the cwd, build succeeded.
    image

  • The opening standalone file is inside one of workspace root.
    If the workspace root contains any visible eclipse/maven/gradle project, take the standalone Java file as a normal text file.
    If the workspace root doesn't have any visible project in its sub folders, then create an invisible project in the workspace storage, and link the workspace root to a special folder _ under the invisible project, and mark the containing folder of the opened standalone java file as Source Root of the invisible project.
    The invisible project brings two benefits. One is to hide the eclipse project metadata files (.project/.classpath/bin/.settings). The other is to separate the workspace standalone files with the external standalone java files. The build server will report the build errors from the workspace invisible project.

@eclipse-ls-bot
Copy link

Can one of the admins verify this patch?


public static String getWorkspaceInvisibleProjectName(IPath workspacePath) {
String fileName = workspacePath.toFile().getName();
String projectName = fileName + "_" + Integer.toHexString(workspacePath.toPortableString().hashCode());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"_" => WORKSPACE_LINK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here _ is just a simple separator. But the WORKSPACE_LINK symbol represents a special folder. Don't like to replace it here.

IPath workspaceRoot = JDTStandaloneFileUtils.getWorkspaceRoot(containerPath);
if (workspaceRoot == null) {
List<String> segments = Arrays.asList(containerPath.segments());
if (segments.contains(SRC)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be first process src/main/java and src/test/java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@fbricon fbricon requested a review from snjeza November 12, 2018 07:12
@snjeza
Copy link
Contributor

snjeza commented Nov 12, 2018

test this please

Copy link
Contributor

@snjeza snjeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have faced the following compile error:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.eclipse.jdt.ls.tests: Compilation failure: Compilation failure: 
[ERROR] /home/snjeza/projects/eclipse.jdt.ls/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/JDTUtilsTest.java:[172] 
[ERROR] 	assertEquals(ProjectUtils.getWorkspaceInvisibleProjectName(workspaceRoot), project.getName());
[ERROR] 	                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The method getWorkspaceInvisibleProjectName(IPath) is undefined for the type ProjectUtils
[ERROR] 1 problem (1 error)

@snjeza
Copy link
Contributor

snjeza commented Nov 12, 2018

@fbricon Jenkins builds don't work.

@testforstephen
Copy link
Contributor Author

@snjeza i fixed the build error, could you try again?

@snjeza
Copy link
Contributor

snjeza commented Nov 13, 2018

The following tests fail:

Results :

Tests in error:
  HoverHandlerTest.testEmptyHover:166 » NullPointer
  HoverHandlerTest.testHoverStandalone:127 » NullPointer

Tests run: 805, Failures: 0, Errors: 2, Skipped: 14

@testforstephen
Copy link
Contributor Author

Thanks for the catch. Fixed it.

@snjeza
Copy link
Contributor

snjeza commented Nov 13, 2018

The opening standalone file is inside one of workspace root.
If the workspace root doesn't have any visible project in its sub folders, then create an invisible project in the workspace storage, and link the workspace root to a special folder _ under the invisible project, and mark the containing folder of the opened standalone java file as Source Root of the invisible project.

I have tried this case and an invisible project hasn't been created.
Could you, please, explain me how to test this case?

@testforstephen
Copy link
Contributor Author

@snjeza You can use vscode to open an empty folder, and new a java file there, then the invisible project will be created. This invisible project should be in the same parent directory as the default project jdt.ls-java-project.

invisibleproject
Currently Java Dependencies View hides this project, we plan to let Java Dependencies View to display it.

public static boolean isVisibleProject(IProject project) {
PreferenceManager manager = JavaLanguageServerPlugin.getPreferencesManager();
Collection<IPath> rootPaths = manager.getPreferences().getRootPaths();
return ResourceUtils.isContainedIn(project.getLocation(), rootPaths) || ProjectUtils.isGradleProject(project);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ProjectUtils.isGradleProject(project)? why not Maven?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. It's exactly unnecessary to add gradle check here. Thanks.

Copy link
Contributor

@fbricon fbricon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do Gradle projects get a special treatment?

@fbricon
Copy link
Contributor

fbricon commented Nov 15, 2018

So, opening the new lesson1/ directory from the test projects, I get an error on HelloWorld.java:

The declared package "org.samples" does not match the expected package "src.org.samples"

Verbose vscode/server logs [Trace - 5:07:18 PM] Sending request 'initialize - (0)'. Params: { "processId": 84620, "rootPath": "/Users/fbricon/Dev/souk/new-standalone/lesson1", "rootUri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1", "capabilities": { "workspace": { "applyEdit": true, "workspaceEdit": { "documentChanges": true, "resourceOperations": [ "create", "rename", "delete" ], "failureHandling": "textOnlyTransactional" }, "didChangeConfiguration": { "dynamicRegistration": true }, "didChangeWatchedFiles": { "dynamicRegistration": true }, "symbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] } }, "executeCommand": { "dynamicRegistration": true }, "configuration": true, "workspaceFolders": true }, "textDocument": { "publishDiagnostics": { "relatedInformation": true }, "synchronization": { "dynamicRegistration": true, "willSave": true, "willSaveWaitUntil": true, "didSave": true }, "completion": { "dynamicRegistration": true, "contextSupport": true, "completionItem": { "snippetSupport": true, "commitCharactersSupport": true, "documentationFormat": [ "markdown", "plaintext" ], "deprecatedSupport": true, "preselectSupport": true }, "completionItemKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 ] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ] } }, "definition": { "dynamicRegistration": true }, "references": { "dynamicRegistration": true }, "documentHighlight": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] }, "hierarchicalDocumentSymbolSupport": true }, "codeAction": { "dynamicRegistration": true, "codeActionLiteralSupport": { "codeActionKind": { "valueSet": [ "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" ] } } }, "codeLens": { "dynamicRegistration": true }, "formatting": { "dynamicRegistration": true }, "rangeFormatting": { "dynamicRegistration": true }, "onTypeFormatting": { "dynamicRegistration": true }, "rename": { "dynamicRegistration": true, "prepareSupport": true }, "documentLink": { "dynamicRegistration": true }, "typeDefinition": { "dynamicRegistration": true }, "implementation": { "dynamicRegistration": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true } } }, "initializationOptions": { "bundles": [ "/Users/fbricon/.vscode-insiders/extensions/vscjava.vscode-java-debug-0.15.0/server/com.microsoft.java.debug.plugin-0.15.0.jar", "/Users/fbricon/.vscode-insiders/extensions/vscjava.vscode-java-dependency-0.1.0/server/com.microsoft.jdtls.ext.core-0.1.0.jar", "/Users/fbricon/.vscode-insiders/extensions/vscjava.vscode-java-test-0.10.0/server/com.microsoft.java.test.plugin-0.10.0.jar" ], "workspaceFolders": [ "file:///Users/fbricon/Dev/souk/new-standalone/lesson1" ], "settings": { "java": { "home": "/Users/fbricon/.sdkman/candidates/java/8u141-oracle/", "jdt": { "ls": { "vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:\"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar\" -Xbootclasspath/a:\"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar\"" } }, "errors": { "incompleteClasspath": { "severity": "warning" } }, "configuration": { "updateBuildConfiguration": "interactive", "maven": { "userSettings": null } }, "trace": { "server": "verbose" }, "import": { "gradle": { "enabled": false }, "maven": { "enabled": true }, "exclusions": [ "**/node_modules/**", "**/.metadata/**", "**/archetype-resources/**", "**/META-INF/maven/**" ] }, "referencesCodeLens": { "enabled": false }, "signatureHelp": { "enabled": false }, "implementationsCodeLens": { "enabled": false }, "format": { "enabled": true, "settings": { "url": null, "profile": null }, "comments": { "enabled": true }, "onType": { "enabled": true } }, "saveActions": { "organizeImports": false }, "contentProvider": { "preferred": "fernflower" }, "autobuild": { "enabled": true }, "completion": { "enabled": true, "overwrite": true, "guessMethodArguments": false, "favoriteStaticMembers": [ "org.junit.Assert.*", "org.junit.Assume.*", "org.junit.jupiter.api.Assertions.*", "org.junit.jupiter.api.Assumptions.*", "org.junit.jupiter.api.DynamicContainer.*", "org.junit.jupiter.api.DynamicTest.*", "org.mockito.Mockito.*", "org.mockito.ArgumentMatchers.*", "org.mockito.Answers.*" ], "importOrder": [ "java", "javax", "com", "org" ] }, "progressReports": { "enabled": true }, "debug": { "logLevel": "warn", "settings": { "showHex": false, "showStaticVariables": true, "showQualifiedNames": false, "maxStringLength": 0, "enableHotCodeReplace": true, "enableRunDebugCodeLens": true } }, "dependency": { "showOutline": true, "syncWithFolderExplorer": true }, "test": { "report": { "position": "sideView" } } } }, "extendedClientCapabilities": { "progressReportProvider": true, "classFileContentsSupport": true } }, "trace": "verbose", "workspaceFolders": [ { "uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1", "name": "lesson1" } ] }

objc[84657]: Class JavaLaunchHelper is implemented in both /Users/fbricon/.sdkman/candidates/java/8u141-oracle/bin/java (0x104ed74c0) and /Users/fbricon/.sdkman/candidates/java/8u141-oracle/jre/lib/libinstrument.dylib (0x104fce4e0). One of the two will be used. Which one is undefined.
[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM Main thread is waiting"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM Main thread is waiting
[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM >> initialize"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM >> initialize
[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM Initializing Java Language Server 0.28.0.201811152204"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM Initializing Java Language Server 0.28.0.201811152204
[Trace - 5:07:23 PM] Received response 'initialize - (0)' in 4752ms.
Result: {
"capabilities": {
"textDocumentSync": {
"openClose": true,
"change": 2,
"willSave": true,
"willSaveWaitUntil": true,
"save": {
"includeText": true
}
},
"workspace": {
"workspaceFolders": {
"supported": true,
"changeNotifications": true
}
}
}
}

[Trace - 5:07:23 PM] Sending notification 'initialized'.
Params: {}

[Trace - 5:07:23 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {
"java": {
"home": "/Users/fbricon/.sdkman/candidates/java/8u141-oracle/",
"jdt": {
"ls": {
"vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar" -Xbootclasspath/a:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar""
}
},
"errors": {
"incompleteClasspath": {
"severity": "warning"
}
},
"configuration": {
"updateBuildConfiguration": "interactive",
"maven": {
"userSettings": null
}
},
"trace": {
"server": "verbose"
},
"import": {
"gradle": {
"enabled": false
},
"maven": {
"enabled": true
},
"exclusions": [
"/node_modules/",
"/.metadata/",
"/archetype-resources/",
"/META-INF/maven/"
]
},
"referencesCodeLens": {
"enabled": false
},
"signatureHelp": {
"enabled": false
},
"implementationsCodeLens": {
"enabled": false
},
"format": {
"enabled": true,
"settings": {
"url": null,
"profile": null
},
"comments": {
"enabled": true
},
"onType": {
"enabled": true
}
},
"saveActions": {
"organizeImports": false
},
"contentProvider": {
"preferred": "fernflower"
},
"autobuild": {
"enabled": true
},
"completion": {
"enabled": true,
"overwrite": true,
"guessMethodArguments": false,
"favoriteStaticMembers": [
"org.junit.Assert.",
"org.junit.Assume.
",
"org.junit.jupiter.api.Assertions.",
"org.junit.jupiter.api.Assumptions.
",
"org.junit.jupiter.api.DynamicContainer.",
"org.junit.jupiter.api.DynamicTest.
",
"org.mockito.Mockito.",
"org.mockito.ArgumentMatchers.
",
"org.mockito.Answers.*"
],
"importOrder": [
"java",
"javax",
"com",
"org"
]
},
"progressReports": {
"enabled": true
},
"debug": {
"logLevel": "warn",
"settings": {
"showHex": false,
"showStaticVariables": true,
"showQualifiedNames": false,
"maxStringLength": 0,
"enableHotCodeReplace": true,
"enableRunDebugCodeLens": true
}
},
"dependency": {
"showOutline": true,
"syncWithFolderExplorer": true
},
"test": {
"report": {
"position": "sideView"
}
}
}
}
}

[Trace - 5:07:23 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java",
"languageId": "java",
"version": 1,
"text": ""
}
}

[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM >> initialized"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM >> initialized
[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM System property http.nonProxyHosts has been set to local|.local|169.254/16|.169.254/16 by an external source. This value will be overwritten using the values from the preferences"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM System property http.nonProxyHosts has been set to local|.local|169.254/16|.169.254/16 by an external source. This value will be overwritten using the values from the preferences
[Trace - 5:07:23 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:23 PM Creating the Java project jdt.ls-java-project"
}

[Info - 5:07:23 PM] 15-Nov-2018 5:07:23 PM Creating the Java project jdt.ls-java-project
[Trace - 5:07:23 PM] Received notification 'language/progressReport'.
Params: {
"id": "0d5e5e42-d002-48ca-80d1-9d4253b0d7ce",
"task": "Refreshing Maven model",
"status": "Refreshing Maven model",
"totalWork": -1,
"workDone": 0,
"complete": false
}

[Trace - 5:07:24 PM] Received notification 'language/progressReport'.
Params: {
"id": "71246b33-ea62-496b-837f-a4781db5feb4",
"task": "Repository registry initialization",
"status": "Repository registry initialization",
"totalWork": 0,
"workDone": 0,
"complete": true
}

[Trace - 5:07:25 PM] Received notification 'language/progressReport'.
Params: {
"id": "84e8e9ec-891d-4e38-85f2-b79e17718221",
"task": "Updating indexes",
"status": "Updating indexes",
"totalWork": -1,
"workDone": 0,
"complete": false
}

[Trace - 5:07:25 PM] Received notification 'language/progressReport'.
Params: {
"id": "84e8e9ec-891d-4e38-85f2-b79e17718221",
"task": "Updating indexes",
"status": "Updating indexes",
"totalWork": -1,
"workDone": 0,
"complete": true
}

[Trace - 5:07:25 PM] Received notification 'language/progressReport'.
Params: {
"id": "84e8e9ec-891d-4e38-85f2-b79e17718221",
"task": "Updating indexes",
"status": "Updating indexes",
"totalWork": -1,
"workDone": 0,
"complete": true
}

[Trace - 5:07:30 PM] Received notification 'language/progressReport'.
Params: {
"id": "37cd3a46-68eb-483f-bb37-c2e6cdc9fdb9",
"task": "Synchronizing projects",
"status": "Synchronizing projects - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:07:30 PM] Received notification 'language/progressReport'.
Params: {
"id": "37cd3a46-68eb-483f-bb37-c2e6cdc9fdb9",
"task": "Synchronizing projects",
"status": "Synchronizing projects - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": true
}

[Trace - 5:07:30 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM Finished creating the Java project jdt.ls-java-project"
}

[Info - 5:07:30 PM] 15-Nov-2018 5:07:30 PM Finished creating the Java project jdt.ls-java-project
[Trace - 5:07:30 PM] Received notification 'language/status'.
Params: {
"type": "Starting",
"message": "37% Starting Java Language Server "
}

[Trace - 5:07:30 PM] Received notification 'language/status'.
Params: {
"type": "Starting",
"message": "100% Starting Java Language Server "
}

[Trace - 5:07:30 PM] Received notification 'language/status'.
Params: {
"type": "Starting",
"message": "100% Starting Java Language Server "
}

[Trace - 5:07:30 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM Workspace initialized in 7379ms"
}

[Info - 5:07:30 PM] 15-Nov-2018 5:07:30 PM Workspace initialized in 7379ms
[Trace - 5:07:30 PM] Received notification 'language/status'.
Params: {
"type": "Started",
"message": "Ready"
}

[Trace - 5:07:32 PM] Received notification 'language/status'.
Params: {
"type": "Starting",
"message": "100% Starting Java Language Server "
}

[Trace - 5:07:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "0d5e5e42-d002-48ca-80d1-9d4253b0d7ce",
"task": "Refreshing Maven model",
"status": "Refreshing Maven model",
"totalWork": -1,
"workDone": 0,
"complete": true
}

[Trace - 5:07:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "0d5e5e42-d002-48ca-80d1-9d4253b0d7ce",
"task": "Refreshing Maven model",
"status": "Refreshing Maven model",
"totalWork": -1,
"workDone": 0,
"complete": true
}

[Trace - 5:07:32 PM] Received request 'client/registerCapability - (1)'.
Params: {
"registrations": [
{
"id": "8d61eb0c-d47e-4128-aa8b-9c1e6a5fb65d",
"method": "textDocument/completion",
"registerOptions": {
"resolveProvider": true,
"triggerCharacters": [
".",
"@",
"#",
"*"
]
}
}
]
}

[Trace - 5:07:32 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
No result returned.

[Trace - 5:07:32 PM] Received request 'client/registerCapability - (2)'.
Params: {
"registrations": [
{
"id": "f3bacfae-29c1-4d3e-a702-1bf301f37fdd",
"method": "workspace/symbol"
}
]
}

[Trace - 5:07:32 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
No result returned.

[Trace - 5:07:32 PM] Received request 'client/registerCapability - (3)'.
Params: {
"registrations": [
{
"id": "197c330b-766f-45a3-a9e2-cdf041a24595",
"method": "textDocument/documentSymbol"
}
]
}

[Trace - 5:07:32 PM] Sending response 'client/registerCapability - (3)'. Processing request took 1ms
No result returned.

[Trace - 5:07:32 PM] Received request 'client/registerCapability - (4)'.
Params: {
"registrations": [
{
"id": "4fcb5af7-3792-4522-8c98-abcec49eadaa",
"method": "textDocument/codeAction",
"registerOptions": {
"codeActionKinds": [
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
]
}

[Trace - 5:07:32 PM] Sending response 'client/registerCapability - (4)'. Processing request took 0ms
No result returned.

[Trace - 5:07:35 PM] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
}
}

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (5)'.
Params: {
"registrations": [
{
"id": "eb5a9821-75e2-4f73-a07f-5a3821256cc1",
"method": "textDocument/definition"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (5)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (6)'.
Params: {
"registrations": [
{
"id": "7cf12acb-ce38-437e-a1f9-0fbbd138868c",
"method": "textDocument/typeDefinition"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (6)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (7)'.
Params: {
"registrations": [
{
"id": "9cee8e9e-864e-4de9-a98c-c9a4a27e323b",
"method": "textDocument/hover"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (7)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (8)'.
Params: {
"registrations": [
{
"id": "002089e9-26eb-453a-9046-cb11a0d40e0e",
"method": "textDocument/references"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (8)'. Processing request took 0ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (9)'.
Params: {
"registrations": [
{
"id": "283f7295-3065-48f2-a714-8b6d649c151c",
"method": "textDocument/documentHighlight"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (9)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (10)'.
Params: {
"registrations": [
{
"id": "1c66678e-21d0-4da6-84ea-827d139c3ef1",
"method": "workspace/didChangeWorkspaceFolders"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (10)'. Processing request took 0ms
No result returned.

[Trace - 5:07:35 PM] Sending request 'workspace/executeCommand - (2)'.
Params: {
"command": "vscode.java.test.search.all",
"arguments": []
}

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (11)'.
Params: {
"registrations": [
{
"id": "c0c5ee39-3178-4577-bd7f-50fa229350f2",
"method": "textDocument/implementation"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (11)'. Processing request took 22ms
No result returned.

[Trace - 5:07:35 PM] Sending request 'workspace/executeCommand - (3)'.
Params: {
"command": "java.project.list",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1"
]
}

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (12)'.
Params: {
"registrations": [
{
"id": "6e4171d3-5d22-4508-8126-63514f0855db",
"method": "textDocument/formatting"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (12)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (13)'.
Params: {
"registrations": [
{
"id": "78818fe2-7fda-4340-b5e1-96e380b4dc39",
"method": "textDocument/rangeFormatting"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (13)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (14)'.
Params: {
"registrations": [
{
"id": "dab26a71-056b-493d-a6e0-fef41e3c49c5",
"method": "textDocument/onTypeFormatting",
"registerOptions": {
"firstTriggerCharacter": ";",
"moreTriggerCharacter": [
"\n",
"}"
]
}
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (14)'. Processing request took 1ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (15)'.
Params: {
"registrations": [
{
"id": "70657efe-ab5d-42a8-82a2-bf038af9a21b",
"method": "textDocument/rename"
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (15)'. Processing request took 0ms
No result returned.

[Trace - 5:07:35 PM] Received request 'client/registerCapability - (16)'.
Params: {
"registrations": [
{
"id": "cd64d6b6-a06c-4661-9052-bab6bc5ec1d6",
"method": "workspace/executeCommand",
"registerOptions": {
"commands": [
"vscode.java.test.search.all",
"java.edit.organizeImports",
"vscode.java.fetchUsageData",
"java.project.list",
"vscode.java.test.fetch",
"vscode.java.validateLaunchConfig",
"java.getPackageData",
"vscode.java.resolveMainMethod",
"vscode.java.resolveClasspath",
"java.project.updateSourceAttachment",
"vscode.java.test.runtime.classpath",
"vscode.java.resolveMainClass",
"vscode.java.updateDebugSettings",
"vscode.java.test.project.info",
"vscode.java.buildWorkspace",
"java.project.resolveSourceAttachment",
"java.resolvePath",
"vscode.java.startDebugSession"
]
}
}
]
}

[Trace - 5:07:35 PM] Sending response 'client/registerCapability - (16)'. Processing request took 42ms
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM >> workspace/didChangeConfiguration"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM >> workspace/didChangeConfiguration
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM >> registerFeature 'workspace/didChangeWatchedFiles'"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM >> registerFeature 'workspace/didChangeWatchedFiles'
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM >>New configuration: {java={home=/Users/fbricon/.sdkman/candidates/java/8u141-oracle/, jdt={ls={vmargs=-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar" -Xbootclasspath/a:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar"}}, errors={incompleteClasspath={severity=warning}}, configuration={updateBuildConfiguration=interactive, maven={userSettings=null}}, trace={server=verbose}, import={gradle={enabled=false}, maven={enabled=true}, exclusions=[/node_modules/, /.metadata/, /archetype-resources/, /META-INF/maven/]}, referencesCodeLens={enabled=false}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}}, saveActions={organizeImports=false}, contentProvider={preferred=fernflower}, autobuild={enabled=true}, completion={enabled=true, overwrite=true, guessMethodArguments=false, favoriteStaticMembers=[org.junit.Assert., org.junit.Assume., org.junit.jupiter.api.Assertions., org.junit.jupiter.api.Assumptions., org.junit.jupiter.api.DynamicContainer., org.junit.jupiter.api.DynamicTest., org.mockito.Mockito., org.mockito.ArgumentMatchers., org.mockito.Answers.*], importOrder=[java, javax, com, org]}, progressReports={enabled=true}, debug={logLevel=warn, settings={showHex=false, showStaticVariables=true, showQualifiedNames=false, maxStringLength=0.0, enableHotCodeReplace=true, enableRunDebugCodeLens=true}}, dependency={showOutline=true, syncWithFolderExplorer=true}, test={report={position=sideView}}}}"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM >>New configuration: {java={home=/Users/fbricon/.sdkman/candidates/java/8u141-oracle/, jdt={ls={vmargs=-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar" -Xbootclasspath/a:"/Users/fbricon/.vscode-insiders/extensions/GabrielBB.vscode-lombok-0.9.6/server/lombok.jar"}}, errors={incompleteClasspath={severity=warning}}, configuration={updateBuildConfiguration=interactive, maven={userSettings=null}}, trace={server=verbose}, import={gradle={enabled=false}, maven={enabled=true}, exclusions=[/node_modules/, /.metadata/, /archetype-resources/, /META-INF/maven/]}, referencesCodeLens={enabled=false}, signatureHelp={enabled=false}, implementationsCodeLens={enabled=false}, format={enabled=true, settings={url=null, profile=null}, comments={enabled=true}, onType={enabled=true}}, saveActions={organizeImports=false}, contentProvider={preferred=fernflower}, autobuild={enabled=true}, completion={enabled=true, overwrite=true, guessMethodArguments=false, favoriteStaticMembers=[org.junit.Assert., org.junit.Assume., org.junit.jupiter.api.Assertions., org.junit.jupiter.api.Assumptions., org.junit.jupiter.api.DynamicContainer., org.junit.jupiter.api.DynamicTest., org.mockito.Mockito., org.mockito.ArgumentMatchers., org.mockito.Answers.*], importOrder=[java, javax, com, org]}, progressReports={enabled=true}, debug={logLevel=warn, settings={showHex=false, showStaticVariables=true, showQualifiedNames=false, maxStringLength=0.0, enableHotCodeReplace=true, enableRunDebugCodeLens=true}}, dependency={showOutline=true, syncWithFolderExplorer=true}, test={report={position=sideView}}}}
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM >> document/didOpen"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM >> document/didOpen
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM Creating the Java project lesson1_78ab5ec9"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM Creating the Java project lesson1_78ab5ec9
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:30 PM Finished creating the Java project lesson1_78ab5ec9"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:30 PM Finished creating the Java project lesson1_78ab5ec9
[Trace - 5:07:35 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/fbricon/Library/Application%20Support/Code%20-%20Insiders/User/workspaceStorage/c7f5bdc2eb2f5df982c624f504dc1777/redhat.java/jdt_ws/lesson1_78ab5ec9",
"diagnostics": []
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"subTask": "Compiling lesson1_78ab5ec9/_",
"status": "Building workspace - 64%",
"totalWork": 1000,
"workDone": 640,
"complete": false
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"subTask": "(Found 1 error) Compiling lesson1_78ab5ec9/_/src/test/java/testsamples",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"subTask": "(Found 1 error) Build done",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"subTask": "",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/fbricon/Library/Application%20Support/Code%20-%20Insiders/User/workspaceStorage/c7f5bdc2eb2f5df982c624f504dc1777/redhat.java/jdt_ws/lesson1_78ab5ec9",
"diagnostics": []
}

[Trace - 5:07:35 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
]
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "8074f1ac-b219-403b-97b8-068c4671ce78",
"task": "Building workspace",
"subTask": "",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "93783c1d-8118-432e-bdd0-c6fb99471819",
"task": "Validate documents",
"status": "Validate documents - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "93783c1d-8118-432e-bdd0-c6fb99471819",
"task": "Validate documents",
"status": "Validate documents - 75%",
"totalWork": 1000,
"workDone": 750,
"complete": false
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "93783c1d-8118-432e-bdd0-c6fb99471819",
"task": "Validate documents",
"status": "Validate documents - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:33 PM begin problem for /Test.java"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:33 PM begin problem for /Test.java
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:33 PM 0 problems reported for /Test.java"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:33 PM 0 problems reported for /Test.java
[Trace - 5:07:35 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java",
"diagnostics": []
}

[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:33 PM Reconciled 0, validated: 1. Took 655 ms"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:33 PM Reconciled 0, validated: 1. Took 655 ms
[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "93783c1d-8118-432e-bdd0-c6fb99471819",
"task": "Validate documents",
"status": "Validate documents - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "e91cf4cd-7308-4246-a45b-540bdc8270d1",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "e91cf4cd-7308-4246-a45b-540bdc8270d1",
"task": "Building workspace",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'language/progressReport'.
Params: {
"id": "e91cf4cd-7308-4246-a45b-540bdc8270d1",
"task": "Building workspace",
"status": "Building workspace - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:35 PM >> document/documentSymbol"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:35 PM >> document/documentSymbol
[Trace - 5:07:35 PM] Received response 'textDocument/documentSymbol - (1)' in 226ms.
Result: []

[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:35 PM >> workspace/executeCommand vscode.java.test.search.all"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:35 PM >> workspace/executeCommand vscode.java.test.search.all
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:35 PM >> workspace/executeCommand java.project.list"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:35 PM >> workspace/executeCommand java.project.list
[Trace - 5:07:35 PM] Received response 'workspace/executeCommand - (3)' in 88ms.
Result: []

[Trace - 5:07:35 PM] Sending request 'workspace/executeCommand - (4)'.
Params: {
"command": "vscode.java.resolveMainMethod",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
]
}

[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:35 PM >> workspace/executeCommand vscode.java.resolveMainMethod"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:35 PM >> workspace/executeCommand vscode.java.resolveMainMethod
[Trace - 5:07:35 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:35 PM Starting com.microsoft.java.debug.plugin"
}

[Info - 5:07:35 PM] 15-Nov-2018 5:07:35 PM Starting com.microsoft.java.debug.plugin
[Trace - 5:07:35 PM] Received response 'workspace/executeCommand - (4)' in 55ms.
Result: []

[Trace - 5:07:40 PM] Received response 'workspace/executeCommand - (2)' in 4796ms.
Result: []

[Trace - 5:07:40 PM] Sending request 'workspace/executeCommand - (5)'.
Params: {
"command": "vscode.java.test.project.info",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1"
]
}

[Trace - 5:07:40 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.test.project.info"
}

[Info - 5:07:40 PM] 15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.test.project.info
[Trace - 5:07:40 PM] Received response 'workspace/executeCommand - (5)' in 7ms.
Result: []

[Trace - 5:07:40 PM] Sending request 'workspace/executeCommand - (6)'.
Params: {
"command": "vscode.java.test.fetch",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
]
}

[Trace - 5:07:40 PM] Sending request 'workspace/executeCommand - (7)'.
Params: {
"command": "vscode.java.resolveMainMethod",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
]
}

[Trace - 5:07:40 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.test.fetch"
}

[Info - 5:07:40 PM] 15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.test.fetch
[Trace - 5:07:40 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.resolveMainMethod"
}

[Info - 5:07:40 PM] 15-Nov-2018 5:07:40 PM >> workspace/executeCommand vscode.java.resolveMainMethod
[Trace - 5:07:40 PM] Received response 'workspace/executeCommand - (7)' in 5ms.
Result: []

[Trace - 5:07:40 PM] Received response 'workspace/executeCommand - (6)' in 13ms.
Result: []

[Trace - 5:09:29 PM] Sending request 'workspace/executeCommand - (8)'.
Params: {
"command": "java.resolvePath",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
]
}

[Trace - 5:09:29 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:29 PM >> workspace/executeCommand java.resolvePath"
}

[Info - 5:09:29 PM] 15-Nov-2018 5:09:29 PM >> workspace/executeCommand java.resolvePath
[Trace - 5:09:29 PM] Received response 'workspace/executeCommand - (8)' in 22ms.
Result: [
{
"name": "lesson1_78ab5ec9",
"path": "/lesson1_78ab5ec9",
"uri": "file:/Users/fbricon/Library/Application%20Support/Code%20-%20Insiders/User/workspaceStorage/c7f5bdc2eb2f5df982c624f504dc1777/redhat.java/jdt_ws/lesson1_78ab5ec9",
"kind": 2
},
{
"entryKind": 1,
"name": "",
"path": "/lesson1_78ab5ec9/
",
"kind": 4
},
{
"name": "(default package)",
"path": "/lesson1_78ab5ec9/",
"kind": 5
},
{
"entryKind": 1,
"name": "Test.java",
"path": "/lesson1_78ab5ec9/
/Test.java",
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java",
"kind": 6
}
]

[Trace - 5:09:29 PM] Sending request 'workspace/executeCommand - (9)'.
Params: {
"command": "java.project.list",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1"
]
}

[Trace - 5:09:29 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:29 PM >> workspace/executeCommand java.project.list"
}

[Info - 5:09:29 PM] 15-Nov-2018 5:09:29 PM >> workspace/executeCommand java.project.list
[Trace - 5:09:29 PM] Received response 'workspace/executeCommand - (9)' in 12ms.
Result: []

[Trace - 5:09:31 PM] Sending notification 'textDocument/didClose'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/Test.java"
}
}

[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> document/didClose"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> document/didClose
[Trace - 5:09:31 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java",
"languageId": "java",
"version": 1,
"text": "package org.samples;\n\npublic class HelloWorld {\n\tpublic static void main(String[] args)\n {\n System.out.println("Hello World!");\n }\n}"
}
}

[Trace - 5:09:31 PM] Sending request 'textDocument/codeAction - (10)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 7,
"character": 1
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"message": "The declared package "org.samples" does not match the expected package "src.org.samples"",
"severity": 1,
"code": "536871240",
"source": "Java"
}
]
}
}

[Trace - 5:09:31 PM] Sending request 'textDocument/codeAction - (11)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"context": {
"diagnostics": []
}
}

[Trace - 5:09:31 PM] Sending request 'workspace/executeCommand - (12)'.
Params: {
"command": "java.resolvePath",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
]
}

[Trace - 5:09:31 PM] Sending request 'textDocument/documentSymbol - (13)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
}
}

[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> document/didOpen"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> document/didOpen
[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> document/codeAction"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> document/codeAction
[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> document/codeAction"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> document/codeAction
[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> workspace/executeCommand java.resolvePath"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> workspace/executeCommand java.resolvePath
[Trace - 5:09:31 PM] Received response 'workspace/executeCommand - (12)' in 72ms.
Result: [
{
"name": "lesson1_78ab5ec9",
"path": "/lesson1_78ab5ec9",
"uri": "file:/Users/fbricon/Library/Application%20Support/Code%20-%20Insiders/User/workspaceStorage/c7f5bdc2eb2f5df982c624f504dc1777/redhat.java/jdt_ws/lesson1_78ab5ec9",
"kind": 2
},
{
"entryKind": 1,
"name": "",
"path": "/lesson1_78ab5ec9/
",
"kind": 4
},
{
"name": "src.org.samples",
"path": "/lesson1_78ab5ec9//src/org/samples",
"kind": 5
},
{
"entryKind": 1,
"name": "HelloWorld.java",
"path": "/lesson1_78ab5ec9/
/src/org/samples/HelloWorld.java",
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java",
"kind": 6
}
]

[Trace - 5:09:31 PM] Sending request 'workspace/executeCommand - (14)'.
Params: {
"command": "java.project.list",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1"
]
}

[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> document/documentSymbol"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> document/documentSymbol
[Trace - 5:09:31 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:31 PM >> workspace/executeCommand java.project.list"
}

[Info - 5:09:31 PM] 15-Nov-2018 5:09:31 PM >> workspace/executeCommand java.project.list
[Trace - 5:09:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "4630d363-9234-427e-a3c1-968e4b268db3",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:09:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "4630d363-9234-427e-a3c1-968e4b268db3",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": true
}

[Trace - 5:09:32 PM] Sending request 'workspace/executeCommand - (15)'.
Params: {
"command": "vscode.java.test.fetch",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
]
}

[Trace - 5:09:32 PM] Sending request 'workspace/executeCommand - (16)'.
Params: {
"command": "vscode.java.resolveMainMethod",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
]
}

[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM >> workspace/executeCommand vscode.java.test.fetch"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM >> workspace/executeCommand vscode.java.test.fetch
[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM >> workspace/executeCommand vscode.java.resolveMainMethod"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM >> workspace/executeCommand vscode.java.resolveMainMethod
[Trace - 5:09:32 PM] Sending request 'textDocument/codeAction - (17)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"message": "The declared package "org.samples" does not match the expected package "src.org.samples"",
"severity": 1,
"code": "536871240",
"source": "Java"
}
]
}
}

[Trace - 5:09:32 PM] Sending notification '$/cancelRequest'.
Params: {
"id": 11
}

[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM >> document/codeAction"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM >> document/codeAction
[Trace - 5:09:32 PM] Received response 'textDocument/codeAction - (11)' in 241ms. Request failed: The request (id: 11, method: 'textDocument/codeAction') has been cancelled (-32800).
[Trace - 5:09:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "038fe80a-e794-4c3a-9e59-2a85ae75562b",
"task": "Validate documents",
"status": "Validate documents - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:09:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "038fe80a-e794-4c3a-9e59-2a85ae75562b",
"task": "Validate documents",
"status": "Validate documents - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM begin problem for /HelloWorld.java"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM begin problem for /HelloWorld.java
[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM 1 problems reported for /HelloWorld.java"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM 1 problems reported for /HelloWorld.java
[Trace - 5:09:32 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
]
}

[Trace - 5:09:32 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:09:32 PM Reconciled 0, validated: 1. Took 138 ms"
}

[Info - 5:09:32 PM] 15-Nov-2018 5:09:32 PM Reconciled 0, validated: 1. Took 138 ms
[Trace - 5:09:32 PM] Received notification 'language/progressReport'.
Params: {
"id": "038fe80a-e794-4c3a-9e59-2a85ae75562b",
"task": "Validate documents",
"status": "Validate documents - 100%",
"totalWork": 1000,
"workDone": 1000,
"complete": true
}

[Trace - 5:09:32 PM] Received response 'workspace/executeCommand - (14)' in 547ms.
Result: []

[Trace - 5:09:32 PM] Received response 'workspace/executeCommand - (15)' in 425ms.
Result: []

[Trace - 5:09:32 PM] Received response 'textDocument/documentSymbol - (13)' in 625ms.
Result: [
{
"name": "org.samples",
"kind": 4,
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 20
}
},
"selectionRange": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 20
}
},
"detail": "",
"deprecated": false
},
{
"name": "HelloWorld",
"kind": 5,
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 7,
"character": 1
}
},
"selectionRange": {
"start": {
"line": 2,
"character": 13
},
"end": {
"line": 2,
"character": 23
}
},
"detail": "",
"deprecated": false,
"children": [
{
"name": "main(String[])",
"kind": 6,
"range": {
"start": {
"line": 3,
"character": 1
},
"end": {
"line": 6,
"character": 5
}
},
"selectionRange": {
"start": {
"line": 3,
"character": 20
},
"end": {
"line": 3,
"character": 24
}
},
"detail": " : void",
"deprecated": false,
"children": []
}
]
}
]

[Trace - 5:09:32 PM] Received response 'workspace/executeCommand - (16)' in 430ms.
Result: [
{
"range": {
"start": {
"line": 3,
"character": 20
},
"end": {
"line": 3,
"character": 24
}
},
"mainClass": "src.org.samples.HelloWorld",
"projectName": "lesson1_78ab5ec9"
}
]

[Trace - 5:09:32 PM] Received response 'textDocument/codeAction - (17)' in 465ms.
Result: [
{
"title": "Change package declaration to 'src.org.samples'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
],
"command": {
"title": "Change package declaration to 'src.org.samples'",
"command": "java.apply.workspaceEdit",
"arguments": [
{
"changes": {
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"newText": "src.org.samples"
}
]
}
}
]
}
}
]

[Trace - 5:09:32 PM] Received response 'textDocument/codeAction - (10)' in 706ms.
Result: [
{
"title": "Change package declaration to 'src.org.samples'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
],
"command": {
"title": "Change package declaration to 'src.org.samples'",
"command": "java.apply.workspaceEdit",
"arguments": [
{
"changes": {
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"newText": "src.org.samples"
}
]
}
}
]
}
}
]

[Trace - 5:09:33 PM] Received notification 'language/progressReport'.
Params: {
"id": "6c2e196e-c928-4012-9efc-b57c7c53ec5f",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": false
}

[Trace - 5:09:33 PM] Received notification 'language/progressReport'.
Params: {
"id": "6c2e196e-c928-4012-9efc-b57c7c53ec5f",
"task": "Building workspace",
"status": "Building workspace - 0%",
"totalWork": 1000,
"workDone": 0,
"complete": true
}

[Trace - 5:11:09 PM] Sending request 'workspace/executeCommand - (18)'.
Params: {
"command": "java.resolvePath",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
]
}

[Trace - 5:11:09 PM] Sending request 'textDocument/codeAction - (19)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 7,
"character": 1
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"message": "The declared package "org.samples" does not match the expected package "src.org.samples"",
"severity": 1,
"code": "536871240",
"source": "Java"
}
]
}
}

[Trace - 5:11:09 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:11:09 PM >> workspace/executeCommand java.resolvePath"
}

[Info - 5:11:09 PM] 15-Nov-2018 5:11:09 PM >> workspace/executeCommand java.resolvePath
[Trace - 5:11:09 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:11:09 PM >> document/codeAction"
}

[Info - 5:11:09 PM] 15-Nov-2018 5:11:09 PM >> document/codeAction
[Trace - 5:11:09 PM] Received response 'workspace/executeCommand - (18)' in 30ms.
Result: [
{
"name": "lesson1_78ab5ec9",
"path": "/lesson1_78ab5ec9",
"uri": "file:/Users/fbricon/Library/Application%20Support/Code%20-%20Insiders/User/workspaceStorage/c7f5bdc2eb2f5df982c624f504dc1777/redhat.java/jdt_ws/lesson1_78ab5ec9",
"kind": 2
},
{
"entryKind": 1,
"name": "",
"path": "/lesson1_78ab5ec9/
",
"kind": 4
},
{
"name": "src.org.samples",
"path": "/lesson1_78ab5ec9//src/org/samples",
"kind": 5
},
{
"entryKind": 1,
"name": "HelloWorld.java",
"path": "/lesson1_78ab5ec9/
/src/org/samples/HelloWorld.java",
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java",
"kind": 6
}
]

[Trace - 5:11:09 PM] Sending request 'workspace/executeCommand - (20)'.
Params: {
"command": "java.project.list",
"arguments": [
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1"
]
}

[Trace - 5:11:09 PM] Received response 'textDocument/codeAction - (19)' in 32ms.
Result: [
{
"title": "Change package declaration to 'src.org.samples'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
],
"command": {
"title": "Change package declaration to 'src.org.samples'",
"command": "java.apply.workspaceEdit",
"arguments": [
{
"changes": {
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"newText": "src.org.samples"
}
]
}
}
]
}
}
]

[Trace - 5:11:09 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:11:09 PM >> workspace/executeCommand java.project.list"
}

[Info - 5:11:09 PM] 15-Nov-2018 5:11:09 PM >> workspace/executeCommand java.project.list
[Trace - 5:11:09 PM] Received response 'workspace/executeCommand - (20)' in 16ms.
Result: []

[Trace - 5:11:11 PM] Sending request 'textDocument/codeAction - (21)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 7,
"character": 1
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"message": "The declared package "org.samples" does not match the expected package "src.org.samples"",
"severity": 1,
"code": "536871240",
"source": "Java"
}
]
}
}

[Trace - 5:11:11 PM] Sending request 'textDocument/codeAction - (22)'.
Params: {
"textDocument": {
"uri": "file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java"
},
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"message": "The declared package "org.samples" does not match the expected package "src.org.samples"",
"severity": 1,
"code": "536871240",
"source": "Java"
}
]
}
}

[Trace - 5:11:11 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:11:11 PM >> document/codeAction"
}

[Info - 5:11:11 PM] 15-Nov-2018 5:11:11 PM >> document/codeAction
[Trace - 5:11:11 PM] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "15-Nov-2018 5:11:11 PM >> document/codeAction"
}

[Info - 5:11:11 PM] 15-Nov-2018 5:11:11 PM >> document/codeAction
[Trace - 5:11:11 PM] Received response 'textDocument/codeAction - (21)' in 5ms.
Result: [
{
"title": "Change package declaration to 'src.org.samples'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
],
"command": {
"title": "Change package declaration to 'src.org.samples'",
"command": "java.apply.workspaceEdit",
"arguments": [
{
"changes": {
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"newText": "src.org.samples"
}
]
}
}
]
}
}
]

[Trace - 5:11:11 PM] Received response 'textDocument/codeAction - (22)' in 6ms.
Result: [
{
"title": "Change package declaration to 'src.org.samples'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"severity": 1,
"code": "536871240",
"source": "Java",
"message": "The declared package "org.samples" does not match the expected package "src.org.samples""
}
],
"command": {
"title": "Change package declaration to 'src.org.samples'",
"command": "java.apply.workspaceEdit",
"arguments": [
{
"changes": {
"file:///Users/fbricon/Dev/souk/new-standalone/lesson1/src/org/samples/HelloWorld.java": [
{
"range": {
"start": {
"line": 0,
"character": 8
},
"end": {
"line": 0,
"character": 19
}
},
"newText": "src.org.samples"
}
]
}
}
]
}
}
]

Using the class completion in one of the empty java files yields:

package src.main.java.demosamples;

/**
 * Empty1
 */
public class Empty1 {

    
}

@testforstephen
Copy link
Contributor Author

@fbricon This is a pretty good question. i analysed your log, i should get your problem.

Below is the lesson1 directory structure.
image

The first java file you opened is lesson1/Test.java, it will trigger the language server to create an invisible project, and mark the containing folder lesson1 as Source Root. So when you go on opening other java files in the lesson1, the language server will calculate the package structure starting from the lesson1 root folder. That's why you got src.main.java package prefix when using class completion in empty file.

My current policy on handling standalone files is relatively conservative. It will only mark the containing folder of the first opening file as source root. If the workspace contains multiple source roots, opening other source roots standalone files may receive "xyz.java isn't in the classpath. Only syntax errors will be reported." warning. The provided fix is the user needs mark other roots as java source root manually. (I'm working on another feature Add Folder to Java Source Path and Remove Folder from Java Source Path.)

Back to the current scenario you got, i got another idea. When creating the invisible project for standalone java files, i think the language server could be more intelligent. It should not only mark the containing folder of the opened file as Source Root, but also automatically mark the conventional source directories such as src/main/java, src/test/java, src as source root too (if they exists in the workspace root folder). Or scan all java files under the workspace, find all potential source roots and mark them as source root automatically. (I feel the latter one is too aggressive, and involve performance issue).

@fbricon How do you think?

@yaohaizh
Copy link
Contributor

test this please

for (IProject project : getWorkspaceRoot().getProjects()) {
if (project.exists() && (ResourceUtils.isContainedIn(project.getLocation(), rootPaths) || ProjectUtils.isGradleProject(project))) {
if (project.exists() && (ResourceUtils.isContainedIn(project.getLocation(), rootPaths) || ProjectUtils.isGradleProject(project)) || workspaceProjects.contains(project.getName())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradle check here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gradle check is added by another PR 320401b#diff-54b8440d3466866733ad3374655cf2bf, not sure the underlying reason.

@fbricon
Copy link
Contributor

fbricon commented Nov 27, 2018

So opening the sub-folder of a project results in a *load of errors:

screen shot 2018-11-26 at 7 00 38 pm

This is precisely why we came up with the "Incomplete Classpath"+only syntax errors idea. So that use case is now broken with the new approach.

@testforstephen
Copy link
Contributor Author

Actually this is the same behavior as eclipse.
When you use File -> Open Projects from File System... to open a subfolder https://github.com/spring-guides/gs-spring-boot/tree/master/complete/src of a spring-boot project in eclipse, eclipse will report a bunch of errors, too.
image

@testforstephen
Copy link
Contributor Author

Have more investigation on the Eclipse behavior. It supports importing a folder without project descriptor. It will automatically convert the opening folder to an eclipse project silently, and smartly detect all possible source folders (The containing folder which contains *.java file).

As comparison, our current approach will create an invisible project for the root folder, it doesn't pollute the user's code space(.project, .classpath). But currently we only mark the open file's containing folder as source folder. This is one difference. Of course, if you feel it's necessary to auto detect all potential source folders, we can do that at the second stage (in new PR). One of my concern for the auto-detection is performance issue for big directories opened in VS Code. Like what i mentioned previously, another option is to simplify the detection and limit it to the top level folders with the name convention src, src/main/java, src/test/java. I'm open on the discussion.

On the other hand, i understand your approach of "Incomplete Classpath". I admit the bunch of errors may be annoying for some part of only-read users. But for most of junior users, they have no experience on maven or gradle, they just like to write some simple Java code and can make it work by run/debug feature. We need some kind of compromise on this problem.

@testforstephen
Copy link
Contributor Author

@fbricon ping... any more comments?

@fbricon
Copy link
Contributor

fbricon commented Nov 29, 2018

I think I'd go with a different approach:

  • keep the existing standalone mechanism untouched
  • add a new IProjectImporter implementation, let's call it InvisibleProjectImporter, that runs after the EclipseProjectImporter.
  • If it finds a java file somewhere under the root folder hierarchy. Then:
    • open the file to infer the package.
    • if package matches ancestor folders AND package is fully contained in root folder, then infer a source directory (parent of package dir) and create an invisible project out of it

that way, truly standalone files opened outside of the root uri are still behaving the same way, when a sub folder of a package is opened (my previous example), the package directory structure is not completely under the root uri, so no invisible project is created, we keep the same behaviour as before.

I think it should cover most of the use cases while also requiring minimal changes to the current code

@testforstephen
Copy link
Contributor Author

Yeah, i accept the concept of InvisibleProjectImporter.

One more question about the triggering condition of creating the invisible project.

If it finds a java file somewhere under the root folder hierarchy.

Do you mean searching **/*.java files in the root folder or the direct child *.java file under the root folder?

IMHO, we follow a certain sequence to deal with the *.java file.

  • Firstly, the java file in the active editor, if the language server is activated by opening a Java file. (Not sure whether the initialization command of language server is able to carry the activating source file path?)
  • Secondly, only the first level *.java under the root folder.

@fbricon
Copy link
Contributor

fbricon commented Nov 30, 2018

So, in the case of vscode, the server will be started once vscode opens a java file. But only the root uris will be sent to the server, so the server will need to (re)discover the java files.

It should search for java files with a rather large max depth (10? more?), to account for stuff like src/main/java/one/very/package/name/Foo.java. But at least, once a java file is found, it should just stop the file detection

@testforstephen
Copy link
Contributor Author

The background i asked this question is Java Language Server may be activated when the user is debugging a non-java project (For example, C++, python). See a known bug microsoft/vscode-java-debug#238.

If Java LS is pending on searching *.java for a long time (especially for some projects with deep directories, such as node_modules), this is probably a disaster for them.

@fbricon
Copy link
Contributor

fbricon commented Nov 30, 2018

then we might need to pass the opened java file as an initialization parameter, to avoid deep searches

@testforstephen
Copy link
Contributor Author

Exactly. when vscode client is activating LS, we can put the vscode.window.activeEditor file path in the initialization parameters.

@fbricon
Copy link
Contributor

fbricon commented Nov 30, 2018

The parameter mustn't be vscode specific. You can call it triggerFile or something better

@testforstephen testforstephen changed the title Improve the standalone java file support [Deprecated]Improve the standalone java file support Dec 4, 2018
@fbricon
Copy link
Contributor

fbricon commented Dec 4, 2018

superseded by #880

@fbricon fbricon closed this Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants