feat: add BSL (1C Enterprise) language support#148
feat: add BSL (1C Enterprise) language support#148Alex1980Alex wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Add a multilspy adapter for the BSL Language Server
(github.com/1c-syntax/bsl-language-server), pinned to 0.22.0.
Changes:
- `Language.BSL = "bsl"` in multilspy_config.py.
- Factory registration in language_server.py.
- New package `language_servers/bsl_language_server/`:
- `bsl_language_server.py` — LanguageServer subclass that launches
`java -jar bsl-language-server.jar --lsp` (argv-list form for
cross-platform subprocess.exec; Windows does not accept a single
shell-style command string).
- `runtime_dependencies.json` — pins BSL LS 0.22.0 with SHA256.
- `initialize_params.json` — BSL-specific capabilities.
- Three integration tests in `tests/multilspy/test_multilspy_bsl.py`
(document_symbols, references, rename), skipped if `java` not in PATH.
- `.gitignore` excludes `bsl_language_server/static/` like other JAR-based
adapters.
- `README.md` lists BSL in supported languages.
Prerequisites: Java 17+ in PATH. First run downloads ~94 MB JAR from
GitHub releases into `static/<version>/`.
Tested locally: all 3 BSL tests pass on Windows (Python 3.13,
OpenJDK Zulu 17.0.13), BSL LS cold-start ~8 s.
Post-review fixes for the BSL adapter: - SHA256 verification now runs after download (or on cached JAR if the file already exists). On mismatch the JAR is removed and RuntimeError is raised with expected/actual hashes. Previously `runtime_dependencies.json` declared `sha256` but nothing validated it — supply-chain gap. - Shutdown exceptions are no longer silently swallowed; they log at WARNING level (matching kotlin_language_server.py style). Helps debug hung / crashed BSL LS instances. Tests (3/3 PASS, 24.15s, OpenJDK Zulu 17.0.13, Windows 11, Python 3.13): test_multilspy_bsl_start_and_document_symbols test_multilspy_bsl_references_in_same_module test_multilspy_bsl_rename_returns_workspace_edit
|
@Alex1980Alex please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
Thanks for this well-structured PR, @Alex1980Alex! The SHA256 verification on the JAR download is a nice touch, and the overall code quality is solid. A few things to address before we can merge:
Happy to help if you have questions about any of these. The overall implementation looks great — looking forward to getting this in! |
Closes #147.
Adds a multilspy adapter for the BSL Language Server (https://github.com/1c-syntax/bsl-language-server), pinned to 0.22.0.
Changes
multilspy_config.py.language_server.py.language_servers/bsl_language_server/:bsl_language_server.py— LanguageServer subclass that launchesjava -jar bsl-language-server.jar --lsp(argv-list form for cross-platform subprocess.exec; Windows does not accept a shell-style command string).runtime_dependencies.json— pins BSL LS 0.22.0 with SHA256 (verified after download).initialize_params.json— BSL-specific capabilities.tests/multilspy/test_multilspy_bsl.py(document_symbols, references, rename), skipped ifjavanot in PATH..gitignoreexcludesbsl_language_server/static/like other JAR-based adapters.README.mdlists BSL in supported languages.Why a separate
ProcessLaunchInfoshapeProcessLaunchInfo.cmdisList[str]per the dataclass definition. A single shell-style string (used in some third-party adapters) breaks Windowsasyncio.create_subprocess_exec. The BSL adapter always passes an argv list.Local verification
```
$ java -version
openjdk version "17.0.13" 2024-10-15 LTS
OpenJDK Runtime Environment Zulu17.54+21-CA (build 17.0.13+11-LTS)
$ python -m pytest tests/multilspy/test_multilspy_bsl.py -v
tests/multilspy/test_multilspy_bsl.py::test_multilspy_bsl_start_and_document_symbols PASSED
tests/multilspy/test_multilspy_bsl.py::test_multilspy_bsl_references_in_same_module PASSED
tests/multilspy/test_multilspy_bsl.py::test_multilspy_bsl_rename_returns_workspace_edit PASSED
============= 3 passed in 24.15s =============
```
Platform: Windows 11, Python 3.13.1.
Prerequisites
Diff size
9 files, +387 / −2 lines, 2 commits:
Happy to address review comments within 48h.