tide icon indicating copy to clipboard operation
tide copied to clipboard

Some items are not working after fish 4.0 update

Open augustocdias opened this issue 9 months ago • 2 comments

I have noticed the items that rely on check if specific files are in the current tree are not working. (for example rust and node). Basically the path is $_tide_parent_dirs is not working correctly.

Debugging it, I've noticed the path is is fine, so I believe the generation of the env variable is not being done correctly. We're getting a '' entry in there.

augustocdias avatar Mar 03 '25 12:03 augustocdias

Maybe something like this:

        string escape (
            for dir in (string split / -- $PWD)
                if test (string length $dir) -lt 1
                    continue
                end
                set -a parts $dir
                string join / "" $parts
            end
        )

The above adds a test so we dont get any '' dirs, and then ensure we prepend each string with a / by adding that empty string at "". I dont think you would want to use trim or others due to dirs with spaces in them '/foo/bar/baz pancakes/'. This keeps them wrapped in single quotes.

        string escape (
                for dir in (string split / -- $PWD)
+                if test (string length $dir) -lt 1
+                        continue
+               end
-                set -la parts $dir
+                set -a parts $dir
-                string join / -- $parts
+                string join / "" $parts
                end
+           # unsure if this is needed
+           set --erase $parts 
        )

I dont know much really about fish as a language, but thought I'd contribute to the conversation.

UPDATE: ~~this looks great on paper but fails make test. someone will need to safely quote the dirs.~~ I did! See the linked PR in #566 🚀

nnungest avatar Mar 05 '25 05:03 nnungest

I took a stab at this in https://github.com/IlanCosman/tide/pull/566

nnungest avatar Mar 06 '25 04:03 nnungest