-
Notifications
You must be signed in to change notification settings - Fork 109
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
RenameProvider #2788
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Круто! Мелкие фиксы, джавадок, тесты и две галки в docs/index.md и можно в прод :)
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Show resolved
Hide resolved
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Show resolved
Hide resolved
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Show resolved
Hide resolved
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java
Outdated
Show resolved
Hide resolved
|
||
return new WorkspaceEdit( | ||
Stream.concat( | ||
referenceResolver.findReference(documentContext.getUri(), position) |
There was a problem hiding this comment.
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()))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Немного переносов строк бы расставить тут и вокруг. Тяжело читается.
Оно ж ещё и переменные таким же образом может переименовать, да? |
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java
Show resolved
Hide resolved
И параметры методов |
|
||
var result = textDocumentService.rename(params); | ||
|
||
assertThat(result).isNotNull(); |
There was a problem hiding this comment.
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())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
здесь надо добавить OccurrenceType.DEFINITION последним параметром. мало ли где стрельнет.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не будет ли здесь задублированного референса, если тыкать переименование по месту определения символа?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos, SonarCloud Quality Gate passed! |
Описание
Добавлен renameProvider
Связанные задачи
Closes #1171 closes #1172
Чеклист
Общие
gradlew precommit
)Для диагностик
Дополнительно