Closed carlpett closed 3 years ago
Hey I'm on vacation and will try to find some time to read through this when I have some downtime.
Sorry, been a while since you opened this, hopefully you didn't fully move on.
I think the idea of keeping the working directory in the root of the project is a fair assumption, although it might have some side effects in some cases. I'll read through how this works again and see if that could make sense.
Looking specifically for the dir that contains tsconfig.json is super ts specfic. Would it be safe to change the process to the nearest dir containing package.json found above the file being formatted?
We could make this customizable if we have to, but I think I will start with trying that.
I sounds like it should be safe for all my use cases, I'm not sure if there are edge cases around multi-level repos or something though? But I'd be happy enough with that approach :)
And thanks for coming back to this! :heart:
You are right. Lerna being the example.
The ideal would be ts-standard being more flexible on finding config files, but I think project / folder root might help out a lot.
https://github.com/bcomnes/sublime-standard-format/releases/tag/v6.4.2 will be hitting package control soon (hopefully in a few hours). Let me know how that works for you.
Works nicely, thanks! With this in place I found another bit needed for ts-standard
support, a PR is coming for that.
Sweet yeah let me know
I'm trying to use this plugin with
ts-standard
(standard
for TypeScript), but running into a problem which I think is due to the pluginchdir
:ing to the file location: https://github.com/bcomnes/sublime-standard-format/blob/cddd2d7225afa4f4be0496b0c3ad7ba906c8e08b/standard-format.py#L285The
ts-standard
executable needs to read thetsconfig.json
file in the project root, and since we're leaving the root dir, it simply fails the save hook:My StandardFormat.sublime-settings looks like this:
Two possible solutions I can see would be either to keep the working directory in the project root (might not be simple in multi-directory projects?), or support some type of replacement tokens in the commands (I'll end up needing the file name somehow anyway due to requirements by
ts-standard
).Thoughts?