Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
a4d2668
Initial plan
Copilot Jan 17, 2026
e6bb6d8
Добавлена документация исследования поддержки LSIF протокола
Copilot Jan 17, 2026
5be0b37
Обновлено исследование LSIF: добавлен анализ lsif-java
Copilot Jan 17, 2026
719f827
Обновлена архитектура LSIF в соответствии со стилем BSL LS
Copilot Jan 17, 2026
5a728f8
Реализация базовой поддержки LSIF
Copilot Jan 17, 2026
1348ee3
Добавлены LSIF поставщики: definition, references, foldingRange, docu…
Copilot Jan 17, 2026
6d15d60
Добавлен DocumentLink supplier и тесты для LSIF
Copilot Jan 17, 2026
c545d6d
Добавлена поддержка Moniker для кросс-проектной навигации
Copilot Jan 17, 2026
c410c84
Рефакторинг: замена @Value+@Builder на Java records
Copilot Jan 18, 2026
a311fb5
Добавлен JavaDoc для всех records и публичных методов LSIF
Copilot Jan 18, 2026
ea67f1f
Добавлена поддержка двух форматов вывода: NDJSON и JSON
Copilot Jan 18, 2026
19adecc
Исправлен DefinitionLsifSupplier: добавлена обработка ссылок через Re…
Copilot Jan 18, 2026
2336765
Упрощён DefinitionLsifSupplier: используется только ReferenceIndex
Copilot Jan 22, 2026
e6b741d
Упрощён DefinitionLsifSupplier: используется только Reference API
Copilot Jan 22, 2026
1fcf480
DefinitionLsifSupplier: глобальный кэш resultSet между документами
Copilot Jan 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
438 changes: 438 additions & 0 deletions docs/features/LSIFSupport.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
* [Конфигурирование](ConfigurationFile.md)
* [Экранирование кода от диагностик](DiagnosticIgnorance.md)
* [Мониторинг и отправка ошибок](Monitoring.md)
* [Поддержка LSIF (исследование)](LSIFSupport.md)
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.github._1c_syntax.bsl.languageserver.cli.AnalyzeCommand;
import com.github._1c_syntax.bsl.languageserver.cli.FormatCommand;
import com.github._1c_syntax.bsl.languageserver.cli.LanguageServerStartCommand;
import com.github._1c_syntax.bsl.languageserver.cli.LsifCommand;
import com.github._1c_syntax.bsl.languageserver.cli.VersionCommand;
import com.github._1c_syntax.bsl.languageserver.cli.WebsocketCommand;
import com.github._1c_syntax.utils.CaseInsensitivePattern;
Expand Down Expand Up @@ -60,6 +61,7 @@
subcommands = {
AnalyzeCommand.class,
FormatCommand.class,
LsifCommand.class,
VersionCommand.class,
LanguageServerStartCommand.class,
WebsocketCommand.class
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* This file is a part of BSL Language Server.
*
* Copyright (c) 2018-2026
* Alexey Sosnoviy <labotamy@gmail.com>, Nikita Fedkin <nixel2007@gmail.com> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* BSL Language Server is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* BSL Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with BSL Language Server.
*/
package com.github._1c_syntax.bsl.languageserver.cli;

import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration;
import com.github._1c_syntax.bsl.languageserver.context.ServerContext;
import com.github._1c_syntax.bsl.languageserver.lsif.LsifIndexer;
import com.github._1c_syntax.bsl.languageserver.lsif.LsifOutputFormat;
import com.github._1c_syntax.utils.Absolute;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.io.File;
import java.nio.file.Path;
import java.util.concurrent.Callable;

/**
* Генерация LSIF-индекса.
* <p>
* Ключ команды: lsif
* <p>
* Параметры:
* <ul>
* <li>-s, --srcDir — путь к каталогу исходных файлов</li>
* <li>-o, --output — путь к выходному файлу (по умолчанию: dump.lsif)</li>
* <li>-f, --format — формат вывода: ndjson или json (по умолчанию: ndjson)</li>
* <li>-c, --configuration — путь к конфигурационному файлу</li>
* </ul>
*/
@Slf4j
@Command(
name = "lsif",
aliases = {"-l", "--lsif"},
description = "Generate LSIF index for code navigation",
usageHelpAutoWidth = true,
footer = "@|green Copyright(c) 2018-2026|@")
@Component
@RequiredArgsConstructor
public class LsifCommand implements Callable<Integer> {

private static final String DEFAULT_OUTPUT = "dump.lsif";

@Option(
names = {"-h", "--help"},
usageHelp = true,
description = "Show this help message and exit")
private boolean usageHelpRequested;

@Option(
names = {"-s", "--srcDir"},
description = "Source directory",
paramLabel = "<path>",
defaultValue = "")
private String srcDirOption;

@Option(
names = {"-o", "--output"},
description = "Output LSIF file (default: dump.lsif)",
paramLabel = "<path>",
defaultValue = DEFAULT_OUTPUT)
private String outputOption;

@Option(
names = {"-f", "--format"},
description = "Output format: ndjson (default) or json. NDJSON is recommended for large projects.",
paramLabel = "<format>",
defaultValue = "NDJSON")
private LsifOutputFormat formatOption;

@Option(
names = {"-c", "--configuration"},
description = "Path to language server configuration file",
paramLabel = "<path>",
defaultValue = "")
private String configurationOption;

private final LanguageServerConfiguration configuration;
private final ServerContext context;
private final LsifIndexer lsifIndexer;

@Override
public Integer call() {
Path srcDir = Absolute.path(srcDirOption);
if (!srcDir.toFile().exists()) {
LOGGER.error("Source dir `{}` does not exist", srcDir);
return 1;
}

var configurationFile = new File(configurationOption);
configuration.update(configurationFile);

var configurationPath = LanguageServerConfiguration.getCustomConfigurationRoot(configuration, srcDir);
context.setConfigurationRoot(configurationPath);

Path outputFile = Absolute.path(outputOption);
String toolVersion = getClass().getPackage().getImplementationVersion();
if (toolVersion == null) {
toolVersion = "dev";
}

try {
lsifIndexer.index(srcDir, outputFile, toolVersion, formatOption);
LOGGER.info("LSIF index generated: {} (format: {})", outputFile, formatOption.getFormatId());
return 0;
} catch (Exception e) {
LOGGER.error("Failed to generate LSIF index", e);
return 1;
}
}
}
Loading