-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
search the directory hierarchy for indentation heuristics #288
Comments
I think we'll want this be a fallback when there isn't e.g. a .editorconfig file or similar. That way the (machine readable) standard dictated by the project is followed when it exists, but things still Just Work™ when that's absent. Also, I'm sure this goes without saying (and imagine is how sleuth works), but just to be explicit: this should be per-file-type, probably based on file extension. Don't want C++ files interfering with the indentation style of Python files in the same project, or vice-versa. |
we may also want to limit it to a project directory if we can detect that (git root or similar), though i can definitely see a benefit in globally traversing until we find a match |
Yeah, I think deciding what files should be searched is the only tricky part of the feature. Ideally we want this to be instant, so there will need to be some heuristics to keep the search from exploding in a project with tons of files. I definitely agree it should be limited to the current project, though! Maybe do a search for VCS root, and if it's not found then only search below the current directory. |
ideally it stops searching on the first match, so projects with tons of files should not be an issue anyway |
I think collecting two or three example files would be a good idea. But in any case, it's certainly bounded in that sense, yes. However, I was thinking of cases like:
Both cases are uncommon, but probably come up occasionally. Having said that, we could also index the project tree in the background to make it fast to query files by file extension. In fact, I think Helix might already have something along those lines, but for the navigate-to-file fuzzy searching. So maybe it's a non-issue. Worst case, we just make some changes to that indexing code to also serve this purpose. |
sleuth.vim's README says:
when creating new files in an existing project, it's quite nice to have the editor automatically pick up the indentation format from the files around it instead of making the user copy it themselves.
The text was updated successfully, but these errors were encountered: