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

[regression] Maven diagnostics show up and disappear on save #829

Merged
merged 2 commits into from
Oct 23, 2018

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Oct 15, 2018

Fixes redhat-developer/vscode-java#669

Signed-off-by: Snjezana Peco [email protected]

@snjeza snjeza requested review from gorkem and fbricon October 15, 2018 23:19
@fbricon
Copy link
Contributor

fbricon commented Oct 16, 2018

I see the same regression reported in #756 (comment). No diagnostics on workspace restart

@snjeza
Copy link
Contributor Author

snjeza commented Oct 16, 2018

@fbricon I have updated the PR.

@@ -61,8 +60,17 @@ public BuildWorkspaceStatus buildWorkspace(boolean forceReBuild, IProgressMonito
connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList()));
}
}
ResourcesPlugin.getWorkspace().build(forceReBuild ? IncrementalProjectBuilder.CLEAN_BUILD : IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
Copy link
Contributor

Choose a reason for hiding this comment

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

if forceReBuild == false then you trigger 2 incremental builds

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.

markers.addAll(Arrays.asList(project.findMarkers(null, true, IResource.DEPTH_ONE)));
for (IMarker marker : markers) {
if (!marker.exists() || CheckMissingNaturesListener.MARKER_TYPE.equals(marker.getType())) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the purpose of this loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes #812

Copy link
Contributor

Choose a reason for hiding this comment

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

ok and? the loop is a no-op

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.

" public static void main(String[] args){\n"+
" int ss = 1;;\n"+
" }\n"+
"}";
//@formatter:on
IFile file = project.getFile("src/main/java/foo/Bar.java");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the purpose of this test was to check standalone java files would cause the build to fail in case of an error

@fbricon
Copy link
Contributor

fbricon commented Oct 16, 2018

@yaohaizh please check how this PR affects your use cases

@fbricon
Copy link
Contributor

fbricon commented Oct 20, 2018

redhat-developer/vscode-java#669 is still not fixed. Diagnostic still shows up on the dependency and then disappears.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 21, 2018

redhat-developer/vscode-java#669 is still not fixed.

@fbricon I can't reproduce the issue. See https://www.screencast.com/t/rOOigjEk
Could you attach a log?

@fbricon
Copy link
Contributor

fbricon commented Oct 21, 2018

So I removed all vscode extensions but vscode-java, and the behaviour is a tiny bit different now.
When I save the pom.xml, the error shows up and stays as expected:

[Trace - 11:50:47 AM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
            "type": 2
        }
    ]
}


[Trace - 11:50:47 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "21-Oct-2018 11:50:47 AM >> workspace/didChangeWatchedFiles "
}


[Info  - 11:50:47 AM] 21-Oct-2018 11:50:47 AM >> workspace/didChangeWatchedFiles 
[Trace - 11:50:47 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue",
    "diagnostics": []
}


[Trace - 11:50:47 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": []
}


[Trace - 11:50:47 AM] Received notification 'language/actionableNotification'.
Params: {
    "severity": 3,
    "message": "A build file was modified. Do you want to synchronize the Java classpath/configuration?",
    "commands": [
        {
            "title": "Never",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                0
            ]
        },
        {
            "title": "Now",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                1
            ]
        },
        {
            "title": "Always",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                2
            ]
        }
    ]
}


[Trace - 11:50:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "7f57f2f4-b795-4fc1-bf21-09bab669bdf7",
    "task": "Building workspace",
    "status": "Building workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": false
}


[Trace - 11:50:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "63b8f36c-79fa-45f0-87bb-243552d8188f",
    "task": "Refreshing workspace",
    "status": "Refreshing workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": false
}


[Trace - 11:50:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "63b8f36c-79fa-45f0-87bb-243552d8188f",
    "task": "Refreshing workspace",
    "status": "Refreshing workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": true
}


[Trace - 11:50:48 AM] Received notification 'language/progressReport'.
Params: {
    "id": "7f57f2f4-b795-4fc1-bf21-09bab669bdf7",
    "task": "Building workspace",
    "subTask": "project spring-boot-vue",
    "status": "Building workspace - 99%",
    "totalWork": 1000,
    "workDone": 987,
    "complete": false
}


[Trace - 11:50:48 AM] Received notification 'language/progressReport'.
Params: {
    "id": "7f57f2f4-b795-4fc1-bf21-09bab669bdf7",
    "task": "Building workspace",
    "subTask": "project spring-boot-vue",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:50:48 AM] Received notification 'language/progressReport'.
Params: {
    "id": "7f57f2f4-b795-4fc1-bf21-09bab669bdf7",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:50:48 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "964",
            "source": "Java",
            "message": "The container 'Maven Dependencies' references non existing library '/Users/fbricon/.m2/repository/org/springframework/boot/spring-boot-starter-data-mongodb/6.6.6/spring-boot-starter-data-mongodb-6.6.6.jar'"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:50:48 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:50:48 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 30,
                    "character": 9
                },
                "end": {
                    "line": 30,
                    "character": 20
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:50:48 AM] Received notification 'language/progressReport'.
Params: {
    "id": "7f57f2f4-b795-4fc1-bf21-09bab669bdf7",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}

But if I save a 2nd time, the marker on the dependency disappears, reappears briefly, then disappears for good:

[Trace - 11:52:45 AM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
            "type": 2
        },
        {
            "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
            "type": 2
        }
    ]
}


[Trace - 11:52:45 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "21-Oct-2018 11:52:45 AM >> workspace/didChangeWatchedFiles "
}


