PowerShell / PowerShell/PowerShellEditorServices
Feature Request: Add ability to change the language through $psEditor
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
After some contemplation, I've realized there's no need to make a request to change/add to the PSES module, as I can just do it in my profile. However, what I would like to see is the ability to change the language (likely with a SetLanguage() method on one of the objects somewhere).
Would there be appetite for adding this in at some point? I understand the PowerShell team is busy on other areas of the codebase and I don't want to put forward a suggestion of anything that might set back that work or unnecessarily distract from it.
What I would like to see is the ability to run something like: $psEditor.GetEditorContext().CurrentFile.SetLanguage('markdown') and have the current file's language mode set to markdown.
Original request here for posterity:
I'm not entirely sure the best place for this, I found this when working on some things in vscode, but the underlying behaviour is in the PSES module, but also some of it depends on vscode... So I'll start it over here and it can be moved if needed.
I was doing some stuff in vscode, and I found myself with the need to take the output of my function
Get-IntuneDetectionScriptand output it into a new editor window. I found that I could do this withOut-CurrentFile -AsNewFile, however this output as a herestring. Thinking about this, I believe the reason is that typically when outputting to the current file this behaviour makes sense. However, in my opinion when outputting to a new file this doesn't make sense.Based on my use case, I'd like to make two feature requests:
- Add a
Out-NewFilefunction that does whatOut-CurrentFile -AsNewFilecurrently does, only it doesn't do the herestring.- Assuming it's not too much work: add a
-Languageparameter toOut-NewFilethat takes in the language for the new file and sets it.
- This is the part I'm not sure on complexity-wise. Setting the language in typescript is a minor adjustment
With these suggestions you could do things like:
Get-IntuneDetectionScript "Whatever App" | Out-NewFile -Language powershell Get-IntuneAppDescription "Whatever App" | Out-NewFile -Language markdownI've got a branch that includes the first feature request over here: https://github.com/corbob/PowerShellEditorServices/tree/out-newfile (To see the changes, they're all (currently) encapsulated in a single commit: https://github.com/corbob/PowerShellEditorServices/commit/3c33c968a03348f8678a3d45b1841250710ea055)
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
Comienza rastreando el punto de entrada $psEditor.GetEditorContext().CurrentFile y el comportamiento existente de Out-CurrentFile -AsNewFile. No se nombran archivos de implementación ni pruebas; para darlo por terminado sería necesario acordar la API, implementar los cambios de lenguaje para el archivo actual y validar los ejemplos solicitados de PowerShell y Markdown.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, typescript, vscode
- Área
- developer-experience, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100