Skip to content

#Requires with hashtable marked as invalid. #1314

@omniomi

Description

@omniomi

System Details

  • Operating system name and version: Windows 10 1709
  • VS Code version: 1.23.0
  • PowerShell extension version: 1.7.0
PS X:\git\github\EditorSyntax> code -v

1.23.0
7c7da59c2333a1306c41e6e7b68d7f0caa7b3d45
x64

PS X:\git\github\EditorSyntax> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      7      0      0

PS X:\git\github\EditorSyntax> code --list-extensions --show-versions

[email protected]
[email protected]
[email protected]
[email protected]

PS X:\git\github\EditorSyntax> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When using #Requires -Modules with a hashtable (valid per https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_requires):

Requires -Modules PSWorkflow @{
  ModuleName="PSScheduledJob"
  ModuleVersion="1.0.0.0"
}

The hashtable is marked as invalid within VS Code:

Cannot process the #requires statement because it is not in the correct format.
The #requires statement must be in one of the following formats:
 "#requires -shellid <shellID>"
 "#requires -version <major.minor>"
 "#requires -psedition <edition>"
 "#requires -pssnapin <psSnapInName> [-version <major.minor>]"
 "#requires -modules <ModuleSpecification>"
 "#requires -runasadministrator"

hashtable-requires

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions