focus-editor / focus

A simple and fast text editor
GNU General Public License v3.0
1.82k stars 99 forks source link

Feature Request: Use the current file in the build step #325

Closed IRooc closed 7 months ago

IRooc commented 8 months ago

Describe the feature It would be a nice feature if the currently active filename could be used in the buildstep. 1 example would be to have an external linter/prettier run through the file.

To Reproduce Example would be:

or some other tool you'd like to run on the current file

Additional context Maybe you have a library of scripts that you would like to run individually

dcourtois commented 8 months ago

Yes!! I would even go slightly further and add a few more "variables" that could be substituted. From the top of my mind being able to have those available to commands would be really helpfull for more generic build commands:

focus-editor commented 7 months ago

This will be available in the next nightly and will be released in 0.3.4 soon. Please reopen if you notice issues.

IRooc commented 7 months ago

Just leaving this here so people know how to use it, thanks! This code shows the tokens that are used in parsing the command https://github.com/focus-editor/focus/blob/8071628b0ef763fa9a7bf3283555466e01c9a8d4/src/build_system.jai#L516

focus-editor commented 7 months ago

This is not the full list. There's also BUILD_WORKING_DIR and RUN_WORKING_DIR. The full list is in the release changelog and in the default config examples

IRooc commented 7 months ago

The example project file part: https://github.com/focus-editor/focus/blob/424c17de58dd7698ae83b73467d87e503d9d8441/config/example-project.focus-config#L54-L61