Skip to content

refactor(lsp): replace FolderConfig with LspFolderConfig using direct map access [IDE-1639]#797

Draft
bastiandoetsch wants to merge 11 commits intomasterfrom
feat/IDE-1639
Draft

refactor(lsp): replace FolderConfig with LspFolderConfig using direct map access [IDE-1639]#797
bastiandoetsch wants to merge 11 commits intomasterfrom
feat/IDE-1639

Conversation

@bastiandoetsch
Copy link
Collaborator

@bastiandoetsch bastiandoetsch commented Mar 10, 2026

User description

Summary

Remove custom FolderConfig data class and LspFolderConfigExtensions.kt. Store LspFolderConfig directly in FolderConfigSettings, eliminating conversion boilerplate between FolderConfig and LspFolderConfig.

All UI consumers and tests now access settings via the LspFolderConfig.settings map using LsFolderSettingsKeys constants. The withSetting extension function is preserved in LanguageServerSettings.kt for immutable config updates.

Changes

  • Removed FolderConfig data class from Types.kt
  • Removed LspFolderConfigExtensions.kt (typed extension properties, factory functions)
  • Updated FolderConfigSettings to store/retrieve LspFolderConfig directly
  • Updated SnykLanguageClient and LanguageServerWrapper to skip FolderConfig conversion
  • Updated UI code (SnykSettingsDialog, ReferenceChooserDialog, SnykToolWindowPanel, SaveConfigHandler) to use direct map access
  • Added TestFolderConfigHelper.kt for test convenience
  • Updated all affected tests

PR Type

Enhancement, Bug fix


Description

  • Replace FolderConfig with LspFolderConfig using map-based settings.

  • Update LSP protocol version to 25.

  • Refactor settings synchronization with Language Server.

  • Introduce explicit change tracking for settings.


Diagram Walkthrough

flowchart LR
  UI --> |Apply Settings| SaveConfigHandler
  SaveConfigHandler --> |Update Settings| SnykApplicationSettingsStateService
  SnykApplicationSettingsStateService --> |Tracks Changes| LspFolderConfig
  SnykApplicationSettingsStateService --> |Tracks Changes| GlobalSettings
  LanguageServerWrapper --> |Sends Config| LanguageServer
  LanguageServerWrapper --> |Sends Config| InitializationOptions
  InitializationOptions --> |Maps Settings| LsSettingsKeys
  InitializationOptions --> |Maps Folder Configs| LsFolderSettingsKeys
  SnykLanguageClient --> |Receives Config| LspConfigurationParam
  SnykLanguageClient --> |Updates Settings| SnykApplicationSettingsStateService
  SnykLanguageClient --> |Updates Folder Configs| FolderConfigSettings
  FolderConfigSettings --> |Manages| LspFolderConfig
  LspFolderConfig --> |Uses Map| ConfigSetting
Loading

File Walkthrough

Relevant files
Enhancement
2 files
SnykApplicationSettingsStateService.kt
Update LSP protocol version and add explicit change tracking
+9/-1     
ConfigurationDataClasses.kt
Add new fields to UI configuration data classes                   
+10/-0   
Refactoring
11 files
SnykProjectSettingsConfigurable.kt
Adapt project settings to use LspFolderConfig and keys     
+14/-6   
ReferenceChooserDialog.kt
Update dialog to use LspFolderConfig and map settings access
+22/-12 
SnykSettingsDialog.kt
Update settings dialog to display LspFolderConfig map values
+13/-6   
SaveConfigHandler.kt
Refactor save handler to use LspFolderConfig and explicit change
tracking
+138/-31
SnykToolWindowPanel.kt
Update tool window panel to use LspFolderConfig structure
+10/-5   
LanguageServerWrapper.kt
Implement new InitializationOptions and LspConfigurationParam
structure
+181/-39
SnykLanguageClient.kt
Replace folderConfigs notification with snykConfiguration
+192/-16
Types.kt
Remove deprecated FolderConfig and FolderConfigsParam data classes
+0/-32   
FolderConfigSettings.kt
Update FolderConfigSettings to manage LspFolderConfig       
+92/-63 
LanguageServerSettings.kt
Define new LSP configuration data classes (LspFolderConfig,
ConfigSetting)
+54/-2   
LanguageServerSettingsKeys.kt
Define constants for LSP settings keys                                     
+49/-0   
Tests
8 files
SnykApplicationSettingsStateServiceTest.kt
Add test for updated LSP protocol version                               
+6/-0     
SnykProjectSettingsConfigurableTest.kt
Update tests for LspFolderConfig and map-based settings   
+38/-15 
ReferenceChooserDialogTest.kt
Update tests for LspFolderConfig and map-based settings   
+32/-16 
SnykToolWindowSnykScanListenerTest.kt
Update tests for LspFolderConfig usage                                     
+2/-2     
LanguageServerWrapperTest.kt
Update tests for InitializationOptions and LspConfigurationParam
+12/-12 
SnykLanguageClientTest.kt
Update tests for snykConfiguration and LspConfigurationParam
+48/-8   
FolderConfigSettingsTest.kt
Update tests for LspFolderConfig and map-based settings management
+191/-106
TestFolderConfigHelper.kt
Add helper to create LspFolderConfig instances                     
+37/-0   
Additional files
2 files
test-output.txt +10/-0   
tests.json +51/-0   

… map access [IDE-1639]

Remove custom FolderConfig data class and LspFolderConfigExtensions.kt.
Store LspFolderConfig directly in FolderConfigSettings, eliminating
conversion boilerplate between FolderConfig and LspFolderConfig.

All UI consumers and tests now access settings via the LspFolderConfig
settings map using LsFolderSettingsKeys constants. The withSetting
extension function is preserved in LanguageServerSettings.kt for
immutable config updates.
@snyk-io
Copy link

snyk-io bot commented Mar 10, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@bastiandoetsch
Copy link
Collaborator Author

/describe

@snyk-pr-review-bot
Copy link

PR Description updated to latest commit (a2b9036)

- Remove unused LanguageServerSettings data class (replaced by the
  LspConfigurationParam/getSettings() approach with LsSettingsKeys)
- Remove unused defaultSettings and trustedFolders variables in
  getSettings() that were computed but never referenced
- Remove unused SnykApplicationSettingsStateService import
Adapt .cursor rules and skills to Claude Code equivalents:
- CLAUDE.md: project rules (adapted from .cursor/rules/general.mdc)
- .claude/commands/commit.md: commit workflow skill
- .claude/commands/create-implementation-plan.md: planning skill
- .claude/commands/verification.md: code verification skill
- .claude/commands/implementation.md: implementation workflow skill
- .gitignore: exclude .claude/settings.local.json (machine-specific)
…errides; remove dead env info settings

- Set changed=true for automaticAuthentication and trustEnabled so they
  are always transmitted as user-overrides to the language server
- Set changed=true for token (always a user-override when present)
- Remove environment info entries from settings map (integration_name,
  integration_version, device_id, os_platform, os_arch, runtime_name,
  runtime_version) — snyk-ls reads these from top-level
  InitializationOptions fields, not from the settings map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant