Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Source Action 'Override/Implement Methods' with prompt #749

Merged
merged 2 commits into from
Feb 25, 2019

Conversation

testforstephen
Copy link
Collaborator

Signed-off-by: Jinbo Wang [email protected]

It uses quick pick to list all possibles overridable methods from super types. And select the unimplemented methods by default.

override_implement


const selectedItems = await window.showQuickPick(quickPickItems, {
canPickMany: true,
placeHolder: 'Select methods to override or implement.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally it should be Select methods to override or implement in <Type>, as when you're in an anonymous class, within a top level class, it's pretty confusing to know which type will receive the implemented methods.

src/protocol.ts Outdated
}

export namespace OverridableMethodsRequest {
export const type = new RequestType<CodeActionParams, OverridableMethod[], void, void>('java/overridableMethods');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need a OverridableMethodsResponse object, that'd contain:

  • type: String
  • methods: OverridableMethod[]

that type can be displayed in the quickpick placeholder

@testforstephen testforstephen force-pushed the jinbo_overridemethods branch 2 times, most recently from b6e82fd to ef43fdf Compare February 11, 2019 07:43
@testforstephen
Copy link
Collaborator Author

@fbricon @yaohaizh updated.

@fbricon
Copy link
Collaborator

fbricon commented Feb 11, 2019

If you try to override/implement methods on an anonymous class, say Runnable:
screen shot 2019-02-11 at 2 46 58 pm

  • dialog mentions top level class (should be Anonymous Runnable)
  • no method from Runnable is selectable
  • all methods are added to top level class, instead of the Anonymous one

@testforstephen
Copy link
Collaborator Author

In VSCode 1.30.1 (2018 November), CodeActionParams passed the correct cursor line in the CodeActionParams#range, so the source action is able to resolve the right covered node. The case works.

After i updated to VSCode 1.31.0 (2019 January), i reproduced the scenario you mentioned. That's because the code action didn't pass the cursor line, CodeActionParams#range always return line 0. The source action cannot get the right covered node any more.

Not sure whether it's VSCode bug.

@testforstephen
Copy link
Collaborator Author

Create an issue microsoft/vscode#68487

@fbricon
Copy link
Collaborator

fbricon commented Feb 20, 2019

Since the upstream issue has been fixed, we'll push this feature in the next release.

@fbricon fbricon merged commit 7ac9a33 into redhat-developer:master Feb 25, 2019
@fbricon fbricon added this to the End February 2019 milestone Feb 25, 2019
@testforstephen testforstephen deleted the jinbo_overridemethods branch February 26, 2019 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants