Skip to content

Conversation

@SStranks
Copy link
Contributor

@SStranks SStranks commented Oct 14, 2025

In conjunction with Pull Request #197033 on the vscode repository.

I reworked the previous merged code for this feature so that it now handles single-root, multi-root, and mono-repo project structures.

To clarify, aliases for css/scss are specified in the .vscode/settings.json under 'importAliases' for each language as before - I have updated the tool-tip descriptions in the package.nls.json file, and made code changes to cssServer to accommodate the functionality in the current PR - see PR 197033 above.

Functionality

  • Settings files/aliases at the workspace root take priority over any nested settings files. This allows avoiding directory tree lookup for settings files if a valid alias is discovered there first.
  • If no settings/alias is found at the workspace root; attempt lookup for .vscode/settings.json from document towards workspace root.
  • If lookup finds settings file; cache the path and cache the aliases for that document to avoid repeat lookups.
  • Added Public clearCache() method to CSSNavigation; to be called when settings.json changes (see limitations section below)

Changes

  • Added functionality above.
  • Updated: navigation tests.
  • Added: test fixture files

Limitations

  • clearCache() method only fires when settings files tracked by vscode are changed. Settings files discovered by lookup in cssNavigation are not covered. I didn't see a straightforward way to implement this; vscode cssServer imports connection.onDidChangeConfiguration from vscode-languageserver, and handles the watcher. Willing to make further changes if someone can suggest how/where to look.

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.

2 participants