Fix workspace removal events not published during ServerContextProvider.clear()#3662
Open
Fix workspace removal events not published during ServerContextProvider.clear()#3662
Conversation
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
…xtProvider Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for multiple workspaces in LSP
Поддержка нескольких workspace в LSP
Dec 14, 2025
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContextProvider.java
Show resolved
Hide resolved
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SymbolProvider.java
Outdated
Show resolved
Hide resolved
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
Outdated
Show resolved
Hide resolved
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Outdated
Show resolved
Hide resolved
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Outdated
Show resolved
Hide resolved
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
nixel2007
reviewed
Dec 14, 2025
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
Show resolved
Hide resolved
…wired Migrate main and test consumers of ServerContext.getLanguageServerConfiguration() to use @Autowired workspace-scoped LanguageServerConfiguration proxy: Main files: - DiagnosticsConfiguration: use @Autowired LSC field - SarifReporter: add LSC constructor parameter - AnalyzeProjectOnStart: add @Autowired LSC, set ThreadLocal from event - AnalyzeCommand: add @Autowired LSC, wrap in try/finally with ThreadLocal - ConfigurationFileSystemWatcher: store LSC directly instead of ServerContext - ConfigurationFileChangeListener: accept LSC instead of ServerContext Test files (18): migrate from serverContext navigation to @Autowired LSC The getter on ServerContext is kept for DocumentContext (not a Spring bean). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add AutoCloseable forUri() and wrap methods run()/call() to eliminate manual set/clear boilerplate. forUri() supports nesting by saving and restoring the previous ThreadLocal value on close. Migrate all existing set/clear call sites: - BSLLanguageServer.initialized: forUri (try-with-resources) - BSLWorkspaceService.didChangeWorkspaceFolders: run() - ServerContextProvider.addWorkspace: forUri (try-with-resources) - AnalyzeProjectOnStart.handleEvent: forUri (try-with-resources) - AnalyzeCommand.execute: forUri (try-with-resources) Add comprehensive unit tests for all new methods including nesting, restore, and exception safety. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore original field ordering, blank lines between @Autowired fields, and remove unnecessary method signature / call site line breaks introduced during multi-pass refactoring: - QuickFixSupplier, QuickFixCodeActionSupplier, FixAllCodeActionSupplier: put method signatures and calls back on single lines - ConstructorColorPresentationSupplier, WebColorPresentationSupplier: restore static constants before instance fields - AbstractMethodComplexityCodeLensSupplier: restore field order and javadoc - CognitiveComplexity/CyclomaticComplexityCodeLensSupplier: match parent field order - DisableDiagnosticTriggeringSupplier: restore static constant position - CommonModuleInvalidTypeDiagnostic: remove extra blank line - 15 test files: restore field ordering and blank lines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix @OverRide indentation lost in 5 diagnostic files - Remove duplicate CF import in ServerContext - Restore field ordering to match develop in 4 files - Fix trailing whitespace in 22 files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Restore protected visibility for configuration field - Remove @Getter(AccessLevel.PROTECTED) in AbstractRunTestsCodeLensSupplier - Remove unused documentContext param from getComplexityThreshold() - Keep only meaningful change: configuration param in @Cacheable getTestSources() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nModuleNameDiagnostic Restore constructor parameter for LanguageServerConfiguration in the abstract class and all 9 subclasses. Spring injects the workspace-scoped proxy via constructor just as well, @Autowired field injection is unnecessary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the standard Spring BeanPostProcessor pattern for diagnostic initialization instead of the custom initAfterInfoSet() approach. - Recreate DiagnosticBeanPostProcessor with @lazy constructor to avoid early initialization warnings for workspace-scoped dependencies - Restore @PostConstruct in 5 diagnostics that need info for init - Remove initAfterInfoSet() from BSLDiagnostic interface - Revert DiagnosticObjectProvider to simple get(Class) method - Revert callers in DiagnosticsConfiguration and QuickFixSupplier Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore original getResourceString(key) private method pattern in DescriptionFormatter, ModuleSymbolMarkupContentBuilder, and VariableSymbolMarkupContentBuilder. The resources field is already available — no need to pass it as a parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ltiple-workspaces # Conflicts: # src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java # src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/infrastructure/MinimumLSPDiagnosticLevelTest.java # src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplierTest.java # src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.java
Resolve language from workspace-scoped LanguageServerConfiguration when workspace context is set, otherwise fall back to GlobalLanguageServerConfiguration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make context a private field in AnalyzeCommand (like FormatCommand), rename to serverContext for consistency, remove context parameter from getFileInfoFromFile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wrap formatting work in WorkspaceContextHolder.forUri() so that workspace-scoped proxies resolve correctly, consistent with AnalyzeCommand pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Local propagation - WorkspaceScope.resolveKey() throws IllegalStateException instead of falling back - Remove DEFAULT_WORKSPACE_KEY constant - Add WorkspaceContextTestExecutionListener for test ThreadLocal setup - Fix parallelStream ThreadLocal propagation (always set, not just when null) - Fix circular bean creation in LanguageServerConfiguration @PostConstruct - Add null guard in AnalyzeProjectOnStart for workspaceUri - Fix ConfigurationFileSystemWatcher to set workspace context - Fix ServerContextProvider.clear() to also clean workspace scope beans - Fix ConfigurationFileSystemWatcherTest for awaitility thread context Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g parameter passing - MissingCommonModuleMethodDiagnostic: revert to @requiredargsconstructor + private final - OrdinaryAppSupportDiagnostic: revert to @requiredargsconstructor + private final - FormatProvider: remove explicit LanguageServerConfiguration parameter passing through method chain — use the injected per-workspace proxy field directly - IdenticalExpressionsDiagnostic: remove unnecessary LSC injection (FormatProvider handles it) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…xecutors - ServerContext: inject populateContextExecutor, wrap parallelStream - AnalyzeCommand/FormatCommand: inject cliExecutor, wrap parallelStream - Remove manual WorkspaceContextHolder propagation helpers - DiagnosticInfo: cache language and codeDescriptionHref to avoid workspace proxy access from common ForkJoinPool worker threads - Add cliExecutor bean in ExecutorConfiguration - Fix DocumentLink test to refresh DiagnosticInfos after config changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On Windows, Absolute.uri() normalizes file:///test-analyze-workspace to include a drive letter (e.g. file:///C:/test-analyze-workspace). Using the raw URI for WorkspaceContextHolder.set() caused a key mismatch with workspace-scoped bean registry, making AnalyzeProjectOnStartTest fail on Windows. Use context.getWorkspaceUri().toString() (already normalized by addWorkspace) instead of raw URIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
WorkspaceContextHolder now accepts and stores java.net.URI, normalizing via Absolute.uri() on set. This eliminates the class of bugs where raw URI strings didn't match normalized ones (e.g. Windows adding drive letter to file:///test-workspace → file:///C:/test-workspace). WorkspaceScope internal maps also changed from String to URI keys. All callers updated to pass URI directly instead of uri.toString(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoids serial lock-file retry delays on Windows (~25s → ~2.5s). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Callers must pass already-normalized URIs. Test constants use Absolute.uri() to normalize, fixing Windows CI failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tate Reverted: GenerateStandardRegionsSupplier field rename, AbstractRunTestsCodeLensSupplier configuration parameter, CodeLensesConfiguration filtering moved back here. CodeLensProvider uses lazy ObjectProvider evaluation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove Absolute.uri() from addWorkspace(URI, String) — callers must pass already-normalized URIs - Change AOP args(workspaceUri) to args(workspaceUri, *) to match the two-parameter addWorkspace(URI, String) overload directly - Normalize URI in ConfigurationFileSystemWatcherTest setUp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…AllContexts - AnalyzeProjectOnStart: remove redundant WorkspaceContextHolder.forUri() wrapper (context propagated via ContextPropagatingTaskDecorator for @async) - BSLLanguageServer: use Map.Entry key instead of serverContext.getWorkspaceUri() - BSLWorkspaceService: extract URI from folder directly - ServerContextProvider.getAllContexts(): return Map<URI, ServerContext> - SymbolProvider, TestUtils: adapt to new return type Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
- Add registerWorkspace/unregisterWorkspace to WorkspaceContextHolder - forUri(URI) resolves name from registry, throws if not registered - Move extractWorkspaceName to ServerContextProvider - ServerContextProvider registers/unregisters names on add/remove/clear - Clean up tests to use registration API Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
@copilot падает один тест, поправь. |
Contributor
Author
Какой именно тест падает? Полный запуск тестов занимает очень много времени. Если укажете название теста, я смогу быстрее его исправить с помощью |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
ConfigurationFileSystemWatchermaintained stale workspace URIs in itsworkspaceWatchKeysmap afterServerContextProvider.clear()was called. This causedIllegalStateExceptionwhen the watcher tried to use removed workspaces.Root cause:
clear()directly removed workspaces without publishingBeforeWorkspaceRemovedEvent, preventing event listeners from cleaning up their state.Changes
ServerContextProvider.clear()inPointcuts@Beforeadvice inEventPublisherAspectto publishBeforeWorkspaceRemovedEventfor each workspace before clearingConfigurationFileSystemWatcherunregistering watch keys) works correctly during bulk workspace removalThe fix maintains consistency with the existing event-driven architecture where workspace removal always triggers cleanup events, whether workspaces are removed individually or in bulk.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.