OpenLiberty / liberty-tools-eclipse

Eclipse Public License 2.0
11 stars 8 forks source link

The end-tag is inserted on an incorrect location #259

Open gkwan-ibm opened 1 year ago

gkwan-ibm commented 1 year ago

Tried to fix the webApplication tag by the suggested action

Screen Shot 2022-11-16 at 5 12 07 PM

the proposed close action, paste the closing </webApplication> end-tag incorrectly at line 57

Screen Shot 2022-11-16 at 5 19 51 PM

scottkurz commented 1 year ago

@gkwan-ibm I'm having trouble recreating this.

Could you please explain the exact sequence in more detail ?

E.g.

I'm not even sure these are the exact best questions but I guess I'm just trying to think of what the relevant detail could be.

gkwan-ibm commented 1 year ago

The server.xml contains the following:

    <webApplication contextRoot="${default.context.root}"
                    location="inventory.war">
        <application-bnd>
            <security-role name="admin">
                <group name="admin" />
            </security-role>
            <security-role name="user">
                <group name="user" />
            </security-role>
        </application-bnd>
    </webApplication>
gkwan-ibm commented 1 year ago

Tried to open the server.xml with Text Editor and XML Editior, both editors do not propose any action.

gkwan-ibm commented 1 year ago

Just tried the completion code assist, I can see the end tag suggestion

Screen Shot 2022-11-28 at 5 08 40 PM
scottkurz commented 1 year ago

Just confirmed this issue still exists in v0.9.2 on top of 23-0.

It looks to me like we should open a Lemminx issue for this one. In Lemminx v0.23.0 I see this relevant stack trace in the debugger

ETagRequiredCodeAction(CloseTagCodeAction).doCodeActionsForStartTagClosed(DOMElement, DOMDocument, Range, Diagnostic, List<CodeAction>) line: 209   
ETagRequiredCodeAction(CloseTagCodeAction).doCodeAction(ICodeActionRequest, List<CodeAction>, CancelChecker) line: 58   
ContentModelCodeActionParticipant.doCodeAction(ICodeActionRequest, List<CodeAction>, CancelChecker) line: 51    
XMLCodeActions.doCodeActions(CodeActionContext, Range, DOMDocument, SharedSettings, CancelChecker) line: 60 
XMLLanguageService.doCodeActions(CodeActionContext, Range, DOMDocument, SharedSettings, CancelChecker) line: 260    
XMLTextDocumentService.lambda$codeAction$23(String, CodeActionParams, DOMDocument, CancelChecker) line: 476 
scottkurz commented 1 year ago

Opened https://github.com/eclipse/lemminx/issues/1544 . Since this would require a lemminx enhancement, I labeled this as 'enhancement'.