Windows: path separator issues
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Start with lua/plenary/path.lua, especially Path:new, and reproduce the Windows behavior from Telescope's git_files, git status, and path_display usage. Review issues #646, #254, and #393 plus PRs #591, #618, and #654 before choosing an approach. Done means paths from git and other utilities behave correctly on Windows while preserving a way to represent Unix-style paths when needed.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
There are currently multiple open issues for this:
#646 , #254 , #393
And even some open PRs:
#591 , #618, #654
My issue comes from Telescope git_files and git status functions and path_display setting which is not working correctly.
Since git (and there may be other unix/linux utilities which do the same) ignores OS specific path separator and always uses '/'
path processing becomes i bit of a nightmare.
I'd like to propose that Path utils always normalize path separator in constructor to the path separator valid for current OS.
There might be problems with this approach where someone might expect unix like path even on windows ...
For those scenarios maybe a helper function would be appropriate which would return unix style path
Anyways, here is my dirty fix that solves MY issue with git in telescope
diff --git a/lua/plenary/path.lua b/lua/plenary/path.lua
index 0865f2e..b93e79e 100644
--- a/lua/plenary/path.lua
+++ b/lua/plenary/path.lua
@@ -261,6 +261,11 @@ function Path:new(...)
path_string = table.concat(path_objs, sep)
else
assert(type(path_input) == "string", vim.inspect(path_input))
+ if path.sep == "\\" then
+ -- quickfix: on windows some utilities, e.g. git, return paths with '/' instead of '\'
+ -- so we will replace it here so that the rest of path processing works as expected
+ path_input = string.gsub(path_input, "/", "\\")
+ end
path_string = path_input
end
- Vorherrschende Sprache
- Lua
- Sterne
- 3.5k
- Forks
- 341
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nvim-lua/plenary.nvim
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
nvim-lua/plenary.nvim#682 ·
-
uniform usage of `os.getenv`Evtl. vergeben @rakotomandimby hat das vor 145 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
nvim-lua/plenary.nvim#680 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
nvim-lua/plenary.nvim#675 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 28/100
nvim-lua/plenary.nvim#672 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
nvim-lua/plenary.nvim#671 · 1 Kommentar ·
Alle Issues in nvim-lua/plenary.nvim
Ähnliche Issues
-
severity: low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
luainkernel/lunatik#2318 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100