Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
cc6614a
Initial plan
Copilot Dec 14, 2025
1f91a40
Implement multi-workspace support with WorkspaceContextManager
Copilot Dec 14, 2025
53fc8ea
Fix didChange URI handling and ensure backward compatibility
Copilot Dec 14, 2025
4494c04
Add URI scheme validation in WorkspaceContext.contains()
Copilot Dec 14, 2025
1242dbb
Add comprehensive tests for WorkspaceContextManager
Copilot Dec 14, 2025
346de9e
Simplify architecture: remove WorkspaceContext, rename to ServerConte…
Copilot Dec 14, 2025
ee5dab8
Translate JavaDoc to Russian and remove @Deprecated from private fields
Copilot Dec 14, 2025
cccfebf
Remove backward compatibility, use Absolute.uri in getContextForDocument
Copilot Dec 14, 2025
0769e4f
Update tests to register workspaces, revert SymbolProviderTest
Copilot Dec 14, 2025
6ffc8fa
Add fallback for old LSP clients using rootUri/rootPath
Copilot Dec 14, 2025
f235d9d
Use Absolute.uri instead of URI constructor in ServerContextProvider
Copilot Dec 14, 2025
9cf5e78
Use Spring ObjectProvider for ServerContext creation, add ServerConte…
Copilot Dec 14, 2025
96cb67c
Remove logging from initialize path, use Absolute.path for URI-to-Pat…
Copilot Dec 14, 2025
f494065
Reuse already created URI variable in Absolute.path call
Copilot Dec 14, 2025
62f7494
Remove unused ConfigurableBeanFactory import, change initialize loggi…
Copilot Dec 14, 2025
7329dd0
Fix multi-workspace support: remove prototype scope, create ServerCon…
Copilot Dec 14, 2025
c95e2c9
Restore @Scope(prototype) for ServerContext and fix tests to use Obje…
Copilot Dec 14, 2025
99c9239
Merge branch 'develop' into copilot/support-multiple-workspaces
nixel2007 Jan 26, 2026
355480f
Fix multi-workspace test infrastructure
nixel2007 Jan 26, 2026
755b111
refactor: multi-workspace test infrastructure
nixel2007 Jan 26, 2026
5b404f7
Update license
nixel2007 Jan 26, 2026
3ac77e4
Remove @Autowired from ServerContext in DocumentContext, make it expl…
Copilot Jan 26, 2026
53c1255
Add coverage tests for multi-workspace functionality: BSLWorkspaceSer…
Copilot Jan 26, 2026
e2134ae
Migrate BSLTextDocumentService to use Optional API for getDocumentUnsafe
Copilot Jan 26, 2026
e3c0ece
Add @SuppressWarnings("NullAway.Init") to @Autowired fields in Docume…
Copilot Jan 26, 2026
c088b4f
Use Absolute.uri for workspace matching instead of Path comparison - …
Copilot Jan 26, 2026
c72f8a2
Remove redundant Absolute.uri() call in getServerContext - URI is alr…
Copilot Jan 26, 2026
abe3232
Split registeredAnnotations collection per ServerContext for proper m…
Copilot Jan 27, 2026
605467e
Address code review: unique thread names per workspace, nullable getC…
Copilot Jan 27, 2026
5d5860a
feat: implement per-workspace LanguageServerConfiguration support
nixel2007 Feb 4, 2026
4908bb6
Merge remote-tracking branch 'origin/copilot/support-multiple-workspa…
nixel2007 Feb 4, 2026
07c9067
fix: TestRunnerAdapterTest - get configuration from documentContext
nixel2007 Feb 4, 2026
3328552
Phase 5: Workspace events and per-workspace ConfigurationFileWatcher
nixel2007 Feb 4, 2026
5f460ab
Fix javadoc: add missing import for GlobalLanguageServerConfiguration…
nixel2007 Feb 4, 2026
3cb9100
Merge branch 'develop' into copilot/support-multiple-workspaces
nixel2007 Feb 4, 2026
a5a48e2
Fix SonarCloud critical issues: add transient to event fields, extrac…
nixel2007 Feb 4, 2026
66e123f
Add tests for LanguageServerConfigurationFactory and workspace events
nixel2007 Feb 4, 2026
6216a18
fix: use getServerContextUnsafe in AOP for cross-platform URI normali…
nixel2007 Feb 4, 2026
53ef16c
feat: per-workspace ReferenceContext for cross-workspace isolation
nixel2007 Feb 7, 2026
1ed4e37
refactor: initialize ReferenceContext inline in ServerContext field
nixel2007 Feb 7, 2026
4f57aa5
refactor: idiomatic Optional usage in ReferenceIndex
nixel2007 Feb 9, 2026
ca0e16f
refactor: move private methods after public in ReferenceIndex
nixel2007 Feb 9, 2026
5fddca5
refactor: navigate object graph directly in getReferencesTo instead o…
nixel2007 Feb 9, 2026
a88d7f4
refactor: navigate object graph directly in getReferencesFrom(SourceD…
nixel2007 Feb 9, 2026
62fe105
test: add dryRun tests for all BSLTextDocumentService methods with un…
nixel2007 Feb 9, 2026
3e94c47
fix: resolve trivial SonarQube issues
nixel2007 Feb 9, 2026
cfe70e1
fix: clean up AnnotationReferenceFinder on workspace removal
nixel2007 Feb 9, 2026
21f692d
refactor: extract resolveRootUri to reduce nesting in setConfiguratio…
nixel2007 Feb 9, 2026
70bc64b
Удалён промежуточный класс LoadedConfiguration, десериализация как в …
nixel2007 Feb 9, 2026
d3001f5
Merge develop, resolve SemanticTokensProviderTest conflict (take deve…
nixel2007 Feb 9, 2026
79d9c35
fix: GlobalLanguageServerConfiguration ищет конфиг сначала в CWD, пот…
nixel2007 Feb 10, 2026
99e8f92
fix: очистка enabledMethods в AbstractComplexityInlayHintSupplier при…
nixel2007 Feb 10, 2026
112fa3c
Move annotation data into ReferenceContext via AnnotationRepository
nixel2007 Feb 11, 2026
b0d3da5
Update documentation for multi-workspace support
nixel2007 Feb 11, 2026
eb6bc4b
Extract thread pool executors as Spring-managed beans
nixel2007 Feb 11, 2026
16fd9f9
docs: fix code lenses vs inlay hints terminology
nixel2007 Feb 20, 2026
8a4e5fb
fix: remove duplicate files.isEmpty() check in FormatCommand
nixel2007 Feb 20, 2026
0da1d8d
refactor: make Resources a per-workspace prototype bean
nixel2007 Feb 20, 2026
c7314fb
feat: add workspace scope for LanguageServerConfiguration and Resources
nixel2007 Feb 23, 2026
01fd681
refactor: migrate getLanguageServerConfiguration() consumers to @Auto…
nixel2007 Feb 23, 2026
cb6c919
refactor: migrate getResources() consumers to @Autowired
nixel2007 Feb 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

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.context.ServerContextProvider;
import com.github._1c_syntax.bsl.languageserver.jsonrpc.DiagnosticParams;
import com.github._1c_syntax.bsl.languageserver.jsonrpc.Diagnostics;
import com.github._1c_syntax.bsl.languageserver.jsonrpc.ProtocolExtension;
Expand Down Expand Up @@ -62,6 +63,8 @@
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.eclipse.lsp4j.TextDocumentSyncOptions;
import org.eclipse.lsp4j.WorkspaceFoldersOptions;
import org.eclipse.lsp4j.WorkspaceServerCapabilities;
import org.eclipse.lsp4j.WorkspaceSymbolOptions;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.services.LanguageServer;
Expand Down Expand Up @@ -97,7 +100,7 @@ public class BSLLanguageServer implements LanguageServer, ProtocolExtension {
private final BSLWorkspaceService workspaceService;
private final CommandProvider commandProvider;
private final ClientCapabilitiesHolder clientCapabilitiesHolder;
private final ServerContext context;
private final ServerContextProvider serverContextProvider;
private final ServerInfo serverInfo;
private final SemanticTokensLegend legend;

Expand Down Expand Up @@ -131,6 +134,7 @@ public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
capabilities.setExecuteCommandProvider(getExecuteCommandProvider());
capabilities.setDiagnosticProvider(getDiagnosticProvider());
capabilities.setSemanticTokensProvider(getSemanticTokensProvider());
capabilities.setWorkspace(getWorkspaceCapabilities());

var result = new InitializeResult(capabilities, serverInfo);

Expand All @@ -143,31 +147,29 @@ private void setConfigurationRoot(InitializeParams params) {
return;
}

var rootUri = workspaceFolders.get(0).getUri();
Path rootPath;
try {
rootPath = new File(new URI(rootUri).getPath()).getCanonicalFile().toPath();
} catch (URISyntaxException | IOException e) {
LOGGER.error("Can't read root URI from initialization params.", e);
return;
}

var configurationRoot = LanguageServerConfiguration.getCustomConfigurationRoot(
configuration,
rootPath);
context.setConfigurationRoot(configurationRoot);
// Добавляем все workspace folders
workspaceFolders.forEach(serverContextProvider::addWorkspace);
}

@Override
public void initialized(InitializedParams params) {
var factory = new NamedForkJoinWorkerThreadFactory("populate-context-");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

не помешает разные thread factory под каждый workspace name. Ну или хотя бы хэш сервер контекста добавить к имени.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправлено в 605467e. Теперь каждый workspace получает уникальное имя потока с хешем ServerContext: populate-context-{hashCode}-. Каждый workspace также имеет свой ForkJoinPool с автоматическим shutdown после завершения populateContext.

var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true);
CompletableFuture
.runAsync(context::populateContext, executorService)

// Populate all workspace contexts
var allContexts = serverContextProvider.getAllContexts();
var tasks = allContexts.stream()
.map(serverContext -> CompletableFuture.runAsync(
serverContext::populateContext,
executorService
))
.toArray(CompletableFuture[]::new);

CompletableFuture.allOf(tasks)
.whenComplete((Void unused, @Nullable Throwable throwable) -> {
executorService.shutdown();
if (throwable != null) {
LOGGER.error("Error populating context", throwable);
LOGGER.error("Error populating workspace contexts", throwable);
}
});
}
Expand All @@ -176,7 +178,7 @@ public void initialized(InitializedParams params) {
public CompletableFuture<Object> shutdown() {
shutdownWasCalled = true;
textDocumentService.reset();
context.clear();
serverContextProvider.clear();
return CompletableFuture.completedFuture(Boolean.TRUE);
}

Expand Down Expand Up @@ -384,4 +386,15 @@ private SemanticTokensWithRegistrationOptions getSemanticTokensProvider() {
return semanticTokensProvider;
}

private static WorkspaceServerCapabilities getWorkspaceCapabilities() {
var workspaceCapabilities = new WorkspaceServerCapabilities();

var workspaceFoldersOptions = new WorkspaceFoldersOptions();
workspaceFoldersOptions.setSupported(Boolean.TRUE);
workspaceFoldersOptions.setChangeNotifications(Boolean.TRUE);

workspaceCapabilities.setWorkspaceFolders(workspaceFoldersOptions);
return workspaceCapabilities;
}

}
Loading