@@ -424,55 +424,202 @@ class BookList {
424424}
425425
426426
427- # Example 4 - Class definition with and without Runspace affinity
428-
429- # Class definition with Runspace affinity (default behavior)
430- class UnsafeClass {
431- # @@@@@@@@@@@ definition
432- static [Object ] ShowRunspaceId($Val ) {
433- # @@@@@@@@@@@@@@ definition
434- return [pscustomobject ]@ {
435- ThreadId = [Threading.Thread ]::CurrentThread.ManagedThreadId
436- RunspaceId = [runspace ]::DefaultRunspace.Id
427+ # Example 4 - Class definition with and without Runspace affinity
428+
429+ # Class definition with Runspace affinity (default behavior)
430+ class UnsafeClass {
431+ # @@@@@@@@@@@ definition
432+ static [Object ] ShowRunspaceId($Val ) {
433+ # @@@@@@@@@@@@@@ definition
434+ return [pscustomobject ]@ {
435+ ThreadId = [Threading.Thread ]::CurrentThread.ManagedThreadId
436+ RunspaceId = [runspace ]::DefaultRunspace.Id
437+ }
437438 }
438439 }
439- }
440440
441- $unsafe = [UnsafeClass ]::new()
442- # @@@ reference
441+ $unsafe = [UnsafeClass ]::new()
442+ # @@@ reference
443443
444- while ($true ) {
445- 1 .. 10 | ForEach-Object - Parallel {
446- # @@@@@@@@@@@@@@ reference
447- Start-Sleep - ms 100
448- # @@@@@@@@@@@ reference
449- ($Using :unsafe )::ShowRunspaceId($_ )
450- # @@@@@@@@@@@@@@ reference
444+ while ($true ) {
445+ 1 .. 10 | ForEach-Object - Parallel {
446+ # @@@@@@@@@@@@@@ reference
447+ Start-Sleep - ms 100
448+ # @@@@@@@@@@@ reference
449+ ($Using :unsafe )::ShowRunspaceId($_ )
450+ # @@@@@@@@@@@@@@ reference
451+ }
451452 }
452- }
453453
454- # Class definition with NoRunspaceAffinity attribute
455- [NoRunspaceAffinity ()]
456- class SafeClass {
457- # @@@@@@@@@ definition
458- static [Object ] ShowRunspaceId($Val ) {
459- # @@@@@@@@@@@@@@ definition
460- return [pscustomobject ]@ {
461- ThreadId = [Threading.Thread ]::CurrentThread.ManagedThreadId
462- RunspaceId = [runspace ]::DefaultRunspace.Id
454+ # Class definition with NoRunspaceAffinity attribute
455+ [NoRunspaceAffinity ()]
456+ class SafeClass {
457+ # @@@@@@@@@ definition
458+ static [Object ] ShowRunspaceId($Val ) {
459+ # @@@@@@@@@@@@@@ definition
460+ return [pscustomobject ]@ {
461+ ThreadId = [Threading.Thread ]::CurrentThread.ManagedThreadId
462+ RunspaceId = [runspace ]::DefaultRunspace.Id
463+ }
463464 }
464465 }
465- }
466466
467- $safe = [SafeClass ]::new()
468- # @@@ reference
467+ $safe = [SafeClass ]::new()
468+ # @@@ reference
469469
470- while ($true ) {
471- 1 .. 10 | ForEach-Object - Parallel {
472- # @@@@@@@@@@@@@@ reference
473- Start-Sleep - ms 100
474- # @@@@@@@@@@@ reference
475- ($Using :safe )::ShowRunspaceId($_ )
476- # @@@@@@@@@@@@@@ reference
470+ while ($true ) {
471+ 1 .. 10 | ForEach-Object - Parallel {
472+ # @@@@@@@@@@@@@@ reference
473+ Start-Sleep - ms 100
474+ # @@@@@@@@@@@ reference
475+ ($Using :safe )::ShowRunspaceId($_ )
476+ # @@@@@@@@@@@@@@ reference
477+ }
477478 }
478- }
479+
480+
481+ class Vehicle {
482+ # ^^^^^^^^^^^^^^^ meta.class.powershell
483+ # ^^^^^ keyword.declaration.class.powershell
484+ # ^^^^^^^ entity.name.class.powershell
485+ # @@@@@@@ definition
486+ # ^ punctuation.section.block.begin.powershell
487+ Vehicle() {}
488+ # ^^^^^^^^^^^^^^^^^^^ meta.class.powershell
489+ # ^^^^^^^^^^^^ meta.function.powershell
490+ # ^^^^^^^ entity.name.function.powershell
491+ # @@@@@@@ definition
492+ # ^ punctuation.section.parameters.begin.powershell
493+ # ^ punctuation.section.parameters.end.powershell
494+ # ^ punctuation.section.block.begin.powershell
495+ # ^ punctuation.section.block.end.powershell
496+ Vehicle([string ]$Owner ) {
497+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
498+ # ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
499+ # ^^^^^^^ entity.name.function.powershell
500+ # @@@@@@@ definition
501+ # ^ punctuation.section.parameters.begin.powershell
502+ # ^ punctuation.section.brackets.begin.powershell
503+ # ^^^^^^ storage.type.powershell
504+ # ^ punctuation.section.brackets.end.powershell
505+ # ^^^^^^ variable.parameter.powershell
506+ # ^ punctuation.definition.variable.begin.powershell
507+ # ^ punctuation.section.parameters.end.powershell
508+ # ^ punctuation.section.block.begin.powershell
509+ $this.Owner = $Owner
510+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
511+ # ^^^^^ variable.language.powershell
512+ # ^ punctuation.definition.variable.powershell
513+ # ^ punctuation.accessor.dot.powershell
514+ # ^^^^^ variable.other.member.powershell
515+ # ^ keyword.operator.assignment.powershell
516+ # ^^^^^^ variable.other.readwrite.powershell
517+ # ^ punctuation.definition.variable.powershell
518+ }
519+ # ^^^^^^^^ meta.class.powershell meta.function.powershell
520+ # ^ punctuation.section.block.end.powershell
521+
522+ [int ]$Mileage
523+ # ^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
524+ # ^ punctuation.section.brackets.begin.powershell
525+ # ^^^ storage.type.powershell
526+ # ^ punctuation.section.brackets.end.powershell
527+ # ^^^^^^^^ variable.other.readwrite.powershell
528+ # ^ punctuation.definition.variable.powershell
529+ [int ]$Age
530+ # ^^^^^^^^^^^^^^^^ meta.class.powershell
531+ # ^ punctuation.section.brackets.begin.powershell
532+ # ^^^ storage.type.powershell
533+ # ^ punctuation.section.brackets.end.powershell
534+ # ^^^^ variable.other.readwrite.powershell
535+ # ^ punctuation.definition.variable.powershell
536+ [string ]$Owner
537+ # ^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
538+ # ^ punctuation.section.brackets.begin.powershell
539+ # ^^^^^^ storage.type.powershell
540+ # ^ punctuation.section.brackets.end.powershell
541+ # ^^^^^^ variable.other.readwrite.powershell
542+ # ^ punctuation.definition.variable.powershell
543+
544+ [void ]Drive([int ]$NumberOfMiles ) {
545+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
546+ # ^ punctuation.section.brackets.begin.powershell
547+ # ^^^^ storage.type.powershell
548+ # ^ punctuation.section.brackets.end.powershell
549+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
550+ # ^^^^^ entity.name.function.powershell
551+ # @@@@@ definition
552+ # ^ punctuation.section.parameters.begin.powershell
553+ # ^ punctuation.section.brackets.begin.powershell
554+ # ^^^ storage.type.powershell
555+ # ^ punctuation.section.brackets.end.powershell
556+ # ^^^^^^^^^^^^^^ variable.parameter.powershell
557+ # ^ punctuation.definition.variable.begin.powershell
558+ # ^ punctuation.section.parameters.end.powershell
559+ # ^ punctuation.section.block.begin.powershell
560+ $this.Mileage += $NumberOfMiles
561+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
562+ # ^^^^^ variable.language.powershell
563+ # ^ punctuation.definition.variable.powershell
564+ # ^ punctuation.accessor.dot.powershell
565+ # ^^^^^^^ variable.other.member.powershell
566+ # ^^ keyword.operator.assignment.augmented.powershell
567+ # ^^^^^^^^^^^^^^ variable.other.readwrite.powershell
568+ # ^ punctuation.definition.variable.powershell
569+
570+ }
571+ # ^^^^^^^^ meta.class.powershell meta.function.powershell
572+ # ^ punctuation.section.block.end.powershell
573+
574+ static [System.Array ] GetAvailableColors() {
575+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
576+ # ^^^^^^ storage.modifier.powershell
577+ # ^ punctuation.section.brackets.begin.powershell
578+ # ^^^^^^^ meta.generic-name.powershell
579+ # ^ punctuation.accessor.dot.powershell
580+ # ^^^^^ support.type.powershell
581+ # ^ punctuation.section.brackets.end.powershell
582+ # ^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
583+ # ^^^^^^^^^^^^^^^^^^ entity.name.function.powershell
584+ # @@@@@@@@@@@@@@@@@@ definition
585+ # ^ punctuation.section.parameters.begin.powershell
586+ # ^ punctuation.section.parameters.end.powershell
587+ # ^ punctuation.section.block.begin.powershell
588+ return ' yellow' , ' red'
589+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
590+ # ^^^^^^ keyword.control.flow.return.powershell
591+ # ^^^^^^^^ meta.string.powershell string.quoted.single.powershell
592+ # ^ punctuation.definition.string.begin.powershell
593+ # ^ punctuation.definition.string.end.powershell
594+ # ^ punctuation.separator.sequence.powershell
595+ # ^^^^^ meta.string.powershell string.quoted.single.powershell
596+ # ^ punctuation.definition.string.begin.powershell
597+ # ^ punctuation.definition.string.end.powershell
598+ }
599+ # ^^^^^^^^ meta.class.powershell meta.function.powershell
600+ # ^ punctuation.section.block.end.powershell
601+ }
602+ # ^^^^ meta.class.powershell
603+ # ^ punctuation.section.block.end.powershell
604+
605+ $fiat.Drive (42 )
606+ # ^^^ meta.class.powershell
607+ # ^^^^^ variable.other.readwrite.powershell
608+ # ^ punctuation.definition.variable.powershell
609+ # ^ punctuation.accessor.dot.powershell
610+ # ^^^^^ meta.function-call.powershell variable.function.powershell
611+ # @@@@@ reference
612+ # ^^^^ meta.function-call.arguments.powershell
613+ # ^ punctuation.section.arguments.begin.powershell
614+ # ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
615+ # ^ punctuation.section.arguments.end.powershell
616+ [Vehicle ]::GetAvailableColors()
617+ # ^ punctuation.section.brackets.begin.powershell
618+ # ^^^^^^^ support.type.powershell
619+ # ^ punctuation.section.brackets.end.powershell
620+ # ^^ punctuation.accessor.double-colon.powershell
621+ # ^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
622+ # @@@@@@@@@@@@@@@@@@ reference
623+ # ^^ meta.function-call.arguments.powershell
624+ # ^ punctuation.section.arguments.begin.powershell
625+ # ^ punctuation.section.arguments.end.powershell
0 commit comments