Skip to content

Commit eec5144

Browse files
committed
Merge branch 'develop'
2 parents e2aa8d8 + 6a885a8 commit eec5144

File tree

58 files changed

+1630
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1630
-148
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BSL Language Server
22

3-
[![Build Status](https://travis-ci.org/1c-syntax/bsl-language-server.svg?branch=master)](https://travis-ci.org/1c-syntax/bsl-language-server)
3+
[![Build Status](https://travis-ci.org/1c-syntax/bsl-language-server.svg?branch=develop)](https://travis-ci.org/1c-syntax/bsl-language-server)
44
[![JitPack](https://jitpack.io/v/1c-syntax/bsl-language-server.svg)](https://jitpack.io/#1c-syntax/bsl-language-server)
55
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=1c-syntax_bsl-language-server&metric=alert_status)](https://sonarcloud.io/dashboard?id=1c-syntax_bsl-language-server)
66
[![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=1c-syntax_bsl-language-server&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=1c-syntax_bsl-language-server)
@@ -17,10 +17,10 @@
1717

1818
* Форматирование файла
1919
* Форматирование выбранного диапазона
20-
* Определение символов текущего файла (процедуры, функции, переменные, объявленные через `Перем`)
21-
* Сворачивание областей, блоков кода, процедур и функций, секций `#Использовать`
20+
* Определение символов текущего файла (области, процедуры, функции, переменные, объявленные через `Перем`)
2221
* Определение сворачиваемых областей - `#Область`, `#Если`, процедуры и функции, блоки кода
2322
* Диагностики
23+
* "Быстрые исправления" (quick fixes) для ряда диагностик
2424
* Запуск движка диагностик из командной строки
2525

2626
## Запуск из командной строки
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Удаление элемента при обходе коллекции посредством оператора Для каждого ... Из ... Цикл
2+
3+
Не следует непосредственно удалять элементы коллекции при ее обходе через синтаксическую конструкцию
4+
**Для каждого ... Из ... Цикл**. Т.к. при удалении элемента сдвигается индекс следующего элемента.
5+
6+
Например:
7+
8+
```bsl
9+
Для Каждого Элемент Из Коллекция Цикл
10+
Коллекция.Удалить(Элемент)
11+
КонецЦикла;
12+
```
13+
14+
Как вариант удаляйте элементы с конца:
15+
16+
```bsl
17+
ТекущийИндекс = Числа.ВГраница();
18+
Пока ТекущийИндекс >= 0 Цикл
19+
Если Числа[ТекущийИндекс] < 10 Тогда
20+
Числа.Удалить(ТекущийИндекс);
21+
КонецЕсли;
22+
ТекущийИндекс = ТекущийИндекс – 1;
23+
КонецЦикла;
24+
```
25+
26+
Источник: [1С:Программирование для начинающих. Разработка в системе "1С:Предприятие 8.3"](https://its.1c.ru/db/pubprogforbeginners#content:88:hdoc)

docs/diagnostics/ExtraCommas.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Запятые без указания параметра в конце вызова метода
2+
3+
Не следует указывать запятую в конце вызова метода без указания параметра. Это затрудняет восприятие и не несет важной информации.
4+
5+
Плохо:
6+
7+
```bsl
8+
Результат = Действие(П1, П2,,);
9+
```
10+
11+
Хорошо:
12+
13+
```bsl
14+
Результат = Действие(П1, П2);
15+
```
16+
17+
Основание:
18+
Обязательные параметры подпадают под рекомендацию ["Соглащения о написании кода. Параметры процедур и функций. Пункт 7"](https://its.1c.ru/db/v8std#content:640:hdoc).
19+
Необязательные параметры попадают под принцип Бритва Оккама "Не следует множить сущности без необходимости", так как "висящая" запятая мало информативна.

docs/diagnostics/MagicNumber.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Использование магического числа
2+
3+
Магические числа - это любое число в вашем коде, которое не сразу становится очевидным без погружения в контекст.
4+
5+
Плохо
6+
```Bsl
7+
Функция ПопадаетВИнтервал(Длительность)
8+
9+
Возврат Длительность < 10 * 60 * 60;
10+
11+
КонецФункции
12+
```
13+
14+
Хорошо
15+
```Bsl
16+
Функция ПопадаетВИнтервал(ДлительностьВСекундах)
17+
18+
МинутВЧасе = 60;
19+
СекундВМинуте = 60;
20+
СекундВЧасе = СекундВМинуте * МинутВЧасе;
21+
ЧасовВИнтервале = 10;
22+
Возврат Длительность < ЧасовВИнтервале * СекундВЧасе;
23+
24+
КонецФункции
25+
```

docs/diagnostics/UsingServiceTag.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
Диагностика отлавливает использование служебных тегов в комментариях. Список тегов:
44
* TODO
55
* FIXME
6+
* !!
7+
* @
8+
* MRG
9+
* ОТЛАДКА
10+
* ДЛЯ ОТЛАДКИ
11+
* КОНСТРУКТОР_ЗАПРОСА_С_ОБРАБОТКОЙ_РЕЗУЛЬТАТА
12+
* КОНСТРУКТОР_ДВИЖЕНИЙ_РЕГИСТРОВ
13+
* КОНСТРУКТОР_ПЕЧАТИ
14+
* КОНСТРУКТОР_ВВОДА_НА_ОСНОВАНИИ
615

716
Список тегов так же можно расширить через настройки.
817

918
## Параметры
1019

11-
* `serviceTags` - `Строка` - ключевые слово для поиска. По-умолчанию: "todo|fixme".
20+
* `serviceTags` - `Строка` - ключевые слово для поиска. По-умолчанию: "todo|fixme|!!|mrg|@|отладка|debug|для\s*отладки|(\{\{|\}\})КОНСТРУКТОР_|(\{\{|\}\})MRG".
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Deleting an item when iterating through collection using the operator "For each ... In ... Do"
2+
3+
Don't delete elements of collection %s when iterating through collection using the
4+
operator **For each ... In ... Do**. Because it change index of next element.
5+
6+
Example:
7+
8+
```bsl
9+
For each Element In Collection Do
10+
Collection.Delete(Element)
11+
EndDo;
12+
```
13+
14+
Alternatively remove elements from the end:
15+
16+
```bsl
17+
IndexOf = Numbers.UBound();
18+
While IndexOf >= 0 Do
19+
If Numbers[IndexOf] < 10 Then
20+
Numbers.Delete(IndexOf);
21+
EndIf;
22+
IndexOf = IndexOf – 1;
23+
EndDo;
24+
```
25+
26+
Refference: [1С:Программирование для начинающих. Разработка в системе "1С:Предприятие 8.3" (RU)](https://its.1c.ru/db/pubprogforbeginners#content:88:hdoc)

docs/en/diagnostics/ExtraCommas.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Commas without a parameter at the end of a method call
2+
3+
Do not include a comma at the end of a method call without specifying a parameter. It is difficult to understand and does not carry important information.
4+
5+
Bad:
6+
7+
```bsl
8+
Result = Action (P1, P2 ,,);
9+
```
10+
11+
Good:
12+
13+
```bsl
14+
Result = Action (P1, P2);
15+
```
16+
17+
Base:
18+
Required parameters fall under the recommendation of ["Code-writing conventions. Parameters of procedures and functions. Item 7"](https://its.1c.ru/db/v8std#content:640:hdoc).
19+
Not required parameters under the principle of Occam's Razor "Do not multiply entities without need", since the "hanging" comma is not very informative.

docs/en/diagnostics/MagicNumber.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Using magic number
2+
3+
Magic numbers are any number in your code that does not immediately become apparent without being immersed in context.
4+
5+
Bad
6+
```Bsl
7+
Function GetsTheInterval(Duration)
8+
9+
     Return Duration < 10 * 60 * 60;
10+
11+
End Function
12+
```
13+
14+
Good
15+
```Bsl
16+
Function GetsTheInterval (Duration in Seconds)
17+
    
18+
     MinutesHour = 60;
19+
     SecondsMinute = 60;
20+
     SecondsHour = SecondsMinute * MinutesHour;
21+
     HoursIninterval = 10;
22+
     Return Duration < HoursWininterval * SecondsHour;
23+
24+
End Function
25+
```

docs/en/diagnostics/UsingServiceTag.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ The diagnostic finds use of service tags in comments. Tags list:
44

55
- TODO
66
- FIXME
7+
- !!
8+
- @
9+
- MRG
10+
- ОТЛАДКА
11+
- ДЛЯ ОТЛАДКИ
12+
- КОНСТРУКТОР_ЗАПРОСА_С_ОБРАБОТКОЙ_РЕЗУЛЬТАТА
13+
- КОНСТРУКТОР_ДВИЖЕНИЙ_РЕГИСТРОВ
14+
- КОНСТРУКТОР_ПЕЧАТИ
15+
- КОНСТРУКТОР_ВВОДА_НА_ОСНОВАНИИ
716

817
Tags list can be extended via options.
918

1019
## Parameters
1120

12-
- `serviceTags` - `String` - keyword for search. Bu default : "todo|fixme".
21+
- `serviceTags` - `String` - keyword for search. Bu default : "todo|fixme|!!|mrg|@|отладка|debug|для\s*отладки|(\{\{|\}\})КОНСТРУКТОР_|(\{\{|\}\})MRG".

docs/en/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/) implementation for 1C (BSL) - 1C:Enterprise 8 and [OneScript](http://oscript.io) languages.
1111

12-
[English version](en/index.md)
12+
[Russian version](../index.md)
1313

1414
- <a href="#capabilities">Capabilities</a>
1515
- <a href="#cli">Run from command line</a>
@@ -24,7 +24,10 @@
2424

2525
- File formatting
2626
- Selected region formatting
27+
- Symbol definition for current file (regions, procedures, functions, variables, defined via `Var` keyword)
28+
- Folding regions definition `#Region`, `#If`, procedures and functions, code blocks
2729
- Diagnostics
30+
- Quick fixes for several diagnostics
2831
- Run diagnostics engine from command line
2932

3033
<a id="cli"></a>
@@ -130,11 +133,13 @@ Used for code analysis to meet coding standards and search for possible errors.
130133
- [DeprecatedMessage - Restriction on the use of deprecated "Message" method](diagnostics/DeprecatedMessage.md)
131134
- [EmptyCodeBlock - Empty code block](diagnostics/EmptyCodeBlock.md)
132135
- [EmptyStatement - Empty Ssatement](diagnostics/EmptyStatement.md)
136+
- [ExtraCommas - Commas without a parameter at the end of a method call](diagnostics/ExtraCommas.md)
133137
- [FunctionShouldHaveReturn - Function must have Return statement](diagnostics/FunctionShouldHaveReturn.md)
134138
- [IfElseDuplicatedCodeBlockDiagnostic - Duplicated code blocks in If...Then...ElsIf...](diagnostics/IfElseDuplicatedCodeBlock.md)
135139
- [IfElseDuplicatedConditionDiagnostic - Duplicated conditions in If...Then...ElsIf...](diagnostics/IfElseDuplicatedCondition.md)
136140
- [IfElseIfEndsWithElse - Using If...Then...ElsIf... statement](diagnostics/IfElseIfEndsWithElse.md)
137141
- [LineLength - Line length restriction](diagnostics/LineLength.md)
142+
- [MagicNumber - Using magic number](diagnostics/MagicNumber.md)
138143
- [MethodSize - Method size restriction](diagnostics/MethodSize.md)
139144
- [NestedConstructorsInStructureDeclaration - Nested constructors with parameters in structure declaration](diagnostics/NestedConstructorsInStructureDeclaration.md)
140145
- [NestedStatements - Control flow statements should not be nested too deep](diagnostics/NestedStatements.md)

0 commit comments

Comments
 (0)