PowerShell / PowerShell/PowerShellEditorServices
$psEditor does not handle 32/64 bit file redirection
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C#
- Estrellas
- 767
- Forks
- 266
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 1
Descripción
PSES is properly running in a 64bit context, but when it passes a path to be opened in VSCode it is being redirected to the 32bit path.
Example:
Register-EditorCommand `
-Name 'PowerShellEditorServices.OpenAllUserEditorProfile' `
-DisplayName 'Open All User Editor Profile' `
-SuppressOutput `
-ScriptBlock {
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)
$ProfilePath = Join-Path -Path $PShome -ChildPath 'Microsoft.VSCode_profile.ps1'
If (!(Test-Path -Path $ProfilePath)) { New-Item -Path $ProfilePath -ItemType File }
$psEditor.Workspace.OpenFile($ProfilePath)
}
The Editor Command properly creates
"C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.VSCode_profile.ps1"
Then when the same path is passed to $psEditor.Workspace.OpenFile and it is passing it to VSCode to open, Code is not handling the 32/64 redirect. This has terrible consequences for the user.
Code the attempts to open the following path:
"C:\Windows\sysWOW64\WindowsPowerShell\v1.0\Microsoft.VSCode_profile.ps1"
The command silently fails because the item does not exist.
As a temporary workaround you could pass $psEditor this path and it will work:
"C:\Windows\sysnative\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1"
This is not really a good solution and really should be addressed by VSCode. If they never plan on making a 64 bit client, they need to be handling 32/64 redirect. However, since I really don't think that will happen(or if it does, its likely not anytime soon), maybe we can get PSES handling this by passing the sysnative path if PSES is running in a 64 bit context.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza rastreando el punto de entrada $psEditor.Workspace.OpenFile y cómo pasa las rutas de Windows a VSCode. Reproduce la redirección de 32/64-bit con el ejemplo de profile-path proporcionado y compárala después con la solución alternativa sysnative. Se considera terminado cuando una ruta válida de 64-bit se abre sin apuntar silenciosamente a la ruta sysWOW64 inexistente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, powershell, vscode
- Área
- devtools, operating-systems
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100