-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Detect paths and highlight them if missing #2907
Comments
interesting idea. I have a few concerns about the idea which I want to share in case we can somehow address them:
|
If a path is relative, shouldn't it be relative to the file then? In this case we can check for files relative to the given file and check if those paths exist or not
Do you mean something like:
I'm very against hardcoding (especially since the reason why I initially opened this feature request was that I wanted my
I don't really use Windows myself, but I know that Windows' path just differ from starting with something like
I haven't looked into the codebase yet, so you know more about I do here :D However, if we just parse the currently visible paged content, that will make stuff faster. Also, regarding:
to avoid this we simply cache the files existence, this way the tab character will only be checked once.
why?
I don't quite get your point here - could you elaborate? So based on this, I'd propose we only check for existing paths for the first iteration. Also always check relatively to the file. When some content is passed through stdin, let's just check relative to cwd. What do you think about this? |
imagine some JSON like: {
"test": ".\test"
} it might at first glance look like a relative Windows path, but the |
{
"test": ".\test"
} Wouldn't you use: {
"test": ".\\test"
} instead? I think those cases are quite rare and most of the time we will be able to detect them correctly. I'll take a look at the code when I got some free time and will then open a PR. I think this feature would be much more helpful than it could harm, especially since it will be opt-in. |
Often when dealing with config files, a lot of paths are used. Being able to easily detect those paths when highlighted and see if they are missing would be such as live saver.
I propose to add an option
--show-paths
with the options:--show-paths=missing
, which will only highlight missing paths--show-paths
or--show-paths=all
, which will highlight existing paths in green and non-existing paths in red (or in different colors dependent on the theme)To detect paths I'd use a simple regex.
I can open a PR if you're okay with this idea and this implementation. I haven't looked much into the code, but I know a bit about Rust.
The text was updated successfully, but these errors were encountered: