Skip to content

Conversation

@lethosor
Copy link
Contributor

This makes it possible to configure the same formatter for multiple scopes and change its behavior based on the scope as determined by Sublime, rather than the file extension. This is useful e.g. for files that lack an extension but whose language is known to Sublime.

Inspired by #11, although it may not completely address that use-case.

vars['tab_size'] = str(tab_size)
vars['indent'] = indent
vars['scope'] = view_scope(view)
vars.update(os.environ)
Copy link
Contributor Author

@lethosor lethosor May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a possible improvement here where os.environ could be given lowest priority. Right now it is given highest priority, so e.g. if someone happens to have an environment variable named file, $file in formatter commands would expand to that, rather than the value returned from view.window().extract_variables() here. I'm not sure when this behavior would be desirable.

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