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

Выделен программный интерфейс для подключения сторонних реализаций клиента отладки #142

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

yukon39
Copy link

@yukon39 yukon39 commented Nov 7, 2022

Изменения:

  • Выделен программный интерфейс для подключения сторонних реализаций клиента отладки
  • Добавлен метод конструктор для создания разных клиентов отладки
  • Произведен рефакторинг

Closes #141


public static List<DebugTargetType> getAutoconnectTargets() {

var autoconnectTargets = new DebugTargetType[]{
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, мб List.of(..) сразу?

Copy link
Author

Choose a reason for hiding this comment

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

Это перенесенный код. Да, ListOf будет лучше.

@@ -93,22 +93,9 @@ public void setAutoconnectTargets(List<DebugTargetType> autoconnectTargets) {

public List<DebugTargetType> getAutoconnectTargets() {
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, как часто используется getAutoconnectTargets из опций? Может константу сделать с таргетами?

import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, может не надо мультиимпорт?)

Copy link
Author

Choose a reason for hiding this comment

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

Как IDE поставило, так и живем. ОК, попробую указать конкретные импорты.

Copy link
Author

Choose a reason for hiding this comment

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

IDEA автоматически проставляет мультиимпорт.

Copy link
Member

Choose a reason for hiding this comment

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

IDEA можно это настроить и сохранить в codestyle файл в проекте. Кажется, в bsl ls так и сделано.

};

private Map<String, URI> uriListByKey;
Set<String> externalDataProcessorsUriSet = new HashSet<>();
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, этот филд используется вне класса?

if (!coverMap.isEmpty() || rawMode) {
if (!rawMode && !coverMap.containsKey(lineNo)) {
if (verbose) {
logger.info("Can't find line to cover {} in module {}", lineNo, uri);
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, если вынести этот блок в отдельный метод - будет немного читабельнее текущий метод )

Copy link
Author

Choose a reason for hiding this comment

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

Там много чего есть отрефакторить. Пока рефакторил то что подпадает под задачу реализовать подключение разных клиентов.

private static List<DebugTargetType> filterTargetsByApiVersion(List<DebugTargetType> debugTargets, ModuleDescriptor.Version ApiVersion) {
List<DebugTargetType> debugTypes = new java.util.ArrayList<>(debugTargets);

if (ModuleDescriptor.Version.parse("8.3.16").compareTo(ApiVersion) > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, что такого произошло в "8.3.16"? Мб в константу вынесем и коммент туда кинем?)


this.collector = collector;

configure(debugServerUrl, infobaseAlias);
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, а configure точно должен быть в конструкторе, а не отдельным методом и вызовом его для дебагклиента?

connectAllTargets(debugTargets);
}

private List<DebugTargetId> getCurrentTargets(List<String> debugAreaNames) throws DebugClientException {
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, порядок паблик и приватных методов нарушен(

connectAllTargets(debugTargets);
}

private List<DebugTargetId> getCurrentTargets(List<String> debugAreaNames) throws DebugClientException {
Copy link
Member

Choose a reason for hiding this comment

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

@yukon39, порядок паблик и приватных методов нарушен(

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

Successfully merging this pull request may close these issues.

Добавить возможность подключения разных клиентов отладки
2 participants