jdneo / vscode-checkstyle

Checkstyle extension for VS Code
https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-checkstyle
GNU Lesser General Public License v3.0
68 stars 15 forks source link

chore: Prepare for 1.4.0 #300

Closed jdneo closed 3 years ago

karlvr commented 3 years ago

There is a bug I've just found in the MultipleVariableDeclarationsQuickFix where it removes comments.

e.g.

public void aMethod() {
    /* A comment */
    String a, b;
}
karlvr commented 3 years ago

It doesn't seem that comments in a method are correctly represented in the AST so I will change the code so that it doesn't delete the original node, and instead modifies it...

jdneo commented 3 years ago

@karlvr The fix in selection is tricky. Now I changed the the check condition to

const selection: Selection | undefined = window.activeTextEditor?.selection;
if (codeActions.length > 1 && document.uri === window.activeTextEditor?.document?.uri &&
         selection && !selection.isEmpty && range.contains(selection)) {
    ....
}

Still have one problem in the Problem panel. The code actions listed in the problem panel won't be updated until the document content is changed. So if it is generated with a range, users can see fix in selection option, but when the cursor position changes, the options will still be there since the content is not changed so it will not get refreshed.

IMO, so far I think it's not a big deal, so I'll leave this behavior as a known issue. Once we address the issue about removing the comments, I'll release 1.4.0

karlvr commented 3 years ago

@jdneo cool, I support that approach. I'll integrate it into my local build and take it for a spin! I haven't been able to make any progress on why the comment issue occurred. But the fix does appear to fix it.