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

RenameProvider #2788

Merged
merged 14 commits into from
Jul 17, 2022
Merged

RenameProvider #2788

merged 14 commits into from
Jul 17, 2022

Conversation

asosnoviy
Copy link
Member

@asosnoviy asosnoviy commented May 26, 2022

Описание

Добавлен renameProvider

Связанные задачи

Closes #1171 closes #1172

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Copy link
Member

@nixel2007 nixel2007 left a comment

Choose a reason for hiding this comment

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

Круто! Мелкие фиксы, джавадок, тесты и две галки в docs/index.md и можно в прод :)


return new WorkspaceEdit(
Stream.concat(
referenceResolver.findReference(documentContext.getUri(), position)
Copy link
Member

Choose a reason for hiding this comment

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

Тогда наверное тут можно взять её же, а не заново искать, разве нет?

.collect(Collectors.groupingBy(
ref -> ref.getUri().toString(),
Collectors.mapping(Reference::getSelectionRange,
Collectors.mapping(range -> new TextEdit(range, params.getNewName()), Collectors.toList())))));
Copy link
Member

Choose a reason for hiding this comment

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

Немного переносов строк бы расставить тут и вокруг. Тяжело читается.

@nixel2007
Copy link
Member

Оно ж ещё и переменные таким же образом может переименовать, да?

@asosnoviy
Copy link
Member Author

Оно ж ещё и переменные таким же образом может переименовать, да?

И параметры методов


var result = textDocumentService.rename(params);

assertThat(result).isNotNull();
Copy link
Member Author

Choose a reason for hiding this comment

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

Это прям подстава, по факту там null =)

}

private static Reference referenceOf(SourceDefinedSymbol symbol) {
return Reference.of(symbol, symbol, new Location(symbol.getOwner().getUri().toString(), symbol.getSelectionRange()));
Copy link
Member

Choose a reason for hiding this comment

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

здесь надо добавить OccurrenceType.DEFINITION последним параметром. мало ли где стрельнет.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

var sourceDefinedSymbol = referenceResolver.findReference(documentContext.getUri(), position)
.flatMap(Reference::getSourceDefinedSymbol);

Map<String, List<TextEdit>> changes = Stream.concat(
Copy link
Member

Choose a reason for hiding this comment

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

не будет ли здесь задублированного референса, если тыкать переименование по месту определения символа?

Copy link
Member Author

Choose a reason for hiding this comment

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

@sonarcloud
Copy link

sonarcloud bot commented Jun 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

89.6% 89.6% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants