-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
22 changed files
with
879 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
bundles/com.e1c.v8codestyle.bsl/markdown/code-after-async-call.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The asynchronous method is not followed by lines of code | ||
|
||
In the asynchronous approach the method is called as usual, but control returns to the caller before the asynchronous | ||
method is completed. After that, execution of the caller continues. | ||
|
||
## Noncompliant Code Example | ||
|
||
```bsl | ||
Text = "Warning text"; | ||
ShowMessageBox( , Text); | ||
Message("Warning is closed"); | ||
``` | ||
|
||
## Compliant Solution | ||
|
||
```bsl | ||
Text = "Warning text"; | ||
Await DoMessageBoxAsync(Text); | ||
Message("Warning is closed"); | ||
``` | ||
|
||
## See | ||
|
||
- [Synchronous and asynchronous operations](https://kb.1ci.com/1C_Enterprise_Platform/Guides/Developer_Guides/1C_Enterprise_8.3.19_Developer_Guide/Chapter_4._1C_Enterprise_language/4.7._Queries/4.7.9._Synchronous_and_asynchronous_operations/) |
54 changes: 54 additions & 0 deletions
54
bundles/com.e1c.v8codestyle.bsl/markdown/ru/code-after-async-call.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Код расположен после асинхронного вызова | ||
|
||
При асинхронном подходе вызов метода выполняется как обычно, но управление возвращается вызывающему коду до того, | ||
как асинхронный метод завершит свою работу. После этого вызывающий код продолжает свое выполнение. | ||
Особенность асинхронного выполнения: исполнение на стороне вызывающего кода продолжится до того, | ||
как полностью закончилось исполнение вызванного метода. | ||
|
||
Для правильного решения нужно вынести весь код, который должен быть выполнен после выполнения асинхронного действия, | ||
в экспортный метод и указать его имя в обработке оповещения, которая будет вызвана после завершения асинхронного действия. | ||
Или использовать асинхронность через обещания, например, Ждать ПредупреждениеАсинх(Текст). | ||
|
||
## Неправильно | ||
|
||
```bsl | ||
Текст = "Текст предупреждения"; | ||
ПоказатьПредупреждение( , Текст); | ||
Сообщить("Закрыли предупреждение"); | ||
``` | ||
|
||
```bsl | ||
ПоказатьПредупреждение(,ТекстПредупреждения); | ||
Отказ = Истина; | ||
``` | ||
|
||
## Правильно | ||
|
||
```bsl | ||
Текст = "Текст предупреждения"; | ||
Ждать ПредупреждениеАсинх(Текст); | ||
Сообщить("Закрыли предупреждение"); | ||
``` | ||
|
||
```bsl | ||
&НаКлиенте | ||
Процедура Команда1(Команда) | ||
Оповещение = Новый ОписаниеОповещения("ПредупреждениеЗавершение", ЭтотОбъект); | ||
Текст = "Текст предупреждения"; | ||
ПоказатьПредупреждение(Оповещение, Текст); | ||
КонецПроцедуры | ||
&НаКлиенте | ||
Процедура ПредупреждениеЗавершение(ДополнительныеПараметры) Экспорт | ||
Сообщить("Закрыли предупреждение"); | ||
КонецПроцедуры; | ||
``` | ||
|
||
```bsl | ||
Отказ = Истина; | ||
ПоказатьПредупреждение(,ТекстПредупреждения); | ||
``` | ||
|
||
## См. | ||
|
||
- [Синхронные и асинхронные методы работы](https://its.1c.ru/db/v8319doc#bookmark:dev:TI000001505) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/IAsyncInvocationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (C) 2023, 1C-Soft LLC and others. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* 1C-Soft LLC - initial API and implementation | ||
*******************************************************************************/ | ||
package com.e1c.v8codestyle.bsl; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
|
||
import com._1c.g5.v8.dt.platform.version.Version; | ||
|
||
/** | ||
* Platform context asynchronous methods provider | ||
* | ||
* @author Artem Iliukhin | ||
*/ | ||
public interface IAsyncInvocationProvider | ||
{ | ||
|
||
/** | ||
* Global context methods. | ||
* | ||
* @param version the version of platform, cannot be {@code null} | ||
* @return the asynchronous invocation names | ||
*/ | ||
Collection<String> getAsyncInvocationNames(Version version); | ||
|
||
/** | ||
* Methods with a list of types in which they are used. | ||
* | ||
* @param version the version of platform, cannot be {@code null} | ||
* @return the asynchronous type method names | ||
*/ | ||
Map<String, Collection<String>> getAsyncTypeMethodNames(Version version); | ||
|
||
} |
Oops, something went wrong.