Support platform-specific paths, variable expansion, and working directory for all tools#225
Merged
benmatselby merged 2 commits intomainfrom Feb 25, 2026
Merged
Support platform-specific paths, variable expansion, and working directory for all tools#225benmatselby merged 2 commits intomainfrom
benmatselby merged 2 commits intomainfrom
Conversation
…directory for all tools - Add platform-specific path settings using dict syntax with osx/linux/windows keys, allowing settings to sync across operating systems (closes #183) - Expand Sublime Text variables (${project_path}, ${folder}, etc.) in all setting values, enabling project-relative config file paths (closes #143) - Set working directory to the target file's directory in Fixer, CodeBeautifier, MessDetector, and Linter, matching existing Sniffer behaviour so relative paths in additional_args resolve correctly - Add unit tests for platform resolution, variable expansion, and working directory behaviour across all tool classes
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.
Summary
osx/linux/windowskeys, allowing settings to sync across operating systems (closes Plugin in multiple environments #183)${project_path},${folder}, etc.) in all setting values, enabling project-relative config file paths (closes Question: php-cs-fixer config file path in sublime-project? #143)Fixer,CodeBeautifier,MessDetector, andLinter, matching the existingSnifferbehaviour so that relative paths in_additional_argsresolve correctlyDetail
Platform-specific paths (#183)
Any path setting can now accept a dictionary keyed by platform instead of a plain string:
A
"default"fallback key is also supported. Non-platform dicts (e.g.phpcs_additional_args) are left unchanged.Variable expansion (#143)
All setting values now support Sublime Text's
${var}syntax viasublime.expand_variables(). The most useful variables are$project_pathand$folder, which are stable within a project session. For example:Working directory fix
Fixer,CodeBeautifier,MessDetector, andLinternow set their subprocess working directory to the target file's parent directory (viasetWorkingDir), matching whatSnifferalready does. This allows tools to find config files via relative paths.Implementation
All three features are implemented in
Pref.get(), keeping the change minimal:_resolve_platform_value()resolves dict-based platform values_expand_variables()expands${var}syntax usingwindow.extract_variables()This means every setting automatically benefits from both features with no changes needed in the tool classes (except the
setWorkingDircalls).Tests