|
| 1 | +# BSL Language Server |
1 | 2 |
|
| 3 | +[](https://github.com/1c-syntax/bsl-language-server/actions) |
| 4 | +[](https://github.com/1c-syntax/bsl-language-server/releases/latest) |
| 5 | +[](https://jitpack.io/#1c-syntax/bsl-language-server) |
| 6 | +[](https://github.com/1c-syntax/bsl-language-server/releases) |
| 7 | +[](https://github.com/1c-syntax/bsl-language-server/releases) |
| 8 | +[](https://sonarcloud.io/dashboard?id=1c-syntax_bsl-language-server) |
| 9 | +[](https://sonarcloud.io/dashboard?id=1c-syntax_bsl-language-server) |
| 10 | +[](https://sonarcloud.io/dashboard?id=1c-syntax_bsl-language-server) |
| 11 | +[](../bench/index.html) |
| 12 | +[](https://t.me/bsl_language_server) |
2 | 13 |
|
| 14 | +[Language Server Protocol](https://microsoft.github.io/language-server-protocol/) implementation for 1C (BSL) - 1C:Enterprise 8 and [OneScript](http://oscript.io) languages. |
| 15 | + |
| 16 | +- [Contributing guidelines](contributing/index.md) |
| 17 | +- <a href="#capabilities">Capabilities</a> |
| 18 | +- <a href="#cli">Run from command line</a> |
| 19 | +- <a href="#analyze">Run in analyzer mode</a> |
| 20 | +- <a href="#format">Run in formatter mode</a> |
| 21 | +- <a href="#configuration">Configuration file</a> |
| 22 | +- <a href="reporters">Reporters</a> |
| 23 | +- <a href="diagnostics">Diagnostics</a> |
| 24 | +- <a href="features">Features</a> |
| 25 | +- [Frequently asked questions](faq.md) |
| 26 | +- [System requirements](systemRequirements.md) |
| 27 | +- <a href="#thanks">Special thanks</a> |
| 28 | + |
| 29 | +<a id="capabilities"></a> |
| 30 | + |
| 31 | +Perfomance measurement - [SSL 3.1](bench/index.html) |
| 32 | + |
| 33 | +## Capabilities |
| 34 | + |
| 35 | +- File formatting |
| 36 | +- Selected region formatting |
| 37 | +- Symbol definition for current file (regions, procedures, functions, variables, defined via `Var` keyword) |
| 38 | +- Folding regions definition `#Region`, `#If`, procedures and functions, code blocks |
| 39 | +- Methods "Cognitive Complexity" and "Cyclomatic Complexity" scores |
| 40 | +- Diagnostics |
| 41 | +- Quick fixes for several diagnostics |
| 42 | +- Run diagnostics engine from command line |
| 43 | +- Run formatter engine from command line |
| 44 | + |
| 45 | +<a id="cli"></a> |
| 46 | + |
| 47 | +## Run from command line |
| 48 | + |
| 49 | +jar-files run through `java -jar path/to/file.jar`. |
| 50 | + |
| 51 | +```sh |
| 52 | +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) |
| 53 | +``` |
| 54 | +
|
| 55 | +Starting BSL Language Server in standard mode will run the Language Server communicating via [LSP]([language server protocol](https://microsoft.github.io/language-server-protocol/)). stdin and stdout are used for communication. |
| 56 | +
|
| 57 | +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`: |
| 58 | +
|
| 59 | +<a id="analyze"></a> |
| 60 | +
|
| 61 | +## Run in analyzer mode |
| 62 | +
|
| 63 | +To run in analyzer mode use parameter `--analyze` (short `-a`). |
| 64 | +
|
| 65 | +```sh |
| 66 | +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 |
| 67 | +``` |
| 68 | +
|
| 69 | +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**. |
| 70 | +
|
| 71 | +Command line example to run analysis: |
| 72 | +
|
| 73 | +```sh |
| 74 | +java -jar bsl-language-server.jar --analyze --srcDir ./src/cf --reporter json |
| 75 | +``` |
| 76 | +
|
| 77 | +> 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. |
| 78 | +
|
| 79 | +```sh |
| 80 | +java -Xmx4g -jar bsl-language-server.jar ... other parameters |
| 81 | +``` |
| 82 | +
|
| 83 | +<a id="format"></a> |
| 84 | +
|
| 85 | +## Run in formatter mode |
| 86 | +
|
| 87 | +To run in formatter mode use parameter `--format` (short `-f`). |
| 88 | +
|
| 89 | +```sh |
| 90 | +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, --srcDir=<path> Source directory |
| 91 | +``` |
| 92 | +
|
| 93 | +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). |
| 94 | +
|
| 95 | +Command line example to run formatting: |
| 96 | +
|
| 97 | +```sh |
| 98 | +java -jar bsl-language-server.jar --format --src ./src/cf |
| 99 | +``` |
| 100 | +
|
| 101 | +<a id="configuration"></a> |
| 102 | +
|
| 103 | +## Configuration file |
| 104 | +
|
| 105 | +A detailed description of the configuration file is given on [this page](features/ConfigurationFile.md) |
| 106 | +
|
| 107 | +## Special thanks |
| 108 | +
|
| 109 | +Many thanks to all [contributors](https://github.com/1c-syntax/bsl-language-server/graphs/contributors) to the project, to all who participated in the discussions, who helped with the testing. |
| 110 | +
|
| 111 | +You are awesome! |
| 112 | +
|
| 113 | +Thanks to companies supporting open source projects, and especially to those who supported us: |
| 114 | +
|
| 115 | +--- |
| 116 | +
|
| 117 | +[](https://www.yourkit.com) |
| 118 | +
|
| 119 | +[YourKit, LLC](https://www.yourkit.com) is the creator of innovative and intelligent tools for profiling `Java` and `.NET` applications. YourKit has offered an open source license [YourKit Java Profiler](https://www.yourkit.com) for `BSL Language Server` to improve its performance. |
| 120 | +
|
| 121 | +With `YourKit Java Profiler` we profile and improve project performance. |
| 122 | +
|
| 123 | +--- |
| 124 | +
|
| 125 | +[](https://www.jetbrains.com?from=bsl-language-server) |
| 126 | +
|
| 127 | +[JetBrains](https://www.jetbrains.com?from=bsl-language-server) is the creator of professional software for development. JetBrains has offered an open source license for his products, including `IntelliJ IDEA Ultimate`. |
| 128 | +
|
| 129 | +`IntelliJ IDEA Ultimate` is one of the best tools in its class. |
0 commit comments