sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.14k stars 207 forks source link

Define which files are private/hidden in Explorer with .hgignore, .gitignore, or similar. #7567

Open mforbes opened 1 month ago

mforbes commented 1 month ago

It would be very useful to be able to customize which files are hidden in the file Explorer.

A use-case is LaTeX: I find the users often click on the generated PDF files when most people should instead be opening the associated .tex file, which opens the editor and the PDF viewer. This is especially confusing for some given the lack of a download button #5548. While the PDF viewer could be improved, the easiest solution would be a way to hide the autogenerated PDF files.

Could a file be used to define which files are hidden/generated (i.e. toggled by the image buttons).

My recommended behaviour would be to use the presence of a file like .sage.ignore or similar to augment what files are toggled by the hidden file button, with the default being to hide any files.

Perhaps it would also be reasonable is to use .hgignore or .gitignore if they exist in the current or parent directory with .sage.ignore overriding if present. If this is not done, then at a minimum .sage.ignore should have a syntax compatible with these so a simple symlink or %include statement could be used to take advantage of existing .*ignore files.

mforbes commented 1 month ago

P.S. Perhaps for the specific LaTeX use-case, PDF files should be treated as autogenerated, and hence hidden by the corresponding toggle? (Though I think this is off by default, spoiling the main use of hiding these by default.)

williamstein commented 1 month ago

Another option -- any time you open any pdf a.pdf ever, if there is a correspending tex file (a.tex), then at the top of the pdf viewer it has a little (dismissible) banner that says "This file is autogenerated... blah blah blah... click here to open a.tex"?

A similar pattern could be used in all other known cases of autogenerated files, e.g., when using nbconvert to make a tex or pdf file associated to an ipynb file, it would be nice to have an easy link to the origin file....

mforbes commented 1 month ago

I was thinking also maybe double clicking would open the .tex file - especially if synctex is used as is the default.

(Still, being able to hide other files to help focus peoples attention in Explorer could be useful in other cases.)