Skip to content

BSL Language Server

Actions Status Download JitPack GitHub Releases GitHub All Releases Quality Gate Maintainability Coverage Qodana Transifex Benchmark telegram

Language Server Protocol implementation for 1C (BSL) - 1C:Enterprise 8 and OneScript languages.

Perfomance measurement - SSL 3.1

Features

  • 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, queries
  • Methods "Cognitive Complexity" and "Cyclomatic Complexity" scores
  • Tooltip on local methods and methods of common / manager modules
  • Go to method definitions
  • Finding places to use methods
  • Method call hierarchy
  • Expand selection
  • Display color representation and convert between Color and WebColors
  • Diagnostics
  • Quick fixes and code actions for several diagnostics
  • Run diagnostics engine from command line
  • Run formatter engine from command line
  • Renaming Symbols

Supported protocol operations

Workspace

| Operation                                                     | Support                                                    | Commentary                                                  |     | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |     | didChangeWorkspaceFolders | no   |                                                              |     | didChangeConfiguration | yes | with restrictions see #1431 |     | didChangeWatchedFiles | no   |                                                              |     | symbol | yes |                                                              |     | executeCommand | yes |                                                              |     | applyEdit | no   |                                                              |     | willCreateFiles |   no  |                                                              |

Text Synchronization
Opertaion Supported Comment
didOpen yes
didChange yes textDocumentSyncKind = Full
didClose yes
didSave yes
willSave no
willSaveWaitUntil no
Textdocument
Operation Support Commentary Is configured?
publishDiagnostics yes tagSupport = true
versionSupport = true
diagnostics
yes
completion no resolveProvider = false
completionItem/resolve no
hover yes contentFormat = MarkupContent
signatureHelp no
declaration no not applicable in 1C:Enterprise
definition yes linkSupport = true
typeDefinition no
implementation no not applicable in 1C:Enterprise
references yes
documentHighlight no
documentSymbol yes hierarchicalDocumentSymbolSupport = true
codeAction yes codeActionKinds = ? (см. #1433)
isPreferredSupport = true
yes
codeAction/resolve no
codeLens yes resolveProvider = false yes
codeLens/resolve yes
codeLens/refresh yes
documentLink yes Showing hyperlinks to documentation on diagnostics.
tooltipSupport = true
resolveProvider = false
yes
documentLink/resolve no
documentColor yes
colorPresentation yes
formatting yes
rangeFormatting yes
onTypeFormatting no
rename yes
prepareRename yes
foldingRange yes
selectionRange yes
prepareCallHierarchy yes
callHierarchy/incomingCalls yes
callHierarchy/outgoingCalls yes
semanticTokens no
linkedEditingRange no
moniker no
inlayHint yes resolveProvider = false yes
inlayHint/resolve no
inlayHint/refresh yes

Run from command line

jar-files run through java -jar path/to/file.jar.

java -jar bsl-language-server.jar --help

BSL language server
Usage: bsl-language-server [-h] [-c=<path>] [COMMAND [ARGS]]
  -c, --configuration=<path>
               Path to language server configuration file
  -h, --help   Show this help message and exit
Commands:
  analyze, -a, --analyze      Run analysis and get diagnostic info
  format, -f, --format        Format files in source directory
  version, -v, --version      Print version
  lsp, --lsp                  LSP server mode (default)
  websocket, -w, --websocket  Websocket server mode

Starting BSL Language Server in standard mode will run the Language Server communicating via LSP. 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 language in configuration file or raise an event workspace/didChangeConfiguration:

{
  "language": "en"
}

Run in websocket mode

By default, interaction with the server goes through standard input / output streams. But you can run BSL Language Server with a built-in web server and interact with it via websocket.

To do this, start the BSL Language Server with the --websocket or -w option:

Usage: bsl-language-server websocket [-h] [--app.websocket.lsp-path=<path>]
                                     [-c=<path>] [--server.port=<port>]
Websocket server mode
      --app.websocket.lsp-path=<path>
                             Path to LSP endpoint. Default is /lsp
  -c, --configuration=<path> Path to language server configuration file
  -h, --help                 Show this help message and exit
      --server.port=<port>   Port to listen. Default is 8025

Once started, BSL Language Server will be available at ws://localhost:8025/lsp.

To redefine the port to the LSP server, you must use the --server.port option and the port number. To redefine the path to the LSP server, you must use the --app.websocket.lsp-path option and a path starting with /.

An example of running BSL Language Server in websocket mode with port 8080:

java -jar bsl-language-server.jar --websocket --server.port=8080

For large projects, it is recommended to specify the -Xmx parameter, which is responsible for the RAM limit for the java process. The amount of allocated memory depends on the size of the analyzed codebase.

java -Xmx4g -jar bsl-language-server.jar ... other parameters

Run in analyzer mode

To run in analyzer mode use parameter --analyze (short -a).

Usage: bsl-language-server analyze [-hq] [-c=<path>] [-o=<path>] [-s=<path>]
                                   [-r=<keys>]...
Run analysis and get diagnostic info
  -c, --configuration=<path>
                           Path to language server configuration file
  -h, --help               Show this help message and exit
  -o, --outputDir=<path>   Output report directory
  -q, --silent             Silent mode
  -r, --reporter=<keys>    Reporter key (console, junit, json, tslint, generic)
  -s, --srcDir=<path>      Source directory
  -w, --workspaceDir=<path> 
                           Workspace directory

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

Run in formatter mode

To run in formatter mode use parameter --format (short -f).

Usage: bsl-language-server format [-hq] [-s=<path>]
Format files in source directory
  -h, --help            Show this help message and exit
  -q, --silent          Silent mode
  -s, --src=<path>      Source directory or file

To set source code folder (or source file) for formatting use parameter --src (short -s) followed by the path (relative or absolute) to the source code folder (or file).

Command line example to run formatting:

java -jar bsl-language-server.jar --format --src ./src/cf

Configuration file

A detailed description of the configuration file is given on this page

Special thanks

Many thanks to all contributors to the project, to all who participated in the discussions, who helped with the testing.

You are awesome!

Thanks to companies supporting open source projects, and especially to those who supported us:


YourKit  

YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. YourKit has offered an open source license YourKit Java Profiler for BSL Language Server to improve its performance.

With YourKit Java Profiler we profile and improve project performance.


JetBrains

JetBrains is the creator of professional software for development. JetBrains has offered an open source license for his products, including IntelliJ IDEA Ultimate.

IntelliJ IDEA Ultimate is one of the best tools in its class.


Digilabs

Digilabs - authors of Alkir - a software package for monitoring the performance of systems based on 1C:Enterprise 8. Digilabs provides us with server facilities for continuous performance testing of the BSL Language Server.