Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Extract method LSP code action #41

Closed
wants to merge 4 commits into from

Conversation

BladeMF
Copy link
Contributor

@BladeMF BladeMF commented May 8, 2021

No description provided.

SourceCode::fromStringAndPath($textDocument->text, $textDocument->uri),
$startOffset,
$endOffset,
self::DEFAULT_METHOD_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems we canot currently ask the user for input. Assuming this method will throw an exception if there is an existing method, you could add an increment to the default method name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually my guess was, since myMethod is so silly of a name, if you have one of these lying around, you have some more work to do until you extract another one. Go rename the other one, then extract this one :-) Kind of a code quality error. Otherwise doing a counter would be trivial, I think, if "method exists" is a catchable exception.

The perfect solution would be to either ask for input (I saw you found the same discussion), or enter rename mode immediately after completing. Probably it's best to wait for the former.

So, code quality wise, I'd leave it as it is, but I am happy to do a counter if think it'll be better.

@dantleech dantleech mentioned this pull request May 14, 2021
@dantleech dantleech closed this May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants