How to enter tab (indent) in comments in PowerShell ISE?

This is strange.

I know that the tab is intended to complete the command in PowerShell ISE and so well. But it will also mix up the editing area.

Do it:

  • File> New ( Untitled1.ps1opens)

  • Click the tab (everything is fine, you will get the indent)

  • enter #(comment) and click the tab after it. Expected: you can get indents after the hash actual: hashes are replaced with $PSVersionTableor regardless of the command line in the history! (tab and circle Shift-tab)

Does this mean that nobody uses tabs in comments in PowerShell scripts, or that nobody uses comments in PowerShell scripts?

Is it possible to disable this behavior anywhere?

In addition, the behavior seems inconsistent. If I, for example, type ##, sometimes the tab does not complete the completion (it also does not enter the tab).

Can others reproduce this?

screenshot

System: Windows 8.1 Pro PowerShell ISE

+4
source share
1 answer

To answer the main question, you can enter Alt+09(using the numeric keypad) to enter <Tab>.

. , # , Tab . # , .

 Does this mean no-one uses tabs within comments in PowerShell scripts?

Anecdotal, , , <# #>. .

<#
Functions
    Get-Foo
    Get-Bar

Variables
    $Foo
    $Bar
#>

Function Get-Foo { ...

.

, or that no-one uses comments in PowerShell scripts?

, ; .

script, , , script, .

, :

  • Ctrl-D,
  • , , Ctrl-I, script
  • #<Tab>, script.
+5

Source: https://habr.com/ru/post/1548340/


All Articles