Skip to content

[Bug] Cursor position ignored during code actions that insert or edit workspace #5106

@asmodeus812

Description

@asmodeus812

Result from CocInfo

No errors

Describe the bug

When executing a command with coc and coc-java, using the configuration to put the inserted text after or before the cursor, the contents are always inserted either at the top of the class or the bottom, but never after or before the cursor position.

Reproduce the bug

  1. Install coc-java
  2. Configure "java.codeGeneration.insertionLocation": "afterCurosr"
  3. Create class with a few member methods
  4. Put cursor in between members or somehwere in the middle of the class
  5. Call vim.fn.CocActionAsync("codeAction", "", { "", "quickfix", "refactor", "source" })
  6. Generate getters and setters
  7. Getters and setters are put at the very bottom after the last methods/members

Related:
eclipse-jdtls/eclipse.jdt.ls#1713
redhat-developer/vscode-java#1859

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions