Open adrian-gierakowski opened 8 months ago
Hmm. My first question would be: what about anonymous buffers? They don't have paths (view.file_path() is None
). They only have scope selectors.
Anonymous buffer could match only if given formatter didn’t have a path based condition, or if the condition matched an empty string
Might be useful to get more details about your use case, such as directory structure, files involved, formatters used. We might come up with other solutions too.
I'm using dprint and prettier for js\ts files and other formatters for other languages. One of the sub-dirs in the monorepo needs to be formatted with prettier.
I started using https://numtide.github.io/treefmt to dispatch do different formatters, however it needs a file path to be able to select the formatter to use.
So I would need sublime-fmt to provide full path of formatted file when running on save. If formatting a buffer without a path, a dummy file name (with extension) could be provided to let treefmt pick the formatter to use.
I am working in a monorepo in which different sub-projects use different formatters for the same file types
I would like to enable formatting on save but don't see how I could make formatting conditional on the files path using sublime selectors
could a new setting be added to enable this? Thanks!