[Info  - 11:52:45 AM] 21-Oct-2018 11:52:45 AM >> workspace/didChangeWatchedFiles 
[Trace - 11:52:45 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "964",
            "source": "Java",
            "message": "The container 'Maven Dependencies' references non existing library '/Users/fbricon/.m2/repository/org/springframework/boot/spring-boot-starter-data-mongodb/6.6.6/spring-boot-starter-data-mongodb-6.6.6.jar'"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:45 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:45 AM] Received notification 'language/actionableNotification'.
Params: {
    "severity": 3,
    "message": "A build file was modified. Do you want to synchronize the Java classpath/configuration?",
    "commands": [
        {
            "title": "Never",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                0
            ]
        },
        {
            "title": "Now",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                1
            ]
        },
        {
            "title": "Always",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                2
            ]
        }
    ]
}


[Trace - 11:52:45 AM] Received notification 'language/actionableNotification'.
Params: {
    "severity": 3,
    "message": "A build file was modified. Do you want to synchronize the Java classpath/configuration?",
    "commands": [
        {
            "title": "Never",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                0
            ]
        },
        {
            "title": "Now",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                1
            ]
        },
        {
            "title": "Always",
            "command": "java.projectConfiguration.status",
            "arguments": [
                {
                    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml"
                },
                2
            ]
        }
    ]
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "e261b3fc-3b1f-4669-93d9-2d8d5021f303",
    "task": "Building workspace",
    "status": "Building workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": false
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "220d1b7c-638e-48fe-872d-38bdc1c1e9df",
    "task": "Refreshing workspace",
    "status": "Refreshing workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": false
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "220d1b7c-638e-48fe-872d-38bdc1c1e9df",
    "task": "Refreshing workspace",
    "status": "Refreshing workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": true
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "e261b3fc-3b1f-4669-93d9-2d8d5021f303",
    "task": "Building workspace",
    "subTask": "project spring-boot-vue",
    "status": "Building workspace - 99%",
    "totalWork": 1000,
    "workDone": 987,
    "complete": false
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "e261b3fc-3b1f-4669-93d9-2d8d5021f303",
    "task": "Building workspace",
    "subTask": "project spring-boot-vue",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "e261b3fc-3b1f-4669-93d9-2d8d5021f303",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "The project cannot be built until build path errors are resolved"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "964",
            "source": "Java",
            "message": "The container 'Maven Dependencies' references non existing library '/Users/fbricon/.m2/repository/org/springframework/boot/spring-boot-starter-data-mongodb/6.6.6/spring-boot-starter-data-mongodb-6.6.6.jar'"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 30,
                    "character": 9
                },
                "end": {
                    "line": 30,
                    "character": 20
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/src/main/java/com/redhat/vscode/demo/TodoApplication.java",
    "diagnostics": []
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/src/main/java/com/redhat/vscode/demo/model/Todo.java",
    "diagnostics": []
}


[Trace - 11:52:46 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/src/test/java/com/redhat/vscode/demo/TodoApplicationUnitTest.java",
    "diagnostics": []
}


[Trace - 11:52:46 AM] Received notification 'language/progressReport'.
Params: {
    "id": "e261b3fc-3b1f-4669-93d9-2d8d5021f303",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:52:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "d498aaa3-1d28-43b3-9962-7b0625986319",
    "task": "Building workspace",
    "status": "Building workspace - 0%",
    "totalWork": 1000,
    "workDone": 0,
    "complete": false
}


[Trace - 11:52:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "d498aaa3-1d28-43b3-9962-7b0625986319",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}


[Trace - 11:52:47 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "The project cannot be built until build path errors are resolved"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "964",
            "source": "Java",
            "message": "The container 'Maven Dependencies' references non existing library '/Users/fbricon/.m2/repository/org/springframework/boot/spring-boot-starter-data-mongodb/6.6.6/spring-boot-starter-data-mongodb-6.6.6.jar'"
        },
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:47 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/fbricon/Dev/souk/spring-boot-vue/pom.xml",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "0",
            "source": "Java",
            "message": "Missing artifact org.springframework.boot:spring-boot-starter-data-mongodb:jar:6.6.6"
        }
    ]
}


[Trace - 11:52:47 AM] Received notification 'language/progressReport'.
Params: {
    "id": "d498aaa3-1d28-43b3-9962-7b0625986319",
    "task": "Building workspace",
    "subTask": "",
    "status": "Building workspace - 100%",
    "totalWork": 1000,
    "workDone": 1000,
    "complete": true
}

Adding version <version>6.6.6</version> to https:/fbricon/spring-boot-vue/blob/master/pom.xml#L33

@snjeza
Copy link
Contributor Author

snjeza commented Oct 21, 2018

So I removed all vscode extensions but vscode-java, and the behaviour is a tiny bit different now.

I still can't reproduce the issue.
Have you removed the vscode-xml extension?

@fbricon
Copy link
Contributor

fbricon commented Oct 21, 2018

yes

@snjeza
Copy link
Contributor Author

snjeza commented Oct 21, 2018

Your log contains the correct diagnostics.

[Trace - 11:52:47 AM]  Received notification 'textDocument/publishDiagnostics'.
...

@fbricon
Copy link
Contributor

fbricon commented Oct 22, 2018

@snjeza no, the range is wrong.

Please take a look at da55c85

the test you wrote is not passing for some reason, but the server behaves as expected from a user perspective, when used in vscode-java at least. Can you please check what is wrong? Can't spend too much time on in myself today.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 22, 2018

test this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants