PowerShell / PowerShell/PowerShellEditorServices

Feature Request: Add ability to change the language through $psEditor

Đang mở
#1,539 2 bình luận 4 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Area-API Issue-Enhancement
Ngôn ngữ chính
C#
Star
767
Fork
266
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
1

Mô tả

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-IntuneDetectionScript and output it into a new editor window. I found that I could do this with Out-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:

  1. Add a Out-NewFile function that does what Out-CurrentFile -AsNewFile currently does, only it doesn't do the herestring.
  2. Assuming it's not too much work: add a -Language parameter to Out-NewFile that 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 markdown

I'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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách lần theo điểm vào $psEditor.GetEditorContext().CurrentFile và hành vi hiện có của Out-CurrentFile -AsNewFile. Không có tệp triển khai hoặc bài kiểm thử nào được nêu tên; để hoàn thành sẽ cần thống nhất về API, triển khai các thay đổi ngôn ngữ cho tệp hiện tại và xác thực các ví dụ PowerShell và Markdown được yêu cầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, typescript, vscode
Lĩnh vực
developer-experience, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.