Language Server Protocol implementation for 1C (BSL) - 1C:Enterprise 8 and OneScript languages.
- Contributing guidelines
- Capabilities
- Run from command line
- Run in analyzer mode
- Run in formatter mode
- Configuration file
- Reporters
- Diagnostics
- Special thanks
- File formatting
- Selected region formatting
- Symbol definition for current file (regions, procedures, functions, variables, defined via
Var
keyword) - Folding regions definition
#Region
,#If
, procedures and functions, code blocks - Methods "Cognitive Complexity" score
- Diagnostics
- Quick fixes for several diagnostics
- Run diagnostics engine from command line
- Run formatter engine from command line
jar-files run through java -jar path/to/file.jar
.
java -jar bsl-language-server.jar --help
usage: BSL language server [-a] [-c <arg>] [-f] [-h] [-o <arg>] [-r <arg>] [-s <arg>]
-a,--analyze Run analysis and get diagnostic info
-c,--configuration <arg> Path to language server configuration file
-f,--format Format files in source directory
-h,--help Show help.
-o,--outputDir <arg> Output report directory
-r,--reporter <arg> Reporter key
-s,--srcDir <arg> Source directory
-v,--version Version
Starting BSL Language Server in standard mode will run the Language Server communicating via [LSP](language server protocol). stdin and stdout are used for communication.
By default diagnostics texts are displayed in Russian. To switch the diagnostics text language you need to set parameter diagnosticLanguage
in configuration file or raise an event workspace/didChangeConfiguration
:
To run in analyzer mode use parameter --analyze
(short -a
). To set source code folder for analysis use parameter
--srcDir
(short -s
) followed by the path (relative or absolute) to the source code folder.
To generate an analysis report you need to specify one or more reporters. To specify reporter use parameter --reporter
or -r
, followed by reporter key. You may specify several reporters. The list of reporters see in section Reporters.
Command line example to run analysis:
java -jar bsl-language-server.jar --analyze --srcDir ./src/cf --reporter json
When run analysis for large code base it is recommended to set parameter {code0}-Xmx{/code0} to set maximum limit of memory being allocated to java process. The size of allocated memory depends on the size of code base for analysis.
java -Xmx4g -jar bsl-language-server.jar ... other parameters
To run in formatter mode use parameter --format
(short -f
). To set source code folder for formatting use parameter --srcDir
(short -s
) followed by the path (relative or absolute) to the source code folder.
Command line example to run formatting:
java -jar bsl-language-server.jar --format --srcDir ./src/cf
Configuration file is a file in JSON format. The file can contain the following blocks:
diagnosticLanguage
-String
- diagnostics text language. Valid values:en
orru
. By default set toru
.showCognitiveComplexityCodeLens
-Boolean
- show cognitive complexity score above method definition (codeLens). By default set totrue
.computeDiagnostics
-String
- trigger for the computation of diagnostics. Valid values:onType
(on file edit),onSave
(on file save),never
. By default set toonSave
.traceLog
-String
- path to file to log all inbound and outbound requests between BSL Language Server and Language Client from used IDE. Can be absolute or relative (to the project root). If set ** significantly slows down** communication speed between server and client. Dy default - not set.diagnostics
-Object
- diagnostics settings collection. Collection items are objects with the structure as following:- object key -
String
- diagnostics key, as given in section Diagnostics. - object value
Boolean
-false
to disable diagnostics,true
- to enable diagnostics without additional settings. By default set totrue
.Object
- Structure of settings for each diagnostics. Available parameters are give in each diagnostics section.
- object key -
You may use this JSON-schema to simplify file editing:
https://raw.githubusercontent.com/1c-syntax/bsl-language-server/master/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
Configuration file example, setting:
- diagnostics text language - Russian;
- LineLength - Line length limit diagnostics settings - max line length set to 140 characters;
- MethodSize - Method size limit diagnostics settings - disabled;
{
"$schema": "https://raw.githubusercontent.com/1c-syntax/bsl-language-server/master/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json",
"diagnosticLanguage": "en",
"diagnostics": {
"LineLength": {
"maxLineLength": 140
},
"MethodSize": false
}
}
Many thanks to all contributors to the project, to all who participated in the discussions, who helped with the testing. You are awesome!
This product is supported by YourKit, the developer of tools for monitoring and profiling Java and .NET applications.