feat: implement $/snyk.configuration notification handler [IDE-1652]#373
feat: implement $/snyk.configuration notification handler [IDE-1652]#373nick-y-snyk wants to merge 8 commits intomainfrom
Conversation
…nfig management [IDE-1652] Implement Story 1.1: Configuration reception, storage, and persistence. Adds new message types (ConfigSetting, LspFolderConfig, LspConfigurationParam), FolderConfigSettings singleton for thread-safe folder config storage, and snykConfiguration handler on SnykExtendedLanguageClient that persists global settings and manages folder configs from the Language Server.
…[IDE-1652] - Add explicitChanges tracking to Preferences (mark/check/clear/persist with flush) - Refactor LsConfigurationUpdater to produce LspConfigurationParam instead of old Settings type - Add ConfigSetting.outbound() factory for value+changed only outbound settings - Update SnykLanguageServer.getInitializationOptions() to use buildConfigurationParam() - Add convertInboundValue() for scanning mode format conversion - Synchronize FolderConfigSettings.setInstance(), add null guards on explicit-change methods - Extract 21 LS setting key constants to LsSettingsKeys - Add 21 new tests covering change tracking, payload construction, and round-trip semantics
… getCurrentSettings [IDE-1652] Migrate HTMLSettingsPreferencePage, NativeProjectPropertyPage, ReferenceChooserDialog, and SnykToolView from old FolderConfigs/FolderConfig to FolderConfigSettings/LspFolderConfig. Add bridge in folderConfig() to populate both old and new config systems during transition. Remove unused getCurrentSettings() from LsConfigurationUpdater and its test.
…v25 [IDE-1652] Delete FolderConfig, FolderConfigsParam, FolderConfigs, and Settings classes. Remove old $/snyk.folderConfigs handler and SNYK_FOLDER_CONFIG constant. Bump REQUIRED_LS_PROTOCOL_VERSION from 23 to 25. Resolve review findings: token changed flag uses isExplicitlyChanged, atomic computeFolderConfig for consumer writes, additionalParameters returns List<String>, folderPath set on empty configs.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This comment has been minimized.
This comment has been minimized.
…aths [IDE-1652] Replace prefs.store() with prefs.storeAndTrackChange() in all user-facing settings pages (HTMLSettingsPreferencePage, PreferencesPage, BaseHandler, SnykWizard, SummaryBrowserHandler) so that user edits are tracked as explicitly changed. Wire folder-scope consumers to use withSettingIfChanged instead of withSetting. Update LsConfigurationUpdater to propagate isExplicitlyChanged for all user-changeable settings in the outbound payload. Remove unused PREF_TO_LS_KEY field.
This comment has been minimized.
This comment has been minimized.
|
|
||
| private static FolderConfigSettings instance; | ||
|
|
||
| private final ConcurrentHashMap<String, LspFolderConfig> configs = new ConcurrentHashMap<>(); |
Check warning
Code scanning / PMD
Avoid using implementation types like 'ConcurrentHashMap'; use the interface instead Warning
| for (LspFolderConfig config : folderConfigs) { | ||
| try { | ||
| addFolderConfig(config); | ||
| } catch (Exception e) { |
Check warning
Code scanning / PMD
Avoid catching Exception in try-catch block Warning
This comment has been minimized.
This comment has been minimized.
…user overrides [IDE-1652] storeAndTrackChange compared against hardcoded empty string default instead of the registered store default, causing settings with non-empty defaults to be falsely marked as user-overridden on first save. HTML settings form now handles null values from LS as reset signals, calling clearExplicitlyChanged to remove the user override before the next didChangeConfiguration is sent to the LS.
This comment has been minimized.
This comment has been minimized.
Use Map interface instead of ConcurrentHashMap for field declaration. Narrow catch clause from Exception to IllegalArgumentException.
PR Reviewer Guide 🔍
|
Summary
$/snyk.configurationJSON-RPC notification handler for centralized enterprise policy enforcement, replacing the typedFolderConfig/$/snyk.folderConfigsinfrastructure with a genericMap<String, ConfigSetting>settings systemexplicitChangesset, and outboundworkspace/didChangeConfigurationusingLspConfigurationParamformatFolderConfigSettingsserviceFolderConfig,FolderConfigsParam,FolderConfigs,Settings,$/snyk.folderConfigshandler) and bump LS protocol version to 25What this enables
Enterprise administrators configure security policies via LDX-Sync at tenant/org/machine scope. The Language Server resolves effective settings (applying precedence rules) and pushes them to the Eclipse plugin via
$/snyk.configuration. The plugin persists settings durably, tracks user overrides, and sends changes back viaworkspace/didChangeConfiguration. This aligns Eclipse with the IntelliJ implementation for cross-IDE configuration parity.Key design decisions
Map<String, ConfigSetting>) instead of typed fields — any future LS setting works without Eclipse-side code changesmarkExplicitlyChanged()didChangeConfigurationsends all settings withchangedflags, not deltasisLocked,source,originScopeare persisted for a follow-up iterationChanges
New files
ConfigSetting.java— per-setting value with lock metadata andoutbound()factoryLspFolderConfig.java— per-folder config with immutablewithSetting()builderLspConfigurationParam.java— top-level notification/outbound payload typeFolderConfigSettings.java— singleton service replacingFolderConfigswith thread-safe storage, typed convenience methods, and atomiccomputeFolderConfig()LsSettingsKeys.java/LsFolderSettingsKeys.java— LS protocol key constantsModified files
SnykExtendedLanguageClient.java— addedsnykConfiguration()handler, removed oldfolderConfig()handlerLsConfigurationUpdater.java— replacedgetCurrentSettings()withbuildConfigurationParam()Preferences.java— addedexplicitChangestracking (mark/is/clear, persisted)LsBinaries.java—REQUIRED_LS_PROTOCOL_VERSIONbumped from "23" to "25"FolderConfigSettingsDeleted files
FolderConfig.java,FolderConfigsParam.java,FolderConfigs.java,Settings.java,FolderConfigTest.javaTest plan
explicitChangespersistence across restart, mark/is/clear operations, multi-key supportLspConfigurationParamstructure, changed flags fromexplicitChanges, no lock metadata in outbound, full-state semantics, reset-to-default (value: null, changed: true)computeFolderConfigatomicity,isConfigured,updateFolderConfig