Skip to content

No quick actions available when targetting class name in ctor invocation #2531

Open

Description

@Nightenom

Given a short (static/nonstatic, probably visibility independent) method with just return statement and ctor call there are no quick actions available. Log is empty - no stacktraces nor errors. High reproducibility (will try to provide 100% repro case if this is not enough)
image

Current Result

Only lower method has quick actions.

Expected Result

Both methods have quick actions.

Environment
  • Operating System: Windows_NT x64 10.0.19044
  • JDK version: OpenJDK Temurin-17.0.2+8 (build 17.0.2+8)
  • Visual Studio Code version: 1.68.1
  • Java extension version: 1.7.0

Activity

  1. changed the title [-]No quick actions available for certain method types[/-] [+]No quick actions available when targetting class name in ctor invocation[/+] on Jun 25, 2022
  2. Nightenom commented on Jun 25, 2022

    @Nightenom
    Author

    Also another thing which seems heavily related, might be even the same bug.

    Working states:
    Targeting method:
    image
    Targeting whole statement using text selection:
    image
    Targeting the "new" keyword:
    image

    Broken state:
    Targeting the the class name:
    image

  3. jdneo commented on Jun 27, 2022

    @jdneo
    Collaborator

    @CsCherrYY You can test it with File f = new File(new String());, and try to peek code actions when the cursor is in new or in String

  4. Nightenom commented on May 26, 2024

    @Nightenom
    Author

    This is still an issue after 2 yrs

  5. rgrunber commented on Aug 22, 2024

    @rgrunber
    Member

    I think the issue is with the ExtractTempRefactoring API in JDT. It relies on the selection being an expression and it seems to fail to retrieve it under certain circumstances : https://github.com/eclipse-jdt/eclipse.jdt.ui/blob/b83ffe1bbcad393d4e35874d1ecc6af59f90874f/org.eclipse.jdt.core.manipulation/refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractTempRefactoring.java#L1058-L1063 .

    FATALERROR: An expression must be selected to activate this refactoring.
    Context: <Unspecified context>
    code: none
    Data: null
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions