vscode-csharp-workspace
Useful commands for C# development.
This extension adds useful commands and menu entries for C# development.
Installing
ext install qp.csharp-workspace
Usage
Hit Ctrl+Shift+P
and type CSharp
to select command.
Features
- Add Class...: Create a class file, or an unamed document with namespace resolution
- Add API Controller...: Create a controller file, or an unamed document with namespace resolution
- Open Solution...: Open projects' folder from a solution file
Open Solution... replace current workspace
Public API
Commands are accessible with the public API.
let csharpUtils = vscode.extensions.getExtension('qp.csharp-workspace').exports;
Add class
addClass(classname: string, namespace?: string, directory?: vscode.Uri): Promise<void>
Create a new class definition with the name classname
in the namespace
namespace
into the destination folder directory
.
- classname (string, mandatory): the name of the class
- namespace (string, optional): the namespace
- directory (vscode.Uri: optional): the destination folder
If namespace
is undefined, it will be resolved against the directory, otherwise Default is used.
If directory
is undefined, no file is created, but an unamed file is open.
Add API controller
addApiController(controllername: string, namespace?: string, directory?: vscode.Uri): Promise<void>
Create a new API controller definition with the name controllername
in the namespace
namespace
into the destination folder directory
.
- controllername (string, mandatory): the name of the controller (if the name doesn't ends with Controller,
it is automatically appended)
- namespace (string, optional): the namespace
- directory (vscode.Uri: optional): the destination folder
If namespace
is undefined, it will be resolved against the directory, otherwise Default is used.
If directory
is undefined, no file is created, but an unamed file is open.
Open Solution
openSln(sln: vscode.Uri): Promise<void>
Replace current workspace with projects listed into the given .sln
file.
- sln (vscode.Uri, mandatory): the uri of the
.sln
file
Resolve namespace
resolveNamespace(path: vscode.Uri): Promise<string>
Provides the mechanism to resolve namespace.
- path (vscode.Uri, mandatory): a full path to the destination folder.
Licensing
The code in this project is licensed under CeCILL license. See LICENSE.txt file for more information.