After TAB scriptblock error
-
Hi all.
I have a simple question:Example:
What can you do if you want to use the TAB to indent the code?
Thanks for yur help. -
Well you would go to the Settings menu and choose Preferences… and then see:
And you would change the setting for the language of interest (maybe what you show is Perl?).
-
Looks to be the Powershell language.
Quote from Microsofts Powershell about_Quoting_Rules documentation on Here-strings.
In either format, the closing quotation mark must be the first character in the line.
So it appears that
"@
needs to be at the start of the line to be valid syntax.Powershell Here-strings are not designed for indenting. So you may need to break the implied rule of indenting by:
function test1 { $test = @" This is a test "@ } function test2 { $test = @" This is a test "@ }
Looks ugly though it is valid syntax.
-
@mpheath said in After TAB scriptblock error:
Looks to be the Powershell language.
Quote from Microsofts Powershell about_Quoting_Rules documentation on Here-strings.In either format, the closing quotation mark must be the first character in the line.
So it appears that "@ needs to be at the start of the line to be valid syntax.
Powershell Here-strings are not designed for indenting. So you may need to break the implied rule of indenting by:Yes, powershell problem…
Yes ugly, I would like it to be fully indented… -
@venus642
Not so nice … -
It would be nice if Notepad++ could handle that.
-
@venus642 said in After TAB scriptblock error:
It would be nice if Notepad++ could handle that.
It is Powershell syntax. Notepad++ cannot do anything about how Powershell works.
The Lexilla component code is:
} else if (sc.state == SCE_POWERSHELL_HERE_STRING) { // This is a doubles quotes here-string if (sc.atLineStart && sc.ch == '\"' && sc.chNext == '@') { sc.Forward(2); sc.SetState(SCE_POWERSHELL_DEFAULT); }
sc.atLineStart
is a condition to close the Here-string, it must be at the start of the line. It complies with the current syntax of Powershell.If you want change to support indentation of Here-strings, then Powershell core development is where the change needs to done.
-
@mpheath
Thanks mpheath for your help and info. -
WARNING !
Had to realize that errors can occur when indenting. So it’s best to avoid it.