anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 13 forks source link

Codeaction "Add multiple fields" does not respect cursor for insertion #596

Closed zabcik closed 1 month ago

zabcik commented 1 month ago

1. Describe the bug

When using codeaction "Add multiple fields" the action does not respect cursor possition for insertion.

AZAL_CodeactionAddMultipleFields

2. To Reproduce

  1. Open the page or page extension where you want to add fields.
  2. Place the cursor at the desired position (before the first field, between fields, or after the last field) and observe where the code action performs the insertion.
  3. Verify the insertion behavior at different positions.

3. Expected behavior

New field is inserted to cursor position.

4. Actual behavior

New field is inserted to randomly position.

5. Versions:

anzwdev commented 1 month ago

Thank you for reporting this problem. It was workings this way, because all comments and empty lines are reported by the compiler as part of the syntax node below them. I've changed the logic and if cursor is before first syntax token, new field will be added before the node. Modified finctionality is available in the latest version of the extension.

zabcik commented 1 month ago

@anzwdev

Thank you very much. :)