Windows: path separator issues
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Lua
- Stelle
- 3.5k
- Fork
- 341
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nvim-lua/plenary.nvim
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
nvim-lua/plenary.nvim#682 ·
-
uniform usage of `os.getenv`Forse già presa @rakotomandimby l’ha presa 120 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
nvim-lua/plenary.nvim#680 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
nvim-lua/plenary.nvim#675 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
nvim-lua/plenary.nvim#672 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
nvim-lua/plenary.nvim#671 · 1 commento ·
Tutte le issue di nvim-lua/plenary.nvim
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
[Operation Enhancement]: .editorconfigと.gitattributesでdictionaryとLuaファイルの編集・改行設定を統一するForse già presa @5kdn l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
5kdn/DCS-Translation-Japanese#163 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug Report]Apertaarea/Cubelet area/CubeNet bug needs-triage needs:compliance
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
TencentCloud/CubeSandbox#1917 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100