Skip to content

Provide current workspace path in $psEditor.Workspace #236

@gerane

Description

@gerane

It would be nice to be able to get access to things like the currently opened file's path, file's root directory, project's root directory and things like that.

An example usage might be to create an Editor Command that creates a Pester Test for the currently opened file and places it in the appropriate Tests directory for that Project.

A user might have projects with different locations of their Tests. It would be beneficial to have a config file. One could eventually be provided by Editor services, but if you have access to the Project root, you could have your own config file where you gather settings such as Pester Test directory, psake script, psdeploy script, or anything like that.

So your scripts could just get the ProjectRoot and then access their own config file for Settings. So two different projects could have different structure or layouts, but you could still create editor commands that is aware of their project differences.

An Example:

Project: A
Returns 'ProjectRoot\Tests' for Tests Directory

Project: B
Returns 'ProjectRoot' for Tests Directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions