sagemathinc / cocalc

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

find in files: we use grep and git grep, but jupyterlab is about to use ripgrep. Should we change to use that or make it an option, for better compatibility? #5886

Open williamstein opened 2 years ago

williamstein commented 2 years ago

See https://github.com/BurntSushi/ripgrep

Screen Shot 2022-04-27 at 9 44 57 AM
williamstein commented 2 years ago

Another intersting point -- what Frederic is implementing in JupyterLab has the intention that if a file is open and not saved, he wants to have the search actually search the version in memory (not on disk), and it prints a warning about things being slightly stale. I hadn't thought of that case, but it's a good idea. That said, I think whenever you hide a tab to view the search tab, any background tab probably gets saved to disk in a second anyways, so maybe this isn't important.

Note -- we have the "in memory" files on the backend too.

williamstein commented 2 years ago

Another point he discusses is jumping to the location in the file that matches a search, and points out that this is very subtle for Jupyter notebooks. CoCalc is just dumb in this case, but I think what Frederic implemented is even dumber (which is opening the notebook as a plain text json file).

jasongrout commented 2 years ago

IIRC, VS Code uses ripgrep (see https://github.com/microsoft/vscode-ripgrep, for example)

williamstein commented 2 years ago

CoCalc also doesn't have replace functionality at this level, but what Frederic wrote appears to (?), and ripgrep does. So a big advantage of switching is an easy way to do replace.